Repository navigation
Closed
Closed
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity
Description
After a session ends with status: failed (e.g. from provider 400 or timeout), it remains bound as the active agent:main:main. The next TUI launch attempts to rehydrate the failed session and crashes. Expected: a failed session should not remain bound; the runtime should rotate to a new session on failure. Observed 2026-05-02 and 2026-05-03.
Related issues (same quota-hit incident):
- HTTP 400 quota/usage_limit errors do not trigger provider fallback chain #89165 — HTTP 400 quota/usage_limit errors do not trigger provider fallback chain
- HTTP 400 from model provider not surfaced to chat UI; session silently waits for idleTimedOut #89166 — HTTP 400 from model provider not surfaced to chat UI; session silently waits for idleTimedOut
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Jun 1, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 5:10 AM ET / 09:10 UTC.
Summary
Keep open: current main and the latest release still preserve a failed main session when its transcript exists, and the TUI history path still rehydrates the selected session without a failed-session guard. The overlapping recovery PR is open but unmerged and appears only partially aligned with this issue because it clears terminal state in place while this issue asks for rotation or unbinding.
Reproducibility: no. not for the exact TUI crash. Source and tests show that current main can keep a failed main session reusable when its transcript exists, and the TUI history path does not filter that failed entry.
Ways to help us reproduce this
Next step
Do not queue a new automated fix while this issue has no-new-fix-pr/product-decision routing and #89045 is the active overlapping recovery candidate.
Review details
Best possible solution:
Choose one shared terminal-session recovery policy for main/TUI and channel sessions, coordinate it with #89045, and add focused TUI/session regression proof for the chosen behavior.
Do we have a high-confidence way to reproduce the issue?
No, not for the exact TUI crash. Source and tests show that current main can keep a failed main session reusable when its transcript exists, and the TUI history path does not filter that failed entry.
Is this the best way to solve the issue?
Unclear. The open recovery PR fixes related terminal-session behavior by clearing failed state in place, but maintainers still need to decide whether this TUI case should rotate, unbind, or preserve transcript continuity.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against e9b694ef9cd8.
Label changes
Label justifications:
P1: The report describes a failed persisted main session breaking the next TUI launch, which is an urgent user-facing session workflow failure if confirmed end to end.impact:session-state: The issue is about failed lifecycle state and session identity remaining bound to the main session key.impact:crash-loop: The reported user-visible outcome is a crash on the next TUI launch after the failed session remains selected.Evidence reviewed
What I checked:
AGENTS.md:1, e9b694ef9cd8)canReuseSessionfrom session id, freshness, missing transcript, and terminal transcript freshness; it does not rejectstatus: "failed"when the transcript exists. (src/gateway/server-methods/agent.ts:1906, e9b694ef9cd8)status: "failed". (src/gateway/server-methods/agent.test.ts:1078, e9b694ef9cd8)entry.sessionId, and reads messages for that session without checking for failed lifecycle status in this history path. (src/tui/embedded-backend.ts:429, e9b694ef9cd8)running; rows already infailedstatus are skipped by this recovery pass. (src/agents/main-session-restart-recovery.ts:338, e9b694ef9cd8)src/gateway/server-methods/agent.test.ts:1078, c645ec4555c0)Likely related people:
src/gateway/server-methods/agent.ts,src/auto-reply/reply/session.ts,src/tui/embedded-backend.ts)src/auto-reply/reply/session.ts,src/auto-reply/reply/dispatch-from-config.ts,src/gateway/server-methods/agent.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.abhinas90 commentedon Jun 1, 2026
Good catch. This is a session-lifecycle binding issue — the runtime treats a failed session as still owning
agent:main:main, so the TUI tries to rehydrate a dead session and crashes.This has broader implications for unattended deployments. When a session fails (400/timeout/crash), the session manager should either mark it
status: zombieand rotate, or auto-purge sessions that fail before the first assistant message.Recovery matrix:
Manual unbind (recovery, no restart needed):
Pre-launch guard (prevent recurrence):
Root cause prevention: Since HTTP 400 quota/usage_limit errors do not trigger provider fallback chain #89165 (no provider fallback on 400) and HTTP 400 from model provider not surfaced to chat UI; session silently waits for idleTimedOut #89166 (silent 400 in chat UI) are linked, fixing the fallback chain prevents the failed session from ever being created. The cascade is: quota/400 → no fallback → failed session → still bound → TUI crash.
This is the kind of cascading failure pattern that makes unattended deployments unreliable — one 400 error from the provider takes down your entire next session.
openclaw-barnacle commentedon Jul 6, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
steipete commentedon Jul 9, 2026
Closing as fixed by
1f36539ab04fbbbcdbd4fa743e903a010b35ecdf, now onmain. Terminal-session recovery clears the failed session fields before the next TUI launch.