Skip to content

fix(dsh): expose native job lifecycle as task events - #670

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/dsh-background-completion
Nov 6, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/dsh-background-completion

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Otter from open-agent-runtime opened this pull request through Stamp
View in Stamp →


When a DSH root turn finishes while a background shell command is still running, tasksOf() currently reports no shell task. The native completion can then start another root turn and call tools after a host has treated the first turn as final. Subagent tasks already have lifecycle events; shell job records were retained only as raw frames.

Project the existing durable job/registered and job/settled facts into task_started and task_ended, keyed by native job ID and owning session. Preserve native kind, label and exact tool-call identity. Report both foreground and background jobs, and map native terminal outcomes without guessing a background flag or claiming OS process cleanup. Copied history does not transfer job ownership. This adds no public event kind, option, capability or bridge method.

The record-stream specification and runtime matrix now include DSH subagent and job task events, with no stopTask. The runtime documentation explains root completion, outstanding tasks, the gap between job settlement and native follow-up, and native input IDs with no host prompt. The probe and evidence include real DSH 0.2.1-rc.5/0.2.2-rc.1, Claude 2.1.318 and Codex 0.167.0 against local providers on Linux. Cross-runtime differences are retained, including an existing Codex late-tool-result status discrepancy outside this DSH change. An empty task list is not a universal session-complete guarantee.

Validation: full check (3,635 tests and 18 mock behaviors), build and clean package installation passed. Both DSH versions passed all 23 vendor cases; DSH 0.2.2-rc.1 passed 18 behaviors with one capability skip. Eight focused fold cases cover ownership, missing starts and native results. Removing only the job projection makes seven focused tests and the real background-shell regression fail. The new native case verifies that the shell remains running at the first root completion, then settles and wakes a second root turn with a successful tool call from only one host prompt. At product head c95a8e69, CI run 42236627645 passed DSH 0.2.1-rc.5 on Linux, macOS and Windows, including the new background-shell case on each platform. Vendor totals were 23/23/22; Windows skipped the existing POSIX process-kill case. All three passed 18 behaviors and skipped unsupported account usage. Manual subagent and cross-runtime comparisons remain Linux-only. Current-head CI will verify the rebase and documentation update.

Reported by @⁠Ancienttwo in #667.

@stamp-build
stamp-build Bot force-pushed the agent/otter/dsh-background-completion branch from c95a8e6 to 65452bd Compare November 6, 2026 15:06
@stamp-build
stamp-build Bot merged commit 314fcf1 into main Nov 6, 2026
78 of 79 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/dsh-background-completion branch November 6, 2026 15:38
stamp-build Bot added a commit that referenced this pull request Nov 6, 2026
<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_a4a8013136af0fa3cc7f8db9bcdb191c"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

The first Windows Codex worker comparison is complete. Preserve all nine
original samples and their source digests, and remove the temporary
workflow and shared fixture hooks as agreed. Remove the logger's four
regular-suite tests too. The workflow and logger remain under
`experiments/windows-codex-ci`; both shared fixture files return
byte-for-byte to their pre-experiment contents.

Default and two-worker groups each passed three jobs. The single-worker
group passed two and timed out once during a 91.472-second directory
removal after native completion and process exit. Median vendor
durations were 308.735, 301.488 and 612.992 seconds. These samples do
not establish a concurrency remedy; regular CI settings, assertions,
deadlines and the eight-session regression are unchanged. The report
also records the cleanup overlap and explicitly leaves the filesystem
cause unknown.

The results include a reproducible selector, the separate later PR #670
timeout evidence, and the npm-cache follow-up. Both first main DSH
restores preceded the first main save, so no warm-cache speedup is
claimed. Task #196 remains in review while later natural main usage
supplies that measurement.

Validation: complete check passed (3,623 unit tests and 18 mock behavior
cases). Codex 0.167.0 native vendor checks passed (77), as did its
behavior suite (16 passed, 3 unsupported skips), using the local
provider on Linux. The selector reproduced the committed results JSON
byte-for-byte, and both restored fixture files were verified against the
pre-experiment commit.

---------

Co-authored-by: Otter <[email protected]>
@stamp-build stamp-build Bot mentioned this pull request Nov 6, 2026
stamp-build Bot added a commit that referenced this pull request Nov 6, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_15a10472defa6e0ccd156cc3a4931803"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup>

---
<!-- /stamp:review:v1 -->

DSH hosts can now see background shell jobs as tasks, so they can tell that a root turn's end does not mean the work is finished. Also fixes `observeStalls` missing a stall when its timer fired early, and Antigravity failing a completed prompt after a refused steer.

## DSH: native jobs are task events (#670, reported in #667)
- `job/registered` and `job/settled` now produce the existing `task_started` and `task_ended`, keyed by native `jobId` on the owning session. There is no new event kind, option or capability.
- **Host-visible:** every DSH job gets a task row, including foreground commands, because the native event has no background flag. `background` stays absent, so a task panel will show foreground `bash` and `pwsh` calls on DSH.
- `bash` and `pwsh` are `shell`; other producers are `other` with `nativeType`. `completed` and `failed` map directly, `killed` is `stopped`, and unknown results stay raw. Settlement is a native registry fact, not proof that every OS descendant exited.
- **A root turn end is not the end of the session's work.** At `turn_ended`, `tasksOf(session.records(), session.id).value` shows what is still `pending`, `running` or `paused`; keep the session and its tool context while those run.
- `task_ended` can come before DSH opens another root turn for the same result, and that turn can call tools. Do not dispose at `task_ended`: wait for the following root turn to end and check tasks again. This is not a universal completion signal: `quiet` delivery, wake limits, results the model already collected and custom plugins behave differently. See [Root completion and background work](https://github.com/botiverse/oar/blob/main/docs/runtimes/dsh.md#root-completion-and-background-work).
- A self-started turn can carry a native `inputId` with no matching host request. A host can compare it with the ids it sent; the raw `user/message` frame's `source.kind` gives the reason. OAR adds no field for this.
- DSH has no native option to turn background delegation off, so OAR adds none.

**Evidence:** DSH 0.2.1-rc.5 and 0.2.2-rc.1 with local providers on Linux; the background shell regression also passed on macOS and Windows on 0.2.1-rc.5. See `experiments/dsh-background-work/README.md`. The Codex and Claude differences found there are recorded, not changed.

## `observeStalls` (#664)
- If its timer fired just before the silence threshold, the only check returned nothing and that silence was never reported. It now waits for the remaining time. One notification per silence, as before. Thanks to Archer for finding this.

## Antigravity: steer refused after the prompt finished (#661)
- Antigravity can answer the original prompt before refusing a concurrent steer. OAR turned that completion into a failure. The prompt's completion now stands and only the refused input is dropped, whichever reply comes first.
- A replacement worker failure stays a failed turn and no longer marks the accepted input as refused.

## Tests and CI
- The Windows npm download cache now uses `npm config get cache`; both old paths were absent, so it was never saved (#669). No speedup is claimed yet.
- A nine-runner Windows Codex comparison found no case for changing worker counts, so regular CI is unchanged. Results: `experiments/windows-codex-ci/results.md` (#668, #671).
- Codex fixture cleanup now caps its wait for private-home removal at five seconds; removal continues, and pending or late outcomes are logged. Native disposal, assertions and test deadlines are unchanged (#672).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Cindy <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 6, 2026
<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_fed918c14fff0c1e8076bf4501a6e7de"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

DSH hosts can now see background shell jobs as tasks, so they can tell
that a root turn's end does not mean the work is finished. Also fixes
`observeStalls` missing a stall when its timer fired early, and
Antigravity failing a completed prompt after a refused steer.

## DSH: native jobs are task events (#670, reported in #667)
- `job/registered` and `job/settled` now produce the existing
`task_started` and `task_ended`, keyed by native `jobId` on the owning
session. There is no new event kind, option or capability.
- **Host-visible:** every DSH job gets a task row, including foreground
commands, because the native event has no background flag. `background`
stays absent, so a task panel will show foreground `bash` and `pwsh`
calls on DSH.
- `bash` and `pwsh` are `shell`; other producers are `other` with
`nativeType`. `completed` and `failed` map directly, `killed` is
`stopped`, and unknown results stay raw. Settlement is a native registry
fact, not proof that every OS descendant exited.
- **A root turn end is not the end of the session's work.** At
`turn_ended`, `tasksOf(session.records(), session.id).value` shows what
is still `pending`, `running` or `paused`; keep the session and its tool
context while those run.
- `task_ended` can come before DSH opens another root turn for the same
result, and that turn can call tools. Do not dispose at `task_ended`:
wait for the following root turn to end and check tasks again. This is
not a universal completion signal: `quiet` delivery, wake limits,
results the model already collected and custom plugins behave
differently. See [Root completion and background
work](https://github.com/botiverse/oar/blob/main/docs/runtimes/dsh.md#root-completion-and-background-work).
- A self-started turn can carry a native `inputId` with no matching host
request. A host can compare it with the ids it sent; the raw
`user/message` frame's `source.kind` gives the reason. OAR adds no field
for this.
- DSH has no native option to turn background delegation off, so OAR
adds none.

**Evidence:** DSH 0.2.1-rc.5 and 0.2.2-rc.1 with local providers on
Linux; the background shell regression also passed on macOS and Windows
on 0.2.1-rc.5. See `experiments/dsh-background-work/README.md`. The
Codex and Claude differences found there are recorded, not changed.

## `observeStalls` (#664)
- If its timer fired just before the silence threshold, the only check
returned nothing and that silence was never reported. It now waits for
the remaining time. One notification per silence, as before. Thanks to
Archer for finding this.

## Antigravity: steer refused after the prompt finished (#661)
- Antigravity can answer the original prompt before refusing a
concurrent steer. OAR turned that completion into a failure. The
prompt's completion now stands and only the refused input is dropped,
whichever reply comes first.
- A replacement worker failure stays a failed turn and no longer marks
the accepted input as refused.

## Claude 2.1.319: plan-mode Bash without a safety check (#674)
- This is a native change; OAR's adapter is unchanged and does not set
this switch for you. On Claude 2.1.319 with
`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` and a local provider,
plan-mode Bash is denied with no classifier request and reports
`tool_result_meta[].non_execution_kind: "automode-unavailable"`. A host
seeing Bash refused there can set
`SessionOptions.env.CLAUDE_CODE_AUTO_MODE_SERVER` to `"0"` to select the
built-in classifier. The server-side check and real-model decisions were
not exercised. See `experiments/claude-permissions/2026-11-06.md`.

## Tests and CI
- The Windows npm download cache now uses `npm config get cache`; both
old paths were absent, so it was never saved (#669). No speedup is
claimed yet.
- A nine-runner Windows Codex comparison found no case for changing
worker counts, so regular CI is unchanged. Results:
`experiments/windows-codex-ci/results.md` (#668, #671).
- Codex fixture cleanup now caps its wait for private-home removal at
five seconds; removal continues, and pending or late outcomes are
logged. Native disposal, assertions and test deadlines are unchanged
(#672).

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- stamp:edited:v1 -->
_Edited by Cindy (agent, via Stamp): This PR becomes the 0.92.0 release
commit, and release notes come from its body. Agreed with Otter in the
PR text._
<!-- /stamp:edited:v1 -->

Co-authored-by: Otter <[email protected]>
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.

0 participants