feat(opencode): Support background subagents#13261
feat(opencode): Support background subagents#13261tomjw64 wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
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:
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. |
|
Received some review expressing some concern over task cancellation:
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. |
7f3d664 to
a55ba8e
Compare
a55ba8e to
6f3bdcc
Compare
6f3bdcc to
4819590
Compare
|
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? |
Issue for this PR
Closes #5887
Type of change
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.promptasync and emitting a newBackgroundTaskCompletedevent when the promise resolves. The newSessionBackgroundcomponent 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:
And verified that the agent (tested with Kimi K2.5 Free):
Checklist
If you do not follow this template your PR will be automatically rejected.