fix(agent): treat run_terminal mirror stop as cancellation in durable run event sink - #4326
Conversation
… run event sink (issue-inbox#872) A mirror disabled with reason run_terminal means the API already declared the run finished server-side, so the sink now refuses the model dispatch with a DOMException AbortError, the runtime's recognized abort shape, instead of raising DurableRunEventPersistenceError. Every other disable reason still fails closed with the persistence error.
|
Warning Review limit reachedNext included review available in 29 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 ✅ ApprovedFixes the durable run event sink to treat OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2fddccff9
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |



When the durable run event mirror is disabled with reason
run_terminal(the API declared the run terminal, e.g. a project delete cancelled in-flight runs — a clean stop per veryfront-issue-inbox#743, already treated as such byrun-chunk-mirror.tsandhosted-chat-finalization.ts),assertEnabled()insrc/agent/hosted/durable-run-event-sink.tsstill escalated it toDurableRunEventPersistenceError: Required durable run event mirror is disabled: run_terminal, paging Sentry (VERYFRONT-AGENT-7). The fix special-casesrun_terminalinassertEnabled()to reject withDOMException("Durable run event mirror stopped: the run is already terminal", "AbortError")— the runtime's recognized cancellation shape — while every other disable reason (auth_rejected,payload_too_large, ...) keeps failing hard, and the fail-closed contract is preserved: the sink still rejects, so the model call is never dispatched for a terminal run. Because both discovery points (the entry check before append, and the post-append flush) funnel throughassertEnabled(), one guard covers both.Note: the Sentry culprit
veryfront.esm.src.agent.hosted:durable-run-event-sinkis framework code that veryfront-agent consumes via the prebuiltveryfrontnpm package, so the fix lands here in veryfront-code rather than veryfront-agent; veryfront-agent will need averyfrontdependency bump after this ships before the Sentry group goes quiet.Fixes veryfront/veryfront-issue-inbox#872
Red
Before the fix:
The raised error in both cases is
DurableRunEventPersistenceError "Required durable run event mirror is disabled: run_terminal"— the exact Sentry VERYFRONT-AGENT-7 signature.Green
Affected suites:
Revert check
With the fix commit reverted (
git revert --no-commit a2fddccf, onlysrc/agent/hosted/durable-run-event-sink.tsmodified), the regression tests fail again with the original signature:Restored to the fix (
git reset --hard a2fddccf), the suite passes again:Acceptance criteria
DurableRunEventPersistenceError "Required durable run event mirror is disabled: run_terminal"fromassertEnabled) using synthetic mirror fixtures only.run_terminalmirror stop refuses the model dispatch as a clean cancellation (DOMExceptionnamedAbortError), notDurableRunEventPersistenceError.auth_rejected,payload_too_large, ...) keeps failing hard withDurableRunEventPersistenceError; the existing "reports the concrete disable reason" test stays green.deno fmt/lint/checkclean on the changed files).