Skip to content

fix(gmail): inspect pushes matching stored history - #1140

Merged
steipete merged 1 commit into
openclaw:mainfrom
kazuyuki-eguchi:fix/gmail-watch-equal-history-push
Sep 22, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
kazuyuki-eguchi:fix/gmail-watch-equal-history-push

Conversation

@kazuyuki-eguchi

@kazuyuki-eguchi kazuyuki-eguchi commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

A Gmail notification whose history ID equaled the saved watch cursor was dropped before Gmail history could be inspected. Allow equality to trigger the history lookup, while retaining the older-ID and duplicate-message protections.

The regression follows one equal-history delivery through lookup from cursor 200, a pending message at history 201, hook delivery, and the persisted cursor/delivery result. It fails on the old selector. The watch guide documents the boundary, and a test-only CLI forwarding helper is removed with its ordering coverage moved to the state package.

Thanks @kazuyuki-eguchi for the fix and correlated delivery evidence. Independent validation uses synthetic history and hooks, without live mailbox changes.

The focused cursor/processor regressions and full make ci pass on AWS Crabbox. Independent Codex review of the staged candidate found no actionable P0–P2 findings.

@clawsweeper

clawsweeper Bot commented Sep 19, 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.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 2:27 AM ET / 06:27 UTC (Revision 5).

ClawSweeper review

What this changes

Allow Gmail notifications matching the saved history cursor to trigger a history lookup, add delivery regression coverage and documentation, and remove an unused CLI adapter.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main and v0.40.0. No blocking defects were found, and the previously accepted runtime proof still covers the unchanged production implementation.

Priority: P2
Reviewed head: dd740fa7bb03109b6cf31957b38b7bb4ad84cd86

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with applicable runtime evidence, meaningful regression coverage, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The previously accepted watch-server trace connects an equal-cursor notification to six real Gmail messages and successful HTTP-hook delivery. The selector and processor are byte-identical to that reviewed revision, so the proof remains applicable; this review did not rerun it. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The previously accepted watch-server trace connects an equal-cursor notification to six real Gmail messages and successful HTTP-hook delivery. The selector and processor are byte-identical to that reviewed revision, so the proof remains applicable; this review did not rerun it. No stored-data contract changes.
Evidence reviewed 9 items Current main still skips equal cursors: The strict pushID > storedID comparison leaves startID zero for equality. Processor.Handle returns before contacting Gmail when startID is zero.
Latest release retains the defect: The supplied latest release, v0.40.0, also uses the strict greater-than comparison.
Introduced patch is narrowly scoped: The pinned introduction changes the selector to >=, removes a test-only forwarding helper, moves its tests, and adds focused coverage, watch documentation, and the required Unreleased entry with contributor credit.
Findings None None.
Security None None.

How this fits together

The Gmail watcher receives Pub/Sub notifications, reads mailbox changes from a saved history cursor, and forwards messages to a configured webhook. Push and pull delivery share the cursor selector and processing logic.

flowchart LR
  A[Pub/Sub notification] --> B[Authentication and account checks]
  B --> C[Select history cursor]
  D[Saved watch state] --> C
  C --> E[Gmail history and messages]
  E --> F[Configured webhook]
  E --> D
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

None.

Technical review

Best possible solution:

Use the existing history-processing path for equal cursors while preserving older-notification filtering, duplicate suppression, and delivery recovery.

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

Yes, from source: an equal history ID with a new Pub/Sub message ID exits before Gmail history lookup on current main. This review did not execute a failing main build.

Is this the best way to solve the issue?

Yes. Changing the existing comparison is a focused repair, supported by delivery regression coverage and historical real-Gmail proof for the same production implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This bounded Gmail watcher repair prevents pending history from being skipped when a notification matches the saved cursor.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The previously accepted watch-server trace connects an equal-cursor notification to six real Gmail messages and successful HTTP-hook delivery. The selector and processor are byte-identical to that reviewed revision, so the proof remains applicable; this review did not rerun it. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The previously accepted watch-server trace connects an equal-cursor notification to six real Gmail messages and successful HTTP-hook delivery. The selector and processor are byte-identical to that reviewed revision, so the proof remains applicable; this review did not rerun it. No stored-data contract changes.

Evidence

What I checked:

  • Current main still skips equal cursors: The strict pushID > storedID comparison leaves startID zero for equality. Processor.Handle returns before contacting Gmail when startID is zero. (internal/gmailwatch/repository.go:246, baac9cf45f3c)
  • Latest release retains the defect: The supplied latest release, v0.40.0, also uses the strict greater-than comparison. (internal/gmailwatch/repository.go:246, a3065f53c38f)
  • Introduced patch is narrowly scoped: The pinned introduction changes the selector to >=, removes a test-only forwarding helper, moves its tests, and adds focused coverage, watch documentation, and the required Unreleased entry with contributor credit. (internal/gmailwatch/repository.go:246, dd740fa7bb03)
  • Delivery and suppression coverage: The new processor regression follows an equal notification from cursor 200 through lookup, message delivery, cursor 201, and delivery recording. Existing tests retain duplicate-message and lower-history suppression. Tests were inspected, not executed; the supplied PR body reports focused regressions and make ci passing on AWS Crabbox. (internal/gmailwatch/processor_test.go:383, dd740fa7bb03)
  • Previously accepted real delivery evidence: The completed review at fix(gmail): inspect pushes matching stored history #1140 (comment) records a patched watch-server run with saved and incoming cursor 3208209, six messages returned by the real Gmail API at cursor 3208903, and those messages received by a local HTTP hook with response 200. This is retained historical evidence associated with reviewed head f170f60 and captured source revision 89227957f53a320bc88fda81a731c3bb8e41d0441697eee82af51b9d50a7b18f, not a newly executed run. The current body summarizes that evidence rather than retaining its full original transcript. (f170f60f7126)
  • Runtime proof continuity: REST retrieval of the earlier reviewed source confirmed repository.go and processor.go are byte-identical to the current checkout. Their SHA-256 hashes are d7f3cfcbbdf0f5ec22b6a995bdd4136dead4747efebf8851e98b2a248aedfbca and 11dd2e7f5d74702ba2f673607d4972de00f28893705bad521a324d4ce80997e7 respectively. The accepted proof therefore still exercises the changed production behavior; no prior finding remains outstanding. (internal/gmailwatch/repository.go:246, dd740fa7bb03)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-19T23:54:13.700Z sha 3b12352 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-20T00:01:25.782Z sha 3b12352 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-20T00:57:20.632Z sha f170f60 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-20T01:06:40.503Z sha f170f60 :: needs maintainer review before merge. :: none

@kazuyuki-eguchi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 19, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@kazuyuki-eguchi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@kazuyuki-eguchi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 20, 2026
Check Gmail history when a notification matches the saved cursor, retaining
older-ID and duplicate-message handling. Remove the unused CLI state
adapter and keep its ordering tests with the state owner.

Co-authored-by: 江口 和幸 <201872039+kazuyuki-eguchi@users.noreply.github.com>
@steipete
steipete force-pushed the fix/gmail-watch-equal-history-push branch from f170f60 to dd740fa Compare September 22, 2026 06:23
@steipete
steipete merged commit 0ebd74d into openclaw:main Sep 22, 2026
8 of 9 checks passed
@steipete

Copy link
Copy Markdown
Collaborator

Landed as 0ebd74d. Both equal-cursor regressions failed before the fix; the processor test now verifies lookup from cursor 200, message delivery at history 201, and persisted delivery/cursor state. Full make ci passed on AWS Crabbox, staged review was clean through P2, and all CI passed on dd740fa7bb03109b6cf31957b38b7bb4ad84cd86 after approving the fork runs. This validation used synthetic history/hooks. Thanks @kazuyuki-eguchi!

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

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants