Skip to content

fix: keep tabs and offer Resume when a Claude session is killed (INC-422) - #514

Merged
arzafran merged 2 commits into
mainfrom
franco/inc-422-force-quitting-a-leftover-background-app-kills-claude
Oct 30, 2026
Merged

arzafran merged 2 commits into
mainfrom
franco/inc-422-force-quitting-a-leftover-background-app-kills-claude

Conversation

@arzafran

Copy link
Copy Markdown
Member

What this does

Force-quitting a leftover background app from the Dock (an MCP server or a debug binary that Claude launched) no longer takes the Claude session down with it. If a Claude session is killed anyway, the tab stays open with a banner offering Resume or Close, instead of vanishing. When a Claude agent exits, Programa also cleans up the background processes it left behind so they stop piling up in the Dock.

Fixes INC-422

Summary

macOS charges everything Claude launches to the claude pid, so force-quitting one of those apps kills claude. Start with Sources/LeftoverProcessReaper.swift (snapshots which processes each tracked agent is responsible for, reaps them when the agent exits), then Sources/AgentInterruptedBanner.swift (Resume/Close banner), then Sources/Workspace*.swift / TabManager.swift (keep the tab and surface the banner when the agent or pane process dies). The rest is wiring and localization strings (English and Japanese). New diagnostics.log lines (agent, surface, reaper) record these events.

The reaper uses the private libsystem symbol responsibility_get_pid_responsible_for_pid; if it is missing the reaper does nothing. Ownership is polled every 10 s, so anything launched in an agent's last ~10 s survives (marked with a SHORTCUT comment).

Test Plan

  • Verified live in a tagged build: kill -9 of claude shows the "Claude stopped unexpectedly" banner on a live shell.
  • Verified live: kill -9 of the pane login keeps the tab with "This pane's processes were killed" (diagnostics: childExited kept=true).
  • python3 scripts/check-structural-budgets.py and python3 scripts/check-settings-docs.py pass locally.
  • CI: expect all required checks green.

Not verified: clicking Resume/Close (no Accessibility grant in the test session), and the reaper never reaped anything in testing because the MCP children exited on their own.

Unexplained: one force-quit at 12:30:20 killed 7 sessions at once. The new diagnostics lines should identify the cause next time it happens.

Screenshots: before/after needed for the banner.

@arzafran
arzafran merged commit b6fd8a3 into main Oct 30, 2026
12 checks passed
@arzafran
arzafran deleted the franco/inc-422-force-quitting-a-leftover-background-app-kills-claude branch October 30, 2026 17:04
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