Skip to content

feat(opencode): run bash commands in background#33310

Open
Rejudge-F wants to merge 2 commits into
anomalyco:devfrom
Rejudge-F:background-bash
Open

feat(opencode): run bash commands in background#33310
Rejudge-F wants to merge 2 commits into
anomalyco:devfrom
Rejudge-F:background-bash

Conversation

@Rejudge-F

@Rejudge-F Rejudge-F commented Jun 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #1970

Type of change

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

What does this PR do?

Adds an explicit opt-in background mode for the opencode bash tool.

When the model calls bash with run_in_background: true (or the background alias), the command is registered with the existing BackgroundJob service and the tool returns immediately with a job id and output path. The command keeps running outside the original tool call, writes its final output to the output path, and injects a synthetic completion message back into the parent session when it exits.

This also adds bash_kill so agents can cancel bash background jobs by id. It checks the job type before canceling so it cannot stop non-bash background jobs such as subagent tasks.

This is intentionally narrower than a full shell job manager: it does not add mid-flight detach, automatic backgrounding, or a TUI keybind.

How did you verify your code works?

  • cd packages/opencode && bun typecheck
  • cd packages/opencode && bun test test/tool/shell.test.ts test/tool/parameters.test.ts
  • cd packages/opencode && bun test test/tool/ --timeout 60000
  • bun run typecheck
  • bun run lint — 0 errors, existing warnings only

Screenshots / recordings

N/A

Checklist

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

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Potential Related PR Found:

Please review PR #32675 to confirm whether it's a duplicate or addresses the same underlying feature request.

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

Copy link
Copy Markdown
Contributor

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

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.

Feature Request: Add Background Bash Execution (Like Claude Code’s Ctrl+b)

1 participant