Skip to content

fix(core): rollback interrupted shell acquisition - #52386

Open
HermanGrondahl wants to merge 1 commit into
anomalyco:v2from
HermanGrondahl:shell-acquisition-interrupt
Open

HermanGrondahl wants to merge 1 commit into
anomalyco:v2from
HermanGrondahl:shell-acquisition-interrupt

Conversation

@HermanGrondahl

@HermanGrondahl HermanGrondahl commented Sep 30, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #48838.

Related to #33364.

Type of change

  • Bug fix

What does this PR do?

Shell.create starts a process manager before returning the shell ID. If the caller is interrupted after registration but before that handoff, the manager can outlive its caller. Keep acquisition cancellable until handoff: interruption now stops the manager and removes any registered shell.

Terminal finish and removal also serialize per shell ID, preventing a detached observer from publishing shell.exited after shell.deleted or restoring removed retention state.

How did you verify your code works?

Deterministic tests cover interruption after registration and before handoff, fast exit before handoff, pre-registration interruption, spawn failure, and removal during output settlement and suspended exit publication. The current unpatched v2 fails the pre-handoff regression.

On current v2 with Bun 1.4.2: 123 pass, 19 platform skips, 0 fail, 628 expectations across the shell-tool, retention, and cross-spawn suites. Core typecheck, lint, and git diff --check pass. The pre-push hook also passed repository lint and typechecks.

Screenshots / recordings

Not applicable; this is a non-UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant