fix(agent): escalate mirror flush retry log to error once per failure streak - #4330
Conversation
… threshold (issue-inbox#821)
… streak The retry-scheduled log compared consecutiveFailures against the threshold with >=, so every attempt at or past the fifth logged at error level. With retry backoff capped at ~5s, one persistent append outage emitted a Sentry error every few seconds per active run (VERYFRONT-AGENT-3). Compare with strict equality instead: the streak counter increments by one per scheduled retry and resets to zero on a successful flush, so the escalation fires exactly once per failure streak and re-arms after recovery. Attempts 1-4 and 6+ of a streak stay at warn; terminal stop/disable paths still report at error level.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe hosted chunk mirror now logs one error when retries reach the failure threshold. Later retries remain warnings. A successful flush resets escalation. Tests cover re-escalation during a later failure streak. ChangesHosted mirror retry escalation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change limits repeated error reporting during persistent mirror outages while preserving retry, recovery, and terminal-failure behavior. No actionable merge-blocking risk remains after the reported checks pass. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
|
Note Automatic reviews are paused because your trial's included automatic processing has been used for this period. Upgrade now, or comment "Gitar review" to run a review anytime. Code Review ✅ ApprovedChanges the mirror flush retry log escalation from OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
Reviewer: Codex Findings, ordered by severity
Score breakdown: correctness/completeness 40/40, regression tests/verification 19/20, reliability/security 15/15, repository standards/maintainability 15/15, scope/docs/rollout clarity 9/10. Score: 98/100. Verification and current PR state
Verdict: APPROVE for the code change. Merge readiness remains blocked by the draft state and pending Review-Gate: |
|
Reviewer: Claude Findings, ordered by severity
Verification and gaps
Score breakdown: correctness/completeness 38/40, regression tests/verification 17/20, reliability/security 14/15, repository standards/maintainability 13/15, scope/docs/rollout clarity 8/10. Score: 90/100. Verdict: APPROVE. Review-Gate: |
There was a problem hiding this comment.
kwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |



The hosted chunk mirror's retry-scheduled log ("Durable run mirror flush failed; queued for retry") escalated to error level with a
>=comparison againstHOSTED_CHUNK_MIRROR_RETRY_ERROR_THRESHOLD, so during a persistent outage every retry at/after the 5th attempt logged at error. Sincerun-mirror.tsretries indefinitely with backoff capped at 5s, one outage produced a captured Sentry error roughly every 5 seconds per active run (the unresolved VERYFRONT-AGENT-3 group). This change switches the escalation to strict equality (=== HOSTED_CHUNK_MIRROR_RETRY_ERROR_THRESHOLD):consecutiveFailuresincrements by exactly 1 per scheduled retry and resets to 0 on a successful flush (src/agent/conversation/durable.ts), so the error fires exactly once per failure streak and re-arms after recovery. Later attempts in the same streak stay at warn, and terminal stop/disable paths (auth_rejected, payload_too_large, cursor_resyncs_exhausted) keep reporting at error level. One error per persistent-outage streak remains expected signal for the Sentry group, not suppressed. Note: veryfront-agent consumes this code via the veryfront npm package and needs a dependency bump after release before VERYFRONT-AGENT-3 goes quiet.Fixes veryfront/veryfront-issue-inbox#821
Red
Green
Suite results:
deno task test:file src/agent/conversation: ok | 21 passed (247 steps) | 0 failed (2s)deno task test:file src/agent/hosted: ok | 498 passed (417 steps) | 0 failed (11s)deno fmt --check/deno lint/deno checkonsrc/agent/conversation/run-chunk-mirror.ts: all cleanRevert check
Recorded HEAD 3a22b25.
git revert --no-commit 3a22b254c(clean revert, onlysrc/agent/conversation/run-chunk-mirror.tsmodified) ->deno task test:file src/agent/conversation/run-chunk-mirror.test.tsFAILED: "escalates a persistent retry streak to error once, not on every attempt ... FAILED" with the AssertionError at run-chunk-mirror.test.ts:690 (attempts 6-8 logged at error instead of warn) — "FAILED | 0 passed (14 steps) | 1 failed (1 step)". Restored withgit reset --hard 3a22b254c-> same command PASSED — "ok | 1 passed (15 steps) | 0 failed (13ms)".Acceptance criteria
consecutiveFailuresfirst reaches the threshold (5); attempts 6+ in the same streak stay at warn.deno task test:file src/agent/conversation/run-chunk-mirror.test.tspass after the fix.The issue is filed in veryfront-issue-inbox against veryfront-agent's Sentry group, but the culprit code lives here: veryfront-agent consumes
recordHostedChunkMirrorRetryScheduledfrom this repo via the veryfront npm package. No overlap with open PR #4326, which touches onlysrc/agent/hosted/durable-run-event-sink.{ts,test.ts}; the two are compatible in either merge order.Summary by CodeRabbit
Bug Fixes
Tests