fix(sessions): avoid stale restart continuation reuse#87378
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 27, 2026, 6:45 PM ET / 22:45 UTC. Summary PR surface: Source -2, Tests +256. Total +254 across 7 files. Reproducibility: yes. from source inspection: current main evaluates session freshness and queues restart continuations without terminal Review metrics: 1 noteworthy metric.
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: Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Repair the PR so terminal Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main evaluates session freshness and queues restart continuations without terminal Is this the best way to solve the issue? No: the current PR head is not the best fix because it asserts terminal rows are reusable and only guards restart continuations when the session id changes. The maintainable fix is a shared terminal lifecycle guard plus tests that expect fresh-session rotation and fallback wake behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 77fe36bb98ea. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source -2, Tests +256. Total +254 across 7 files. View PR surface stats
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
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
ad627c7 to
b5a8736
Compare
b5a8736 to
6689560
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
Verification for final head
Known proof gap: no live Telegram Desktop restart was run locally. The restart-sentinel routing/fallback behavior is covered by focused tests and the PR body includes copied real local |
Summary
status,endedAt,runtimeMs) out of session freshness decisions so ordinary follow-up turns continue the existing conversationagentTurndeliveries carry the session id they were queued for, then fall back to a system wake if the session key now points at a different sessionCloses #86593.
Validation
node scripts/run-vitest.mjs src/gateway/server-restart-sentinel.test.ts src/auto-reply/reply/session.test.ts src/agents/command/session-store.test.tsnode_modules/.bin/oxfmt --check src/config/sessions/types.ts src/agents/command/session.ts src/auto-reply/reply/session.ts src/infra/session-delivery-queue-storage.ts src/gateway/server-restart-sentinel.ts src/agents/command/session-store.test.ts src/auto-reply/reply/session.test.ts src/gateway/server-restart-sentinel.test.tsgit diff --check/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode branch --base origin/mainReal behavior proof
Behavior addressed: stale restart continuation delivery must not dispatch an
agentTurninto a session key after that key has rotated to a different session id. Completed run metadata alone must not force normal fresh sessions to rotate.Real environment tested: Real local OpenClaw checkout on branch
pr-87378, head SHA4521a0119da537b91d7402e8f07898785f3f7d9e, using a temporary JSON session store and the realresolveSessionimplementation.Exact steps or command run after this patch: Created a temporary
sessions.jsoncontaining a fresh row foragent:main:explicit:proof-completed-entrywithsessionId=proof-completed-session,status=done, numericstartedAt, numericendedAt, andruntimeMs. Then ranresolveSessionagainst that real store path and printed the resolved session state.Evidence after fix:
Observed result after fix: A fresh completed-run row continues with its existing session id (
reusedExistingSession=true) instead of rotating just becausestatus=doneandendedAtare present. The restart-sentinel fallback path is covered by the focused test suite and now keys queued agent turns byexpectedSessionId.What was not tested: No live Telegram Desktop restart was run locally. The focused restart-sentinel test exercises the routing and fallback behavior with preserved delivery context.
Attribution
If maintainers squash/rework this PR, please preserve author attribution or include:
Co-authored-by: Andy Ye <[email protected]>