Repository navigation
fix(sessions): preserve signal exit status in tail follow - #138581
Conversation
…27348) Return the terminating signal from follow cleanup and map it to the conventional CLI exit code after listeners and polling are released.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Returning the terminating signal from the follow lifecycle and translating it to CLI status at the command boundary is the right separation. Both listeners and the polling interval are removed before runtime.exit, so cleanup does not depend on process termination side effects. The paired SIGINT/SIGTERM regression pins the conventional 130/143 contract cleanly.
|
@clawsweeper re-review The prior exact-head review placeholder lease expired without publishing a durable verdict. Head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 4, 2026, 6:16 PM ET / 22:16 UTC. ClawSweeper reviewWhat this changesThe PR makes Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it fixes the linked current defect, and the exact-head terminal trace now satisfies the prior real-behavior-proof request. Current main and v2026.9.1 retain the cleanup-only signal path, so the work is not obsolete. Priority: P2 Review scores
Verification
How this fits togetherThe sessions-tail CLI reads trajectory events from the session store and polls for new events in follow mode. Signals or read failures end that polling lifecycle, then the command runtime reports an exit status to shells and supervisors. flowchart LR
A[SQLite trajectory store] --> B[Sessions tail command]
B --> C[Follow polling lifecycle]
D[Signal or read error] --> C
C --> E[Cleanup and terminal outcome]
E --> F[CLI exit status]
F --> G[Shell or supervisor]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +13. Total +21 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single lifecycle outcome and command-boundary status mapping so cleanup remains exact-once and shells receive the terminating signal status. Do we have a high-confidence way to reproduce the issue? Yes: the supplied pre-fix terminal trace shows exit 0 for both signals, and current main retains the same follow implementation; the exact-head trace shows the corrected statuses. Is this the best way to solve the issue? Yes: this is the best fix because the follow owner records and cleans up one terminal outcome while the command boundary owns CLI exit policy, matching sibling signal-handling patterns. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5772aa2c5ab9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Maintainer repair is now on head
|
|
@clawsweeper re-review Head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…38581) * fix(sessions): preserve signal exit status in tail follow (openclaw#127348) Return the terminating signal from follow cleanup and map it to the conventional CLI exit code after listeners and polling are released. * fix(sessions): unify tail follow outcomes --------- Co-authored-by: Vincent Koc <[email protected]>
Closes #127348
What Problem This Solves
openclaw sessions tail --followhandledSIGINTandSIGTERMby cleaning up its polling interval and returning normally. The real CLI therefore exited 0, so scripts and supervisors could not distinguish an operator interrupt or termination request from a successful completed tail.Why This Change Was Made
The follow owner now returns the exact signal after removing both listeners and clearing the polling interval. The command boundary maps that closed outcome to the conventional CLI statuses: 130 for
SIGINTand 143 forSIGTERM.This keeps cleanup in the follow lifecycle while keeping process-exit policy at the command boundary.
User Impact
Operators, shells, and supervisors now receive a truthful nonzero status when a followed session tail is interrupted or terminated. Normal non-following tails and existing error exits are unchanged.
Evidence
Current-main reproduction at
47dff2de27113271f91782f23a5ae5841eecce1a:{"requestedSignal":"SIGINT","sentAfterEvent":true,"exitCode":0,"exitSignal":null} {"requestedSignal":"SIGTERM","sentAfterEvent":true,"exitCode":0,"exitSignal":null}Exact-head proof at
16f6ad0c0f977626669ea22a27aca451a7ce8a92used the built CLI from a frozen isolated install, a real SQLite session/trajectory store, and real process actions only after the CLI renderedsession.started:{"head":"16f6ad0c0f977626669ea22a27aca451a7ce8a92","case":"signal","requestedSignal":"SIGINT","sentAfterEvent":true,"exitCode":130,"exitSignal":null} {"head":"16f6ad0c0f977626669ea22a27aca451a7ce8a92","case":"signal","requestedSignal":"SIGTERM","sentAfterEvent":true,"exitCode":143,"exitSignal":null} {"head":"16f6ad0c0f977626669ea22a27aca451a7ce8a92","case":"read-error","corruptedAfterEvent":true,"errorObserved":true,"exitCode":1,"exitSignal":null}Additional exact-head verification:
node scripts/run-vitest.mjs src/commands/sessions-tail.test.ts- 33 passed.pnpm build- passed.openclaw sessions tail --help- passed.Risk
SIGINTandSIGTERMhandlers in follow mode.Changelog
n/a - repository policy derives release notes from the PR user-impact and evidence sections.