GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opencode): Support background subagents by tomjw64 · Pull Request #13261 · anomalyco/opencode

Conversation

@tomjw64

@tomjw64 tomjw64 commented Feb 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #5887

Type of change

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

What does this PR do?

The goal of this PR is to support fire-and-forget/async/background tasks in my best approximation of how Claude Code handles it.

This is done by calling SessionPrompt.prompt async and emitting a new BackgroundTaskCompleted event when the promise resolves. The new SessionBackground component listens for these events (and the idle status event) and takes care of flushing the queue of finished task information to the parent session and forcing it to take it a turn with the results of the completed task(s).

This attempts to be a bit more minimal than #7206 to increase the chances of acceptance. I am a first-time contributor to opencode and I almost certainly overlooked something here. I'm happy to receive any suggestions or review.

How did you verify your code works?

I opened opencode and entered the following prompt:

Run 4 general background subagents in parallel. Each one should use bash to
sleep for an amount of time and then print out a random number. Have them sleep
for 10, 18, 18.2, and 18.2 seconds, respectively. Then print out a chart to be
updated as each task notifies you of its completion.

And verified that the agent (tested with Kimi K2.5 Free):

  • Could handle additional user interaction before the first subagent completed.
  • Woke after the first subagent completed to update the chart.
  • Woke a second time after the second subagent completed to update the chart.
  • Woke a third and final time after the third and fourth subagents completed (to test that we buffer the results of two completions but still only give the primary agent a single turn once idled again)

Checklist

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

If you do not follow this template your PR will be automatically rejected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

reddec, kassieclaire, jensenojs, ivaigult, lukasbesch, yehudacohen, sarendipitee, Gr4ph1xZ, and novascreen reacted with thumbs up emoji
All reactions
  • 👍 9 reactions
@github-actions

github-actions Bot commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

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

Based on the search results, I found a related PR that may be relevant:

Potential Related PR:

  • PR feat(tui): fire-and-forget async subagent tasks #7206: feat(tui): fire-and-forget async subagent tasks
    • feat(tui): fire-and-forget async subagent tasks #7206
    • This appears to address the same concept of fire-and-forget async subagent tasks, which is the core feature being implemented in PR feat(opencode): Support background subagents #13261.

This PR could potentially be a duplicate or overlapping work on the same feature. You may want to review PR #7206 to understand if it was a previous attempt, partially merged, or if #13261 is a reimplementation with different approaches.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tomjw64 tomjw64 mentioned this pull request Feb 12, 2026
[feat] True Async/Background Sub-Agent Delegation #5887
Closed
@tomjw64

tomjw64 commented Feb 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

Received some review expressing some concern over task cancellation:

  1. subagents prompts not cancelled on session delete
  2. no way of individually cancelling a session in the TUI

We can address (1) in this PR (update: done), but I will open a separate issue for individual issue cancellation (update: done), so that background tasks can be cancelled without e.g. closing out the entire app.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Feb 17, 2026
[FEATURE]: Individual task cancellation #13916
Closed
feat: Support individual subagent cancellation #13924
Closed
@github-actions github-actions Bot mentioned this pull request Feb 28, 2026
📊 AI CLI 工具社区动态日报 2026-02-28 duanyytop/agents-radar#27
Closed
@tomjw64
tomjw64 force-pushed the background-subagents branch 2 times, most recently from 7f3d664 to a55ba8e Compare March 8, 2026 04:30
@github-actions github-actions Bot mentioned this pull request Mar 12, 2026
feat: add /btw background session command #17194
Closed
3 of 6 tasks
@tomjw64
tomjw64 force-pushed the background-subagents branch from a55ba8e to 6f3bdcc Compare March 21, 2026 21:33
@tomjw64
feat(opencode): Support background subagents
4819590
@tomjw64
tomjw64 force-pushed the background-subagents branch from 6f3bdcc to 4819590 Compare March 21, 2026 21:53
@ShibuyaCyana ShibuyaCyana mentioned this pull request Mar 25, 2026
[FEATURE]: File locks / Vim-style locks for OpenCode locks #4278
Closed
1 task done
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@allarac

allarac commented Apr 26, 2026

Copy link
Copy Markdown

By the love of god, can someone finally just give us parallel subtasks please? Who's supposed to use opencode effectively in its current state?

Gr4ph1xZ and Ploppy3 reacted with heart emoji
All reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ianldgs

ianldgs commented Jul 3, 2026

Copy link
Copy Markdown

I'm trying to understand why background subagents are used in a plugin, if regular subagents in a chat work just fine, and stumbled upon this issue.

How is this different from OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MKuckert MKuckert mentioned this pull request Jul 3, 2026
is OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS set? MKuckert/env#86
Closed
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[feat] True Async/Background Sub-Agent Delegation

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tomjw64 @allarac @ianldgs @thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.