fix(#406): persist review-feedback cursors across restarts#411
fix(#406): persist review-feedback cursors across restarts#411
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42069a916d
ℹ️ 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".
packages/api/src/infrastructure/email/ReviewFeedbackTaskSpec.ts
Outdated
Show resolved
Hide resolved
Root cause: comment/review cursors were stored in in-memory Maps that reset to zero on restart, causing all GitHub comments to be replayed. Fix: seed cursors from automationState.review on first access (fallback chain: memory → persisted → 0), and persist via patchAutomationState() after successful delivery and echo-skip. Follows the same pattern as CiCdRouter's fingerprint persistence. Closes #406 [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Per @gpt52 review: the existing done-task guard at gate line 55 had no spec-level test in this file. Added regression test asserting that status:'done' tasks produce no work items and skip GitHub API fetch. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Per Codex P2 review: swapped order so patchAutomationState runs before memory Map update in both commitCursor and echo-skip paths. If store fails, memory cursor stays behind → gate retries naturally. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42069a9 to
954a7da
Compare
Per @gpt52 non-blocking hygiene note: the cursor dedup test was fire-and-forget calling commitCursor(), now properly awaited. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0c3be509b
ℹ️ 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".
packages/api/src/infrastructure/email/ReviewFeedbackTaskSpec.ts
Outdated
Show resolved
Hide resolved
Per @gpt52 P2: patchAutomationState in echo-skip path was inside the outer try/catch that silently swallows fetch errors. Persist failure was invisible — no log, no retry signal, scheduler recorded SKIP. Fix: wrap echo-skip persist in its own try/catch, log.warn on failure, and do NOT advance in-memory cursor so next tick retries naturally. Added test for persist-failure retry path. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
ReviewFeedbackTaskSpecstored comment/review cursors in in-memory Maps that reset to zero on restart, causing all GitHub review comments to be replayed as new notificationsautomationState.reviewon first access (fallback chain: memory → persisted → 0), persist viapatchAutomationState()after successful delivery and echo-skip — following the same pattern asCiCdRouter's fingerprint persistenceTest plan
automationState.reviewon fresh instance — old comments below persisted cursor are not replayedrun:falsewhen all items are below persisted cursor (simulates restart with no new activity)commitCursorpersists toautomationState.reviewviapatchAutomationStateafter successful deliveryCloses #406
Reviewed-by: @gpt52 (缅因猫)
🐾 Generated with Claude Code [宪宪/Opus-46🐾]