Skip to content

feat(gmail): env-configure --auto-from-addressed-alias via GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS - #964

Merged
steipete merged 3 commits into
openclaw:mainfrom
ronny-rentner:feat/gmail-auto-from-addressed-alias-env
Aug 9, 2026
Merged

feat(gmail): env-configure --auto-from-addressed-alias via GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS#964
steipete merged 3 commits into
openclaw:mainfrom
ronny-rentner:feat/gmail-auto-from-addressed-alias-env

Conversation

@ronny-rentner

@ronny-rentner ronny-rentner commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS as an environment default for the existing --auto-from-addressed-alias option, so agents and wrappers can enable the policy without appending a flag to every invocation.

The environment default applies to the four command paths that already own the option and sender-selection behavior:

  • gmail reply
  • gmail reply-all
  • gmail drafts create
  • gmail drafts update

It does not add support to gmail forward. No behavior changes when the variable is unset, and an explicit --from retains its existing precedence.

Motivation

A bridge that consistently wants replies to use the verified send-as alias addressed by the original message currently has to pass --auto-from-addressed-alias on every supported command. The environment default follows gogcli's existing env-backed Gmail option conventions without creating a new sender-selection path.

Testing

  • Added TestGmailAutoFromAddressedAliasEnvDefaults, covering env parsing for all four supported commands.
  • Existing sender-selection tests cover addressed-alias selection, account-default fallback, and explicit --from precedence.
  • make ci passes.

Built-binary proof

The signed current-head binary was exercised source-blind with JSON dry runs:

  • Env enabled: all four plans reported auto_from_addressed_alias: true.
  • Env unset: all four plans reported false.
  • Env enabled plus explicit --from: the plan retained both the enabled option and explicit sender input.
  • No Google API call or message send occurred.

Provider-level alias proof is unavailable on the current test host because none of its healthy authenticated Gmail accounts exposes a verified non-primary send-as alias. The provider selection path itself is unchanged from the existing explicit flag.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41272d5b60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Attach []string `name:"attach" sep:"none" help:"Attachment file path (repeatable)"`
From string `name:"from" help:"Send from this email address (must be a verified send-as alias)"`
AutoFromAddressedAlias bool `name:"auto-from-addressed-alias" help:"When --from is omitted, reply from the verified send-as alias addressed by the original message"`
AutoFromAddressedAlias bool `name:"auto-from-addressed-alias" help:"When --from is omitted, reply from the verified send-as alias addressed by the original message" env:"GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor the environment setting in gmail forward

When GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS=true is used with gog gmail forward, the setting is never read despite the commit describing forward as supported: GmailForwardCmd has only a From field, and gmail_forward.go:61 resolves the sender directly from c.From before fetching the original message. Consequently forwards still use the default identity rather than the verified alias to which the original was addressed; add the equivalent flag and alias-selection path to GmailForwardCmd, or remove forward from the promised scope.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 11:49 PM ET / August 9, 2026, 03:49 UTC.

ClawSweeper review

What this changes

The PR adds GOG_GMAIL_AUTO_FROM_ADDRESSED_ALIAS as an environment default for the existing addressed-alias option on Gmail reply, reply-all, draft-create, and draft-update commands.

Merge readiness

Blocked until stronger real behavior proof is added - 3 items remain

Keep open. The change is a narrow reuse of the shipped addressed-alias policy, but the asserted built-binary dry-run proof has no inspectable terminal output or artifact; external PRs need visible after-fix evidence before merge.

Priority: P2
Reviewed head: b2068d8cd2baf361c6179968061fda120e6c0971

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and regression-covered, but uninspectable runtime-proof claims leave the external real-behavior merge gate unmet.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The body describes built-binary dry runs, but no inspectable terminal output, recording, logs, or linked artifact shows the after-fix result; add redacted evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The body describes built-binary dry runs, but no inspectable terminal output, recording, logs, or linked artifact shows the after-fix result; add redacted evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Current implementation boundary: Current main has the addressed-alias option and passes it into reply sender selection, but its option field has no environment binding; the requested environment default is therefore not already implemented.
PR scope and regression coverage: The supplied three-file PR diff adds the same environment tag to the shared reply options and both draft option structs, plus a four-command dry-run parsing test.
Merged feature provenance: The underlying opt-in addressed-alias behavior was introduced by the merged Gmail feature commit, whose message documents explicit --from precedence, fallback behavior, and reply/draft coverage.
Findings None None.
Security None None.

How this fits together

Gog’s Gmail commands parse flags and environment defaults into compose options, then choose a verified sender identity before creating a reply or draft. This change supplies a new configuration input while retaining the existing sender-selection logic.

flowchart LR
  A[CLI flags and environment] --> B[Gmail compose options]
  B --> C[Reply or draft command]
  C --> D[Verified sender selection]
  D --> E[Gmail reply or draft request]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The body describes built-binary dry runs, but no inspectable terminal output, recording, logs, or linked artifact shows the after-fix result; add redacted evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - When the variable is enabled, replies and reply-context drafts may visibly send from a different verified identity; the current proof claim does not show a real Gmail account with a verified non-primary alias exercising that path.
  • Complete next step (P2) - The remaining gate is contributor-supplied real behavior proof, not a concrete repair for an automated worker.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta production +3, tests +41 Three option bindings reuse one existing behavior, with one focused parsing test covering all four affected commands.

Merge-risk options

Maintainer options:

  1. Add real Gmail proof before merge (recommended)
    Provide redacted after-fix terminal output or a linked artifact from a built binary, ideally including a verified non-primary send-as alias, before merging this sender-selection default.

Technical review

Best possible solution:

Retain the opt-in environment default, then add a redacted built-binary terminal transcript showing enabled, unset, and explicit---from cases; include provider-backed alias selection when a suitable account is available.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds an environment-default configuration path rather than reporting broken existing behavior. Current source confirms that the existing sender-selection path is reused.

Is this the best way to solve the issue?

Yes, subject to proof: binding the environment variable to the existing option is the narrowest implementation and avoids a parallel sender-selection path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8b33065cbf3d.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded Gmail configuration feature with limited impact outside callers that opt into the new environment variable.
  • merge-risk: 🚨 message-delivery: Enabling the variable can change the visible verified sender identity used for outbound replies and drafts.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body describes built-binary dry runs, but no inspectable terminal output, recording, logs, or linked artifact shows the after-fix result; add redacted evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current implementation boundary: Current main has the addressed-alias option and passes it into reply sender selection, but its option field has no environment binding; the requested environment default is therefore not already implemented. (internal/cmd/gmail_reply_commands.go:33, 8b33065cbf3d)
  • PR scope and regression coverage: The supplied three-file PR diff adds the same environment tag to the shared reply options and both draft option structs, plus a four-command dry-run parsing test. (internal/cmd/gmail_auto_from_env_test.go:9, b2068d8cd2ba)
  • Merged feature provenance: The underlying opt-in addressed-alias behavior was introduced by the merged Gmail feature commit, whose message documents explicit --from precedence, fallback behavior, and reply/draft coverage. (internal/cmd/gmail_reply_commands.go:33, 88eb36191a1c)
  • Release provenance: The original addressed-alias feature commit is contained in release v0.34.2; the new environment-default change is only on this PR branch. (88eb36191a1c)
  • Proof gap: The PR body describes source-blind dry runs but provides neither pasted redacted output nor a linked artifact that can demonstrate the claimed after-fix behavior.

Likely related people:

  • ronny-rentner: The merged feature history identifies this contributor as the author of the existing option and its sender-precedence behavior. (role: introduced the existing addressed-alias behavior; confidence: high; commits: 88eb36191a1c; files: internal/cmd/gmail_reply_commands.go, internal/cmd/gmail_drafts.go)
  • steipete: Recent main history includes Gmail draft behavior work adjacent to the draft command paths changed here. (role: recent Gmail draft-area contributor; confidence: medium; commits: 72aa5b28aff8; files: internal/cmd/gmail_drafts.go)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted built-binary terminal output for enabled, unset, and explicit---from dry runs.
  • When possible, add a provider-backed run using a verified non-primary send-as alias; redact account details.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (21 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-08T13:04:23.325Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Remove the unsupported Gmail forward claim
  • reviewed 2026-08-08T14:56:08.489Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Remove the unsupported Gmail forward claim
  • reviewed 2026-08-08T16:04:42.638Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Narrow the advertised Gmail command scope
  • reviewed 2026-08-08T17:22:12.014Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Correct the advertised Gmail command scope
  • reviewed 2026-08-08T18:41:06.509Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Remove the unsupported Gmail forward claim
  • reviewed 2026-08-08T20:14:38.926Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Narrow the advertised Gmail command scope
  • reviewed 2026-08-08T21:29:15.772Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Remove the unsupported Gmail forward claim
  • reviewed 2026-08-08T23:21:09.193Z sha 41272d5 :: needs real behavior proof before merge. :: [P2] Correct the advertised Gmail command scope

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 Merging this PR could drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed merge-risk: 🚨 message-delivery 🚨 Merging this PR could drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 9, 2026
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Current-head signed-binary proof (b2068d8cd2baf361c6179968061fda120e6c0971), with no account or message data involved:

env_on_plans=4/4:true
env_unset_plans=4/4:false
explicit_from_preserved_with_env=true
google_api_calls=0; messages_sent=0
provider_alias_proof=blocked:no-verified-non-primary-alias; existing-flag-path-unchanged
behavior-validator: clauses 1-4 PASS; env-on/env-off and explicit-input probes PASS

Commands exercised the real built CLI with JSON --dry-run for gmail reply, gmail reply-all, gmail drafts create, and gmail drafts update, parsing each request object rather than trusting exit status. Focused service tests cover the unchanged addressed-alias selection, default fallback, and explicit-sender precedence paths.

Full local make ci and final Codex autoreview are clean. GitHub CI run 31293103238 and Docker run 31293103228 are green.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit d06fe6d into openclaw:main Aug 9, 2026
10 checks passed
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Landed in d06fe6dc07202ac297f3b66bc01d182eb556e5c5; maintainer changelog follow-up is e32b1f73a.

The permanent scope is the four existing option owners only: reply, reply-all, draft create, and draft update. The PR body was corrected to remove the unsupported forward claim, and a four-command env-default regression test was added.

Verification:

  • GOCACHE=<lane-private-cache> make ci — passed the complete local gate.
  • Signed current-head binary JSON dry runs: env enabled produced auto_from_addressed_alias: true on all four commands; env unset produced false; explicit --from remained present with the env option enabled; zero API calls and zero sends.
  • Provider-level alias selection could not be repeated because no healthy authenticated local account exposes a verified non-primary alias; that selection path is unchanged from the already-shipped explicit flag and remains covered by focused service tests.
  • Final Codex autoreview: clean, no accepted/actionable findings.
  • GitHub CI run 31293103238 and Docker run 31293103228 passed every job.

Thanks @ronny-rentner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 message-delivery 🚨 Merging this PR could drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants