fix(gateway): log chat-abort terminal persistence failures instead of swallowing#97852
fix(gateway): log chat-abort terminal persistence failures instead of swallowing#97852guocn wants to merge 1 commit into
Conversation
… swallowing The terminal session-store persistence promise in registerChatAbortController's cleanup path caught rejections with an empty handler, silently dropping both the error and any operator signal while still deleting the abort controller. In production, terminal states could fail to persist with zero trace in logs or telemetry, while the swallowed error masked database / file-system health issues. Surfaces the failure via the gateway/chat-abort subsystem logger (error level), including the run id and the underlying error, and preserves the existing controller cleanup so idempotent retry cleanup is not blocked. Fixes #97795
|
Codex review: needs real behavior proof before merge. Reviewed June 29, 2026, 11:44 AM ET / 15:44 UTC. Summary PR surface: Source +11, Tests +58. Total +69 across 2 files. Reproducibility: yes. Source inspection shows a rejected Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Log the rejected terminal lifecycle persistence once at the Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows a rejected Is this the best way to solve the issue? No. The branch is a plausible partial mitigation, but the maintainable fix is to log once where Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1052652a7168. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +11, Tests +58. Total +69 across 2 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Closing in favor of the overlapping owner-boundary candidates for #97795 (#97839 / #97813). ClawSweeper flagged that landing cleanup-consumer logging alongside an owner-boundary fix would double-report the same failed persistence write, so I'll defer to a single canonical fix rather than compete here. Thanks for the review. |
Summary
Fixes #97795.
When a chat run's terminal session-store persistence failed,
registerChatAbortController's cleanup path caught the rejection with an empty handler — silently dropping the error and any operator signal while still deleting the abort controller.In production this meant terminal states could fail to persist (DB / file-system issues) with zero trace in logs or telemetry, and the swallowed error masked infrastructure health problems.
Root cause
src/gateway/chat-abort.ts, in the cleanup closure ofregisterChatAbortController:The rejection handler swallowed the error entirely. The controller cleanup (correctly) remained, but there was no way for an operator to learn that persistence had failed.
Fix
Surface the failure through the project's standard subsystem logger (
gateway/chat-abort), at error level, including the run id and underlying error — while preserving the existing controller cleanup so idempotent retry cleanup is not blocked:Note: the issue suggested
log.error?.(...), butSubsystemLogger.erroris a required (non-optional) method persrc/logging/subsystem.ts, so this uses the plainlog.error(...)call matching the existingchannel-health-monitor.tsconvention.Test
Added a regression test in
chat-abort.test.tsalongside the existing success-path test. It asserts that, on terminal-persistence rejection:The subsystem logger is mocked (
createSubsystemLogger) following the existing pattern ingateway-processes.test.ts.Verification
vitest run src/gateway/chat-abort.test.ts→ 96/96 passing (3 projects × 32 tests, including the new case)oxlinton changed files → 0 warnings, 0 errorsoxfmt --checkon changed files → format OKvitest --typecheckon the target file → OK