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 — Merge runner review fixes: wait for background subagents (X31), reope… · rphang/opencode-workflows@67d1032

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • CHANGELOG.md
  • README.md
  • docs
    • OPENCODE-API-NOTES.md
    • PARITY.md
    • design
      • steering-and-live-tree.md
  • src
    • mailbox.ts
    • opencode
      • background.ts
      • idle.ts
      • runner.ts
      • submit.ts
    • plugin
      • setup.ts
  • tests
    • helpers
      • fake-opencode-ctx.ts
      • plugin-harness.ts
    • parity
      • extensions.test.ts
      • tool-surface.test.ts
    • unit
      • background.test.ts
      • idle-hook.test.ts
      • mailbox.test.ts
      • opencode-runner.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎CHANGELOG.md‎

Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ may contain breaking changes.
3636

3737
### Fixed
3838

39+
- **Background subagents** (opencode 2.3, X31). opencode's `subagent` tool now always runs in the
40+
background; an agent that launches one returns the answer it gives after the subagent reports,
41+
not "I launched a subagent". A schema agent no longer spends a retry while its subagent runs,
42+
and a worktree a running job may still use is kept. The wait ends on stop or the agent timeout
43+
(30 min cap with a warning). Background shells are not waited for.
44+
- Steering messages are no longer refused for the rest of an agent's turn when another plugin or a
45+
user prompt keeps the agent working.
46+
- A late structured-output nudge no longer uses up an extra retry; parallel or cross-instance
47+
`workflow_submit` calls no longer lose an attempt or bring back a finished agent's state.
3948
- Failed agents report opencode 2.3's actual error instead of "agent session failed (terminal error)".
4049
- After an urgent message whose follow-up turn produced no text, the result no longer falls back to
4150
the cut-off text of the interrupted step.
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+8-6Lines changed: 8 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ run (6 agents, under a minute) is in [`demo/DEMO-OUTPUT.md`](demo/DEMO-OUTPUT.md
113113
- **Safe by default.** Workflows start only when you opt in. Scripts run in a sandbox with no
114114
filesystem, network or shell. Agents inherit your permission rules and never get more.
115115
- **Tested for parity.** 60 behaviors are each tracked against Claude Code in
116-
[`docs/PARITY.md`](docs/PARITY.md), and each has at least one test. The 30 extensions beyond
117-
Claude Code (`X01`–`X30`: steering, the live progress tree, per-agent models, the per-agent
116+
[`docs/PARITY.md`](docs/PARITY.md), and each has at least one test. The 31 extensions beyond
117+
Claude Code (`X01`–`X31`: steering, the live progress tree, per-agent models, the per-agent
118118
failure summary and outputs, idle-boundary steering and schema nudges, the freeform
119-
`workflow_script` tool, the TUI agent dialog and sidebar, and the desktop app companion) are specified and tested there the same way.
119+
`workflow_script` tool, the TUI agent dialog and sidebar, waiting for background subagents, and the desktop app
120+
companion) are specified and tested there the same way.
120121

121122
## Requirements
122123

@@ -539,7 +540,7 @@ Set them in the environment of the opencode server. They work with every install
539540
| `MAX_STRUCTURED_OUTPUT_RETRIES` (or `OPENCODE_WORKFLOW_MAX_STRUCTURED_OUTPUT_RETRIES`) | `5` | Attempts a schema agent gets before `agent()` throws. |
540541
| `OPENCODE_WORKFLOW_FREEFORM` | unset (on) | `0`, `false`, `no` or `off` registers no `workflow_script` tool, like the `freeformTool: false` option. |
541542
| `OPENCODE_WORKFLOW_RPC_CONTROL` | unset (on) | `0`, `false`, `no` or `off` makes the live tree's RPC read-only, like the `rpcControl: false` option. |
542-
| `OPENCODE_WORKFLOW_IDLE_HOOK` | unset (on) | `0`, `false`, `no` or `off` registers no `experimental.idle` hook (opencode 2.3+). Without it, a steering message that lands as an agent finishes still reaches it through an extra turn, and a schema agent that forgot `workflow_submit` is re-prompted in a new turn instead of nudged in the same one. |
543+
| `OPENCODE_WORKFLOW_IDLE_HOOK` | unset (on) | `0`, `false`, `no` or `off` registers no `experimental.idle` hook (opencode 2.3+). Without it, a steering message that lands as an agent finishes still reaches it through an extra turn, and a schema agent that forgot `workflow_submit` is re-prompted in a new turn instead of nudged in the same one. It also turns off waiting for an agent's background subagents (opencode 2.3 runs them in the background): an agent that launched one is then read as soon as its turn ends. |
543544
| `OPENCODE_WORKFLOW_DATA_DIR` | `$XDG_DATA_HOME/opencode/workflows`, else `%LOCALAPPDATA%\opencode\workflows` (Windows) or `~/.local/share/opencode/workflows` | Run transcripts, stored as `<dir>/<sessionID>/<runId>/`. The `dataDir` plugin option wins over it. |
544545

545546
## How it compares to Claude Code
@@ -555,10 +556,11 @@ that check it:
555556
| ADAPTED | 1 | Same purpose, reached another way |
556557
| N/A | 1 | Cannot be done as an opencode plugin |
557558

558-
The same file specifies the 30 extensions (status `EXT`, `X01`–`X30`): steering (including the
559+
The same file specifies the 31 extensions (status `EXT`, `X01`–`X31`): steering (including the
559560
opencode 2.3 idle-boundary flush and schema nudges), the live progress tree and its RPC, the
560561
per-agent model display, the per-agent failure summary and outputs, the freeform `workflow_script`
561-
tool, the TUI agent dialog and sidebar, and the desktop app companion.
562+
tool, the TUI agent dialog and sidebar, waiting for background subagents, and the desktop app
563+
companion.
562564

563565
Most of the gaps come from one limit of opencode's plugin API: **a plugin cannot create a child
564566
session with a `parentID`**. So workflow agents aren't nested under your session in the UI, and
Collapse file

‎docs/OPENCODE-API-NOTES.md‎

Copy file name to clipboardExpand all lines: docs/OPENCODE-API-NOTES.md
+11-2Lines changed: 11 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ the 2.3.0 packages and `tsc` is clean against their types.
3030
posts a `<subagent>` report with its last reply into the parent's inbox (steer) after **every**
3131
completed round and wakes the parent (#63209; the opt-out was removed in #63413). The runner
3232
therefore keeps creating root sessions (and P63 stays). Upstream's own `subagent` tool is now
33-
always background (#63391).
33+
always background (#63391): the call returns at once with the child's sessionID, the caller's
34+
turn may end, and the job's `<subagent>` report wakes the caller later
35+
(`core/tool/plugin/subagent.ts`). `session.wait()` is `awaitIdle` over executions only
36+
(`core/session/run-coordinator.ts`), so it resolves while the job runs; the job is visible to a
37+
plugin only in the `experimental.idle` event's `background` list. A workflow child that uses the
38+
tool would be read too early: the runner waits for such jobs through the idle hook (X31).
3439
- **Failure text:** the `{type:"idle", outcome:"failed"}` context message carries
3540
`error: {type, message, status?}` (#53826). An interrupted step keeps its closed text and its
3641
assistant message gets `error: {type:"aborted", message:"Step interrupted"}` (#60674). Tokens of an
@@ -196,7 +201,11 @@ at setup (unless `OPENCODE_WORKFLOW_IDLE_HOOK=0`) and keeps a map of its live ch
196201
→ mailbox, schema, stopping). When a child is about to go idle the hook stops its mailbox
197202
(`finishing`), awaits sends in flight, and returns with the window reopened when a sent message is
198203
not in `context()` yet: it waits in the inbox, so opencode continues the same execution with it.
199-
A later message is refused `finishing` rather than parked. For a schema agent without an accepted
204+
A later message is refused `finishing` rather than parked; if the execution goes on anyway (another
205+
plugin's idle hook, a user prompt, the cap), the session `context` hook, which runs before every
206+
model request, reopens the window the hook closed. While the child's own subagent or image job
207+
runs, the hook only records it (`workflow-jobs/<sessionID>` in `ctx.storage`) and the runner keeps
208+
waiting after `wait()` until a report lists none (X31). For a schema agent without an accepted
200209
submission it then sends the re-prompt text as a `resume:false` steer (a nudge, counted in the P21
201210
budget through the submit registry). The verification and wake above stay as the fallback for
202211
2.0.15, worktree children (their hook runs in the worktree instance, which has no mailbox; it can

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.