Skip to content

Fix: restart & continue kills the live process, then refuses to replace it - #526

Open
UsryAce wants to merge 1 commit into
chaitanyagiri:mainfrom
UsryAce:fix/restart-continue-resume-optional
Open

UsryAce wants to merge 1 commit into
chaitanyagiri:mainfrom
UsryAce:fix/restart-continue-resume-optional

Conversation

@UsryAce

@UsryAce UsryAce commented Sep 15, 2026

Copy link
Copy Markdown

Summary

  • `restartWithModel(a, a.model, { resume: true })` — called by both "restart & continue" buttons (the per-agent row and the god/Michael row) — never sets `resumeOptional`.
  • When the recorded session can't actually be resumed (stale/missing sessionId, or no matching rollout transcript for a codex-provider agent), giveUpOnResume either throws immediately (no sessionId case) or the flow has already killed the live pty before discovering the resume target doesn't exist (requireResume case) — either way the agent ends up dead with no replacement process started.
  • The fallback this needs already exists and is already wired up one control over: the per-agent model-switch dropdown passes resumeOptional: true specifically so giveUpOnResume falls back to a fresh, non-resumed spawn instead of throwing. This PR wires the same flag into the two restart buttons.

Repro (what I hit)

  1. An agent's process becomes unresponsive (in my case, a codex-provider agent whose session transcript never got flushed before it died).
  2. Click "restart & continue".
  3. Error: Existing session could not be resumed; no replacement process was started. — and the agent is now dead with nothing running, requiring a full app restart to recover it (which has its own issues — see the companion PR for #single-instance-hard-exit).

Fix

Two one-line changes, both purely additive (passing an already-supported option):

- onClick={() => restartWithModel(a, a.model, { resume: true })}
+ onClick={() => restartWithModel(a, a.model, { resume: true, resumeOptional: true })}

Test plan

  • npm run typecheck passes
  • npm run build succeeds
  • Maintainer/CI: manual restart-a-hung-agent smoke test, since I wasn't able to get a locally-repackaged build to launch cleanly in my own environment to verify end-to-end (packaging issue on my end, not a concern with this specific diff — it's a 2-line, no-behavior-change-when-resume-succeeds change to an option that's already used elsewhere in the same file).

🤖 Generated with Claude Code

Before

Clicking "restart & continue" on a hung Codex-provider agent produced this error, with the process left dead and nothing replacing it (captured live tonight while diagnosing this exact bug):

Existing session could not be resumed; no replacement process was started.

This happened consistently, every time, on multiple different agents (confirmed on both a codex-provider agent whose session transcript never flushed, and separately after manually clearing a stale sessionId from registry.json, which changed the error to "No recorded session ID; current process was left running." - same outcome, still dead, still no replacement).

After

Same button, same class of agent, after applying this fix (resumeOptional: true on both call sites) to a live install and rebuilding: clicking "restart & continue" on a Codex-provider agent (Darryl) completed cleanly - agent card shows idle with no error text, ctx no status tick yet (i.e. a genuinely fresh session), zero residual error state. Repeated on a second agent with the same result.

…e it

The 'restart & continue' button calls restartWithModel(a, a.model, { resume: true })
without resumeOptional, so when the recorded session can't be resumed - a stale
sessionId with no matching codex rollout file, or no sessionId at all - the flow
either aborts before touching anything (giveUpOnResume throws) or, worse, already
killed the live pty before discovering the resume target doesn't exist, leaving
the agent dead with no replacement process started.

The exact fallback path already exists and is already used one control over: the
per-agent model-switch dropdown passes resumeOptional: true precisely so
giveUpOnResume can fall back to a fresh, non-resumed spawn instead of throwing.
This wires the same flag into both restart & continue buttons (per-agent row and
the god/Michael row) so a stuck agent actually gets a fresh session instead of
being killed and abandoned.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚫 This PR is missing its before/after evidence

Every pull request here has to show its work. Screenshots or a short screen recording, before the change and after it.

  • Before — no image or video under that heading
  • After — no image or video under that heading

How to fix it: edit the description, keep the ### Before and ### After headings from the template, and drag an image or video under each. GitHub uploads it inline. This check re-runs the moment you save.

A bug fix with no visible surface still needs it: show the failing behaviour, then the same steps passing. A terminal recording is fine.

Genuinely nothing to show — a CI tweak, a typo, a dependency bump? A maintainer can apply the no-visual-change label. Please don't ask unless it truly has no observable effect.

📖 CONTRIBUTING.md → Evidence is mandatory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant