Skip to content

feat(gmail): allow quoted create/update drafts with missing images - #1342

Open
pedro-pscunha wants to merge 2 commits into
openclaw:mainfrom
pedro-pscunha:quote-missing-inline-images
Open

pedro-pscunha wants to merge 2 commits into
openclaw:mainfrom
pedro-pscunha:quote-missing-inline-images

Conversation

@pedro-pscunha

Copy link
Copy Markdown

What Problem This Solves

Some Outlook replies keep a quoted cid: image reference but omit its MIME part. gmail drafts create/update --quote then fails instead of saving the draft.

User Impact

Both commands now accept --missing-inline-images=placeholder with --quote. Missing images become visible text placeholders. The default remains error.

For example:

gog gmail drafts create --reply-to-message-id MESSAGE_ID --body "Reply" --quote --missing-inline-images=placeholder
gog gmail drafts update DRAFT_ID --reply-to-message-id MESSAGE_ID --body "Reply" --quote --missing-inline-images=placeholder

Why This Change Was Made

drafts reply and reply-all already support this option. This change reuses their MIME checks, placeholders, and degradation warnings for create/update. Valid inline resources stay intact. Placeholder mode requires --quote and cannot accompany --raw-file.

The draft result reports degraded: true and image warnings. The stderr warning asks for review before sending.

Evidence

The command package tests pass with a clean environment:

env -u GOG_ACCOUNT -u GOG_HOME -u GOG_KEYRING_PASSWORD go test ./internal/cmd/...

The new fixture tests cover create/update placeholders, the strict default, dry-run output, and invalid non-quote/raw usage. The new tests reject the unmodified v0.48.1 commands because they lack the flag.

These checks use local HTTP fixtures, not a live Google account. I did not run the whole-repository suite.

🤖 Generated with Claude Code

…update

Extend the existing draft-only placeholder policy to create and update with --quote.
Keep the default strict, preserve valid inline resources, and report degradation for review.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

Add the PR reference and contributor credit to the Unreleased entry.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Extends the existing missing-image placeholder option to quoted Gmail draft creation and updates.

Example: Quote a message containing <img src="cid:missing@example.com"> without a matching MIME part.

  • Before: Draft create/update rejects the quote and does not accept --missing-inline-images=placeholder.
  • After: With --quote --missing-inline-images=placeholder, the draft contains visible replacement text and returns degradation warnings.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and has no confirmed code defect, but required real-behavior evidence is absent and the command extension awaits owner direction.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Users cannot save or update a quoted draft through create/update when the source omits a referenced inline image.
Reason: Updating an existing draft is distinct from the available draft-reply creation workflow, but expanding the flag surface needs owner direction.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it adds distinct create/update support absent from main, and source review found no definite correctness regression.

Priority: P3
Reviewed head: bc0f6b3f466980ea952a23d7f7b17b73f32c5497
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the existing missing-image placeholder flag also be exposed on drafts create and drafts update?
  • Recommendation: Accept the command extension: Expose the existing policy on quoted create/update operations using the shared implementation and unchanged defaults.
  • Why: The earlier maintainer decision accepted the substitution contract for draft replies, but no human decision on this PR approves extending the public command surface.

Before merge

  • Add real behavior proof - The supplied tests exercise create/update through an in-process command runtime and HTTP fixtures, but no shipped CLI run against Gmail demonstrates this extension; provide terminal screenshots, logs, or live output with MIME readback, redacting credentials and private identifiers. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Provide real CLI create/update output and Gmail MIME readback showing missing-image placeholders, warnings, and preserved valid image bytes; the new tests reject the base command syntax but do not demonstrate a before/after run of the underlying scenario.
Agent review details

How this fits together

Gmail draft commands combine caller input with a source message through shared reply and MIME composition, save the result through Gmail, and return draft identifiers and warnings.

flowchart LR
  A[Draft create or update] --> B[Validate quote policy]
  B --> C[Fetch source message]
  C --> D[Shared quote and MIME composer]
  D --> E[Gmail draft API]
  E --> F[Draft result and warnings]
Loading

Technical review

Best possible solution:

Reuse the existing placeholder composer for both commands, retain strict defaults, and obtain owner acceptance of the additional flag locations.

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

Current source establishes the limitation: create/update cannot select placeholder composition and therefore retain intentional missing-CID rejection; no runtime reproduction was executed.

Is this the best way to solve the issue?

The implementation is focused: it threads the existing policy and warnings through the existing draft composer without introducing another MIME repair path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 351e62175513.

Provenance checked

  • Missing-image policy and documented command scope changes intended behavior with a stated reason (ee767a5: Provide deliberate, conservative substitution for human-reviewed drafts while keeping strict defaults and direct sends unchanged.)
  • Draft thread continuity and reply lineage keeps the original intent (4985e26: Separate thread continuity from reply ancestry so an updated draft does not reference its own unsent revision.)
  • Raw draft compose-flag exclusion keeps the original intent (33d0d01: Submit caller RFC822 bytes unchanged and reject conflicting compose inputs.)
  • Signature placement and draft attachment preservation keeps the original intent (cae4fdc: Place signatures above quoted content while retaining the existing MIME composition and attachment carry-forward paths.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current main lacks the requested command support: The base draft composer passes an empty missing-image policy to fetchReplyInfo; the documented placeholder flag is limited to draft reply and reply-all. (internal/cmd/gmail_drafts.go:421, 351e62175513)
  • Introduced implementation reuses existing owners: The pinned diff passes the validated policy into fetchReplyInfo and forwards existing inline-image warnings through writeDraftResult for both commands. (internal/cmd/gmail_drafts.go:422, bc0f6b3f4669)
  • Earlier maintainer acceptance: In feat(gmail): add draft-only missing image placeholders #1163, steipete explicitly accepted draft-only opt-in substitution, strict defaults, visible placeholders, and creation-time warnings; this resolves those policy tradeoffs, while the additional create/update flag locations remain unapproved. (internal/cmd/gmail_inline_missing.go:28, ee767a5c666b)
  • Supplied proof is fixture-only: The complete PR body expressly reports local HTTP fixtures rather than a live Google account; the discussion contains only bot status comments and no changed-path runtime artifact. Captured primary-body sourceRevision: b65983d8c791e1b14e4763382efafbc21ad502d82007d5e74a933cda6c82a7f5. (internal/cmd/gmail_inline_missing_command_test.go:226, bc0f6b3f4669)
  • Feature history and inspection limit: Path history identifies the shared draft composer, quote support, attachment preservation, threading repair, and placeholder implementation; some historical blob-dependent searches stopped because lazy fetching is disabled, so introduction claims rely on verified source and GitHub commit records. (internal/cmd/gmail_drafts.go:319, 351e62175513)

Likely related people:

  • Peter Steinberger: Raw commit ee767a5 adds internal/cmd/gmail_inline_missing.go:28 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ee767a5c666b; files: internal/cmd/gmail_inline_missing.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: This is an optional command capability for advanced draft workflows, with existing strict behavior preserved.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P3: This is an optional command capability for advanced draft workflows, with existing strict behavior preserved.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Supply a redacted real CLI create/update trace with Gmail MIME readback.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 19, 2026, 7:18 PM ET / November 20, 2026, 00:18 UTC.

This branch has not been deployed

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

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant