Skip to content

fix(undo-close): a failed restore says why (#1242) - #1264

Merged
Juliusolsson05 merged 11 commits into
mainfrom
fix/undo-close-respawn-failure
Sep 25, 2026
Merged

Juliusolsson05 merged 11 commits into
mainfrom
fix/undo-close-respawn-failure

Conversation

@Juliusolsson05

@Juliusolsson05 Juliusolsson05 commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #1242.

Verified failure

respawn swallowed spawn errors (catch { return null }). The entry went back on the stack with no message, so after a provider CLI broke, every Cmd+Shift+T silently did nothing. A partially restored group was silent about the rest too. Plan: docs/plans/2026-09-25-undo-close-respawn-failure.md (plan-only commit first).

Fix

The failure is toasted with a safe sentence (steering q22): Could not restore "<title>": Session failed to start. Check provider setup and retry.. The raw spawn error is never shown, because it can carry environment values or tokens (or project "<title>", or "N closed items"). This covers both a whole failure and the leftover members of a group. The entry stays on the stack for another try, unchanged.

Evidence

  • Renderer tests with the recorded posix_spawnp failed IPC rejection: exact toast text, and the entry is kept.
  • A partial group names the failed member.
  • Red on main; mutants killed for both toasts and for keeping the reason.
  • tsc -b is clean; the hook and undo suites pass (352 tests).

🤖 Generated with Claude Code

Juliusolsson05 and others added 7 commits September 25, 2026 05:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…othing

respawn swallowed every spawn error (catch { return null }), the entry
went back on the stack, and nothing was shown, so after a provider CLI
broke every Cmd+Shift+T looked like a dead key. The error is now kept
per undo and toasted as `Could not restore "<title>": <reason>`, both
for a whole entry and for the members of a group that did not come
back. The entry stays on the stack, as before.

Closes #1242

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ror (steering q22)

The spawn rejection is the raw provider exception relayed through IPC and
can carry environment values or tokens, and a toast is visible text. The
toast now names what could not be restored and then gives
SESSION_START_FAILED_MESSAGE, as main's recovery and the reload path do.
The tests assert the safe text and the absence of the raw error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ule, partial projects

- The toast used the 2.5 s default, gone before the sentence could be
  read. Warning-grade toasts elsewhere use 6-10 s, so this uses 8 s.
- The title fallback re-implemented sessionDisplayTitle and got empty
  titles and trailing slashes wrong; 19 of the owner's 35 real sessions
  are untitled, so it now uses the shared rule.
- A project that came back with only some of its agents dropped the rest
  silently (#992's best-effort rule). It now says "Could not restore 1 of
  3 agents in project ...".
- The project wording, untitled fallback and duration are pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t retried forever

Main refuses a spawn whose cwd is gone with MissingWorkspaceDirectoryError,
the one start failure no retry can fix. Undo treated it as a provider
failure: the entry was pushed back, every later Cmd+Shift+T re-failed on
it, and every older close became unreachable. It is now consumed like a
stale entry with "its folder no longer exists (<path>)" — main's own
curated text, which the pane header already shows.

The class does not survive ipcRenderer.invoke, so the message prefix is
now a shared constant used by both sides. A project whose every member's
folder is gone is consumed too; a mix stays retryable. Also regroups the
@shared import (R2-3). R2-2 (raw session:spawn text over IPC) is a
follow-up issue, outside this toast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Juliusolsson05 and others added 3 commits September 25, 2026 06:18
…sts, groups drop consumed members

- A partly restored project named the provider for agents whose worktrees
  were deleted; the reason now follows what failed (folders, provider, or
  both).
- An all-folder project spanning several cwds (the owner's largest real
  project spans 22) no longer names the first one as if it were the only.
- A group whose deleted-folder member was consumed before a sibling failed
  pushed the ORIGINAL group back, so the consumed member was retried and
  re-toasted on every later Cmd+Shift+T; the leftover is rebuilt instead.
- Tests pin the mixed-project rule (a surviving mutant in both reviews).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juliusolsson05

Copy link
Copy Markdown
Owner Author

Review disposition (2 rounds, then merge on green)

  • Round 1: A — a partly restored project dropped members silently → fixed (ce27992). B — the toast was too short, the title rule was duplicated, the raw IPC prefix was shown → fixed (8 s; shared sessionDisplayTitle; steering q22 safe sentence).
  • Round 2: B R2-1 — a deleted worktree folder poisoned the undo stack head → fixed (8fdb930: consumed with 'its folder no longer exists', via the shared MISSING_WORKSPACE_FOLDER_PREFIX). R2-2 (raw session:spawn over IPC) → filed as session:spawn relays the raw provider exception over IPC (q22 at the source) #1267. R2-3 import order → fixed.
  • Final reviews: A MERGE-READY, B MERGE-READY. Their minors are fixed in 41456b2: folder reasons in project toasts, a group drops consumed members, a multi-cwd project names no single folder, and the mixed-project rule is pinned.

CI quality-gate is green on a head that contains origin/main. Closes #1242.

🤖 Generated with Claude Code

@Juliusolsson05
Juliusolsson05 merged commit a56d696 into main Sep 25, 2026
2 checks passed
@Juliusolsson05
Juliusolsson05 deleted the fix/undo-close-respawn-failure branch September 25, 2026 14:41
Juliusolsson05 added a commit that referenced this pull request Sep 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juliusolsson05

Copy link
Copy Markdown
Owner Author

Correction to the disposition (steering q31): "contains origin/main" was checked BEFORE #1258 merged. #1264 merged 5 s later, and its tested head c13464e did not contain #1258's merge c13de39, so its green gate was against the prior main. There is no known interaction between the two fixes (different files: undoClose vs goal-loop store). main's own push CI for a56d696 is the check of the combination; this comment links its outcome once it finishes. From now on each merge is followed by a remerge and a fresh gate on the next PR, never two merges off one check.

Juliusolsson05 added a commit that referenced this pull request Sep 25, 2026
…ate rule, #1309

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juliusolsson05

Copy link
Copy Markdown
Owner Author

Follow-up to the correction above: main's push CI for the combined head a56d696 (#1258 + #1264) completed success (run 36149128459). The merge that skipped the fresh gate is therefore verified after the fact.

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.

bug(undo-close): a failed respawn is discarded silently; the shortcut then does nothing

1 participant