fix: log failed terminal session persistence#97884
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this PR applies a plausible owner-boundary logging fix, but the same central gateway persistence diagnostic is already covered by the open, mergeable, proof-positive canonical PR. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch and review or land #97839 as the canonical formatted owner-boundary fix for #97795. So I’m closing this here and keeping the remaining discussion on #97839 and #97795. Review detailsBest possible solution: Close this branch and review or land #97839 as the canonical formatted owner-boundary fix for #97795. Do we have a high-confidence way to reproduce the issue? Yes from source. Current main catches rejected terminal lifecycle persistence only to broadcast fallback Is this the best way to solve the issue? No. This branch is a reasonable implementation, but the best landing path is the already-open proof-positive canonical sibling that covers the same owner-boundary fix. Security review: Security review cleared: The diff adds no dependency, workflow, lockfile, package, or code-execution surface, and formats arbitrary rejection content through the existing gateway formatter before logging. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 6de357ad4772. |
Closes #97795
What Problem This Solves
Fixes an issue where operators would lose visibility into terminal session persistence failures when an agent run finished and the session-store write rejected. The gateway still broadcast a terminal fallback projection, but the underlying write error was swallowed, making storage or filesystem problems much harder to diagnose.
Why This Change Was Made
The fix keeps the existing cleanup, restart-recovery, and fallback broadcast behavior intact, but threads the gateway logger into the agent-event handler and records the rejected terminal persistence promise once at the persistence owner boundary.
User Impact
Operators now get a gateway error log with run, client run, session key, and sanitized error context when terminal session persistence fails. Users keep the same terminal fallback behavior instead of seeing stalled session state.
Evidence
node scripts/run-vitest.mjs src/gateway/server-chat.agent-events.test.ts src/gateway/chat-abort.test.ts -- --reporter=dot— 322 passednode scripts/run-vitest.mjs src/gateway/server-chat.agent-events.test.ts -- --reporter=dot— 198 passed after final trimpnpm exec oxfmt --check src/gateway/server-chat.ts src/gateway/server-runtime-subscriptions.ts src/gateway/server.impl.ts src/gateway/server-chat.agent-events.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --codex-bin .artifacts/codex-flex --no-web-search— clean, patch correct 0.88