Skip to content

fix(core): allow agents to stop background shell commands - #48352

Closed
dbpolito wants to merge 2 commits into
anomalyco:devfrom
dbpolito:shell-stop
Closed

dbpolito wants to merge 2 commits into
anomalyco:devfrom
dbpolito:shell-stop

Conversation

@dbpolito

@dbpolito dbpolito commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #36424

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds shell_stop so agents can cancel a background command using its returned shell ID. It reuses Job.cancel and the existing interruption cleanup (shell.remove), including removal of captured output.

Related: #46721 adds stop APIs and user-stop outcomes; this PR adds the model-callable tool using current cancellation behavior.

How did you verify your code works?

  • All 35 pre-push typecheck tasks passed.
  • Both integration tests passed: tool cancellation and interruption cleanup, including removal and cancellation notifications.
  • The earlier full shell test run had six Bash process-substitution/compound-syntax failures.

Screenshots / recordings

Not applicable (no UI changes).

Checklist

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

@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.

@dbpolito dbpolito closed this Sep 10, 2026
@dbpolito dbpolito reopened this Sep 10, 2026
@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:06
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

v2: shell: no way to stop a running background command

1 participant