Repository navigation
fix(provider-omp): show subagents spawned by OMP's task tool - #31
GustavBlack wants to merge 5 commits into
Conversation
The Pi adapter projected subagent cards only for the tool named "subagent" (pi-subagents). OMP's fan-out tool is named "task", so its calls fell through to generic dynamic_tool rows: no cards, no live progress, and background runs untracked. PiFlavor gains subagentToolName (pi: "subagent", omp: "task") and the adapter now projects OMP task calls: SingleResult.output for result text, assignment/task for the prompt, exitCode for status, running cards from details.progress[], background runs tracked by details.async.jobId and settled from the task-result blocks omp delivers through wait results. Replay tests recorded from omp 19.2.0 RPC cover foreground, parallel and async sequences.
|
Not merged yet. The approach (flavor-gated
Please add failing-first tests for 1–3 (aborted/unknown status, jobId spawn without progress ids, turn ending without |
Review of PR #31 found the OMP projection leaking running state and reaching into Pi's paths. Addressing each finding: - One member key across progress and results cards (id, then step/index), so the running card is the card that completes; the replay test now asserts the running subagent's id is the one that settles. - progress[] cards map to interrupted/failed when the tool ends without results (isError picks failed over interrupted). - Background runs track members as id -> agent, falling back to the job id when a spawn carries no progress ids; every parsed task-result block settles its member (completed/failed/error as-is, anything else as interrupted); task-result attributes parse in any order; runs still tracked when the agent settles are dropped as interrupted, releasing background_work. - The OMP-only paths (progress fallback, output preference, tracking guard, wait hook) are gated on the flavor, leaving Pi's behavior identical to main. Failing-first tests cover each case: orphan key, errored end without results, jobId-only spawn, cancelled status, attribute order, and agent_settled without wait.
|
Thanks for the review — all four findings confirmed against source and addressed in b0d67b1, each with a failing-first test. 1. Orphan running card (foreground) — fixed. Both branches key members the same way now: 2. 3. Background runs that never settle — fixed in four parts:
4. Pi path not fully gated — fixed. One One flag while testing 3: OMP 19.2.0 emits Evidence: 8 OMP replay tests, 6 of them red-first (orphan key, errored end without results, jobId-only spawn, cancelled status, attribute order, settle-without-wait). Full adapter file: 180 pass / 2 skip / 1 fail — the pre-existing Windows fork-separator test that fails identically on main. Typecheck clean for Model/harness: ONI coding-agent harness. |
OMP never emits Pi's `agent_settled`. Its RPC ends a stretch of agent activity with `agent_end` per run followed by one `session_settled` (coding-agent/src/modes/rpc/rpc-session-settle.ts), so the teardown added for review could not fire in a live OMP session: background `task` runs still tracked at agent end kept `background_work.updated pending: true`. The `agent_settled` case now also matches `session_settled`, gated on the OMP flavor so Pi's path is unchanged. The failing-first test replays omp 19.2.0 frames (`agent_end` then `session_settled`) and asserts the running card's id is the one that settles interrupted, with the run released. Verified against live omp 19.2.0 RPC: `session_settled` arrives once per turn after each `agent_end`, and no `agent_settled` frame exists.
|
Follow-up to my reply above. TL;DR: the OMP teardown in The mismatch. OMP's RPC ends a stretch of agent activity with Fix ( Failing-first test. "interrupts OMP runs still tracked when omp's session settles" replays the real frame order ( Evidence it's the right frame, live. Two omp 19.2.0 RPC sessions driven directly against the CLI:
Checks. Not done / out of scope. |
|
Re-reviewed at (Review notes prepared with Claude Code on behalf of the maintainer.) |
…sion settle Review blocker on #31: `session_settled` fires once per turn, and omp's settle predicate excludes deliveries it has suppressed (a `wait` in flight, a foreground job, a user-interrupted run). Dropping every tracked run at `session_settled` therefore killed runs that were still live: the card was marked interrupted while its job still worked, and a later `wait` could not settle it because the run was already gone from `piAsyncRuns`. Tracking now ends only with evidence: - Runs settle from `<task-result>` blocks wherever omp emits them: `wait` tool results and the `async-result` custom message it records when a job finishes without a waiting agent (same envelope, now parsed once). - A stopped turn still abandons its runs at `session_settled` (they cannot keep running after Stop), and a closing transport drops them with the process. - A background spawn's `tool_execution_end` no longer interrupts its own cards: `details.async.state: "running"` means the job continues, so its progress rows keep their status. Aborted/errored calls still end non-terminal members as interrupted/failed. A spawn that already settled is not tracked at all (previously a pending leak). Failing-first: "settles an OMP background run from its async-result delivery", "settles an OMP background run from a wait in a later turn", "interrupts OMP runs when the stopped session closes" (all three fail on the previous commit; the first two assert the running card's id is the one that settles, and that `background_work` clears). Plus "settles the OMP turn when omp's session settles" for the turn-lifecycle path the review asked to cover. adapter.test.ts: 184 pass, 2 skip, 1 fail (pre-existing Windows fork-path assertion at :3277, fails identically without this change). Typecheck, format and lint clean for packages/provider-pi.
`recovers a historical Pi fork recorded before turns stored the session
file` built its fixture paths as `${dir}/original.jsonl` from the OS temp
directory. The fork scans that directory with `path.join`, so on Windows
the adapter passes `C:\tmp\x\original.jsonl` to `--fork` while the test
expected the mixed-separator `C:\tmp\x/original.jsonl`: the same file, a
different string, and the only failing test in adapter.test.ts on Windows.
Join the fixture paths the way production does. On POSIX `path.join`
yields the identical strings, so the assertion is unchanged there.
adapter.test.ts is now 185 pass / 2 skip / 0 fail on Windows.
|
Re-reviewed blocker addressed at
What changed (
Tests (all in
Red-first: I stashed only Results. Also included, deliberately separate ( Not covered / still open:
Model/harness: ONI coding-agent harness. |
Problem
When the OMP provider (
omp --mode rpc) spawns subagents with its built-intasktool, the thread shows the call as one generic tool row: no subagent cards, no live progress, and background runs are never tracked. The Pi adapter this provider reuses projects subagent cards only when the tool is namedsubagent(the pi-subagents extension's name); OMP's fan-out tool is namedtask, so every call falls through to thedynamic_toolitem. (#30)Fix
PiFlavorgainssubagentToolName(pi:subagent,omp:task), and the adapter's subagent projection is gated on the flavor instead of a hardcoded tool name — so a Pi user's own customtasktool is not misread.SingleResultmapping:output→ result text,assignment/task→ prompt,exitCode/stopReason→ status. Pi results are unaffected (assignmentis absent in the pi-subagents shape, so precedence falls back totaskexactly as before).details.progress[], which OMP streams ontool_execution_updatewhileresults[]is still empty.details.async.jobId(previously only pi'sasyncId), keep the session ingesting after the coordinator's turn ends via the existingbackground_work.updatedpending signal, and settle from the<task-result>blocks OMP delivers throughwaittool results.Evidence
omp 19.2.0 --mode rpcsession — foreground blocking (async.enabled: false), parallel batch, and async background +wait. All three failed by timeout before the fix and pass after it:vp test run packages/provider-pi/src/server/adapter.test.ts→ 175 pass / 2 skip / 1 fail.recovers a historical Pi fork recorded before turns stored the session file) fails identically onmainon this Windows machine — a path-separator assertion in the forkThread code, unrelated to this change.provider-piandprovider-omp;vp run check:changedformat/lint/knip pass. Its remaining typecheck/test failures reproduce on cleanmain(t3,workflow-authoring) and are pre-existing.test-t3-app); this change is adapter-side and is exercised by the replay tests. Happy to add client screenshots in a follow-up comment.Surfaces
subagentfor pi, and the field precedence keeps pi mappings identical).waittool results, so the adapter parses the<task-result>blocks there (gated on a tracked run actually containing the id, so a Pi user's customwaittool can never misfire).Model/harness: ONI coding-agent harness (exact underlying model id not visible to the agent itself — can amend this line).