Commit graph

19 commits

Author SHA1 Message Date
Ayaan Zaidi
31172cf544
fix(agents): deliver complete subagent answers to waiting parents (#149223)
Most added lines cover regressions and move formatting beside exact-run reads; archived histories now stream through the existing storage worker.

## What Problem This Solves

Completed child answers could lose required fields before their parent read them. Closes #138555. Reported by @aleps001.

## Why This Change Was Made

The parent receives the complete visible final answer from the selected child run, including its registered deletion archive. Descendant results remain input to the child's synthesis. A persisted final message-tool reply remains authoritative after a later same-run `NO_REPLY`.

The shared 4,096-character terminal snapshot stays bounded for lifecycle and durable evidence. This state has one writer. Stored shapes, retention, and cleanup ownership are unchanged. Complete answers use more parent context. The owner's September 15 decision replaces projection limits from #119731 and #124171 while preserving escaping, metadata limits, stable order, and whole-item queue delivery.

## User Impact

Waiting and returning parents receive complete answers while the exact-run transcript remains retained. If archive pruning has removed it, that completion uses its capped published result with a `truncated-by-retention` marker. Healthy siblings and the parent continue. Public and private nested children forward their own conclusions. Large archived histories no longer require one decoded string on the Gateway thread.

## Evidence

An 8,638-character answer lost its required tail on the baseline. Served Chat now delivers all 11,758 escaped characters to the resumed parent and retains them after child deletion. A public nested case delivers the middle child's distinct conclusion. Earlier aggregate, nested-yield, and ordinary completion captures also pass.

The registered `maybeWakeRequesterAfterAllChildrenSettled` regression uses capped visible terminal evidence and a complete >4,096-character exact-run transcript with a trailing same-run `NO_REPLY` row. It fails on the original implementation and passes here. The producer contract is covered by [run-entry-terminal.ts](a97d75a928/src/agents/embedded-agent-runner/run-entry-terminal.ts (L153)) and [run-entry.test.ts:928–931](a97d75a928/src/agents/embedded-agent-runner/run-entry.test.ts (L928)). Native children cannot call `message` under the existing hard deny, so that live cell is excluded.

A returning parent can receive a kept child’s answer and then continue after that child starts a valid follow-up. The registered tool-result continuation fails on `a97d75a9` and passes here. Initial source rejection, parent cancellation, and pre-prompt compaction remain covered.

The registered `attempt-prompt-submit.retention.test.ts` regression publishes and prunes a child archive, then consumes deferred results through the real parent session (`node scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/attempt-prompt-submit.retention.test.ts`). It fails before the correction and passes with the marked retained result, the healthy sibling’s complete answer, cleared delivery leases, and a successful next parent turn.

[Scenario and captures](https://gist.github.com/obviyus/cce960c04dafd949c21141686af3696e).

| Before | After |
| --- | --- |
| ![Missing field](https://gist.githubusercontent.com/obviyus/cce960c04dafd949c21141686af3696e/raw/e8b97302964ad1bd874c7b4f578c30a72593610a/before.png) | ![Complete field](https://gist.githubusercontent.com/obviyus/cce960c04dafd949c21141686af3696e/raw/e8b97302964ad1bd874c7b4f578c30a72593610a/after.png) |

## Compatibility

No public API, schema, retention, or retrieval feature changes. Archive hash, header, session, and owner checks remain. The existing worker scans a 536.9 MB decoded archive whose previous whole-string decoder failed.

## Consumers

Requester settlement, deferred turns, nested announcements, event projections, and retained parent history use the complete result, or the marked retained snapshot when its exact answer is unavailable.

## Invalidation

Run, producer, generation, batch, requester, and lease authority are rechecked after reads and before delivery. Failed prompt assembly releases its lease. Deferred source validation ends after the first foreground stream is acquired; parent abort checks remain active.

## Tests

The retained complete-result proof covers 374 tests across 15 files, including the format suite. The retained owner and sibling proof covers 379 passing tests across 17 files on a fresh merge with main, including the format and retention regressions. Four additional consumer suites update their explicit session-accessor mocks for the exact-run reader; their 286 tests pass on a fresh merge with main, with behavior assertions unchanged. Registered settlement, deferred-input, and continuation regressions fail on their original source. Type-aware preflight, structural checks, and test registration pass.

Production growth is 422 lines: result +241; output −130; queue +27; registry API +8; prompt build/phase/submit +6/+1/+16; wake/message −44/+54; announce +13; events −16; archive read/session/types/dispatch/worker/history +183/+6/+14/+20/+9/+11; history export +3. Growth accepted under the owner's standing acceptance (2026-09-15).

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-09-16 02:06:29 +05:30
Peter Steinberger
3d3386a20e
fix: finish yielded tasks and identify failed child sessions (#149261)
* fix: finish yielded tasks and attribute child failures

* test(codex): control model attribution timeout and cleanup

Adopt the test-only cleanup repair from #149274 and assert the canonical timeout result. Production deadlines and cleanup behavior are unchanged.
2026-09-15 11:52:43 -07:00
Peter Steinberger
2da6e2a7e6
fix: preserve completed tool results in Codex subagent forks (#149096) 2026-09-15 07:10:06 -07:00
Peter Steinberger
eb38ff8353
fix: preserve execution budgets and late task replies (#148508) 2026-09-14 14:29:06 -07:00
Peter Steinberger
523973ab6e
fix(subagents): preserve private completions across parent yield (#148405)
Keep private results under the spawning turn until it settles, then resume
individual review or the existing yielded batch. Fence late failed announcements
without discarding committed delivery receipts.

The real Gateway regression reproduces the false parent failure before this
change and passes with one processed result afterward. Three requester-owner
E2E cases, 280 lifecycle/recovery tests, and changed-file checks pass.

Related: #147206, #147571, #146667.
2026-09-14 13:02:06 -07:00
Peter Steinberger
7043f8fb4f
feat(subagents): explain waits and separate execution from result delivery (#147571)
* feat(subagents): make task waits, controls, and delivery observable

* test(subagents): make live status and evidence probes explicit

* test(subagents): refresh model-facing tool snapshots

* test(tasks): reuse the task-owned Gateway fixture

* test(subagents): reuse the Gateway test-client owner

* refactor(tasks): consolidate restored indexes and settle lifecycle proof

* refactor(ui): reuse task status copy in subagent tooltips

* build(workboard): refresh assets after subagent protocol integration

* perf(ui): load background task copy with its deferred views
2026-09-13 23:29:48 -07:00
RoboClaw
12f6c20585
fix: let visible subagents select managed projects (#147459)
* fix: let visible subagents select managed projects

Forward registered project and GitHub repository selectors through the existing session creation owner without relaxing raw path authorization.

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

* fix: refresh managed project spawn prompt snapshots

Regenerate canonical prompt and dynamic-tool snapshots for the new visible session project selectors.

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

* fix: enforce inherited sandbox before project worktree allocation

Use the persisted child policy for registered projects at the existing deferred preparation owner, matching remote clone containment before any worktree allocation.

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

* fix: apply inherited sandbox before project binding

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

---------

Co-authored-by: roboclaw-bot <309084314+roboclaw-bot@users.noreply.github.com>
Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
2026-09-13 22:16:17 -04:00
Peter Steinberger
0c4a83f327
fix: avoid repeated cleanup work when subagents finish (#147480)
* fix: avoid repeated cleanup work when subagents finish

* fix: wake cleanup ancestors after deferred retirement

* test: complete cron registry fixture for cleanup lookup
2026-09-13 16:18:22 -07:00
Mitchell Etzel
610f6dcfef
fix(subagents): swarm collector that calls sessions_yield strands agents_wait forever (#146716)
Fix collector runs that yield without delivering a collected result.

Settle ordinary collector yields through the existing completion owner, while
preserving explicit timeout and blocked outcomes. Keep ordinary subagent
continuations unchanged and retain the original contributor's implementation.

Related: #141474

Co-authored-by: Mitchell Etzel <etzelm@live.com>
Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
2026-09-13 15:46:21 -07:00
Vincent Koc
7a168d3d4b
feat(subagents): allow private parent completion handoffs (#147206)
* feat(subagents): allow private parent completion handoffs

Add per-spawn completionTarget parent for hidden native one-shot children. Preserve exact parent ownership and private delivery through settlement and restart; record processing completion at the durable input owner so silent review and follow-up work do not require a channel message.

Co-authored-by: NickNMorty <developer@nicknmorty.ai>

* fix(subagents): resume unfinished private handoff attempts

* test(subagents): verify private media and durable stop replay

* test(subagents): prove private completion package compatibility

* fix(subagents): qualify private completion delivery contracts

* test(subagents): qualify private completion lifecycle and package transitions

* test(subagents): validate package fixture text columns

* test(subagents): exclude QA source link from backup fixture

---------

Co-authored-by: NickNMorty <developer@nicknmorty.ai>
2026-09-13 16:09:47 -06:00
Jason (Json)
8c2d6b14f3
fix(subagents): keep owned runs in activity counts (#147431)
* fix(subagents): retain current owners in activity accounting

* test: use live claims in subagent accounting fixtures
2026-09-13 16:01:16 -06:00
EricCai
da29aff743
fix(agents): retain outstanding child results in parent context (#112623)
* feat(agents): inject Recently Completed Subagents into parent prompt

The parent prompt showed only active children, so a requester whose child
had already finished saw nothing about it on later turns and could
re-spawn the same task. `buildSubagentList` already computes a `recent`
window; nothing rendered it.

Render it as a second bounded prompt block beside `Active Subagents`,
reusing the same sanitized/JSON-quoted entry formatter. The block is
capped at the newest 8 entries within the existing `recentMinutes`
window, sorted by end time so the text is deterministic across turns and
bursty sequential work cannot grow later turns without bound.

Guidance text is fixed rather than varying by entry status, so the system
prompt stays byte-stable for prompt caching.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(gateway): prove recently-completed parent prompt on an isolated gateway

Restore the category docs contract the rebuild accidentally reverted, and
record the later-parent-turn isolated-gateway verdict ClawSweeper asked for.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(agents): assemble recently-completed prompt through attempt-history

ClawSweeper rejected calling the builder from the gateway test. Drive the later parent turn through prepareEmbeddedAttemptHistory so the isolated-gateway verdict is the assembled system prompt.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(gateway): prove recently-completed block on a real parent model turn

ClawSweeper rejected helper assembly and fake session-manager doubles. Drive two parent agent.wait turns through an in-process gateway and mock OpenAI, and cite the later model request.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(gateway): keep recent-subagent proof within shard budget

* fix(agents): scope retained-result context reads

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: eric <ericstudio@ericdeMacStudio.lan>
Co-authored-by: Jason (Json) <263060202+fuller-stack-dev@users.noreply.github.com>
2026-09-13 15:20:59 -06:00
Peter Steinberger
2f663805b4
fix(agents): recover yielded subagents and preserve sidebar nesting (#146667)
* fix(agents): recover yielded subagents and preserve sidebar nesting

Defer sessions_yield until earlier async tool results have reached a subsequent model request, preventing a child from pausing before it can consume completed output.

Resume paused children through the existing adoption owner so task identity, requester, and parent completion batches survive operator follow-ups. Keep subagents beneath their expanded navigation parent even when categorized, and show their task names in activity rows.

Validation: async-yield, sessions.send recovery, lifecycle, and sidebar regressions; scoped production/test typechecks, lint, consistency checks, and independent review passed.
(cherry picked from commit 3086b77b6ce7edd25d0964b1f3559dea296e4d12)

* fix(gateway): preserve admitted follow-up task ownership

Keep plugin and settlement adoption with admission while allowing explicit operator recovery. Exercise requester preservation through dispatch and retain retryable approval handoffs on admission failure. Align the existing browser cache assertion with the fingerprinted sandbox shell from #146602.
2026-09-12 21:53:35 -07:00
RoboClaw
1319119a80
fix: clear stale subagent activity after restart cleanup (#146248)
* fix: clear stale subagent activity after restart cleanup

Settle orphaned native runs through canonical completion before cleanup, keep task-write failures retriable, and reconcile previously stranded registry-backed tasks without hiding live work.

Closes #146224

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

* test: retain the cancellation race during task settlement retries

Keep the exact failed-task write fault active until cancellation publishes its result, then release it without weakening generation, cascade, or successor assertions.

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

---------

Co-authored-by: roboclaw-bot <309084314+roboclaw-bot@users.noreply.github.com>
Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
2026-09-12 16:55:59 -04:00
Peter Steinberger
98ac734316
fix(agents): keep internal workers out of persistent sidebar sessions (#145346)
* fix(agents): keep internal workers out of persistent sidebar sessions

* test(agents): refresh subagent spawning prompt snapshots
2026-09-11 15:42:49 -07:00
Peter Steinberger
58a6953549
fix: preserve project and current task context in visible spawns (#145102)
* fix: preserve project and current task context in visible spawns

* test: inline single-use daemon install assertions
2026-09-11 10:54:02 -07:00
Peter Steinberger
32427a1856
fix: keep subagent completions on the selected conversation (#144704)
* fix: keep subagent completions on the selected conversation

* test: move subagent origin integration proof out of core

* test: isolate completion routing fixtures
2026-09-11 03:00:41 -07:00
Vincent Koc
c83277b970
docs: correct verified accuracy defects in CLI, tools, and automation pages (#143179)
* docs: correct verified accuracy defects in CLI, tools, and automation pages

Resolve the open `accuracy` audit findings for docs/cli/, docs/tools/ and
docs/automation/. Every claim was checked against the implementation before
the prose was touched; findings the source contradicted are left unchanged and
rebutted in the PR body.

Factual corrections (docs disagreed with code):

- onboard: Z.AI defaults are glm-5.3 (coding) and glm-5.2 (general), not
  glm-5.2/glm-5.1 (extensions/zai/model-definitions.ts, openclaw.plugin.json).
- sessions: the cleanup --json example printed a sessions.json store path, but
  both JSON exits map storePath through resolveSqliteTargetFromSessionStorePath
  (src/commands/sessions-cleanup.ts, src/config/sessions/cleanup-result.ts).
- diffs: `plugins install diffs` resolved to an unrelated npm package; the
  plugin is external, not bundled (extensions/diffs/package.json).
- ollama-search: a bare "OLLAMA_API_KEY" string is a literal key, not env
  indirection (src/config/types.secrets.ts).
- minimax-search: the region list contradicted its own opening condition and
  merged two tiers (extensions/minimax/src/minimax-web-search-provider.runtime.ts).
- imap: addressTokens is a per-account key (extensions/imap/src/config.ts).
- thinking: GLM-5.3 is a second Z.AI exception (extensions/zai/provider-policy-api.ts).
- video-generation: buffer-backed videoToVideo also covers fal reference-to-video
  (src/video-generation/live-test-helpers.ts).
- slash-commands: the missing third source is skill commands
  (src/auto-reply/commands-registry-list.ts).
- cron: `cron` is the registered command and `automations` its alias
  (src/cli/cron-cli/register.ts).
- setup: add the real --classic and --agent-name flags to the Options table
  (src/cli/program/register.setup.ts).
- path: file-slot wildcard rejection exits 2 (extensions/oc-path/src/cli.ts).

Version scope added only where a release could be cited: 2026.8.1 (heartbeat
task migration, inferred commitments, artifact-area staging), 2026.4.29 (owner
bootstrap), 2026.4.26 (Hunter Alpha), 2026.3.31 (nodes.run). Elsewhere the
time-relative wording is replaced with the verified current behaviour rather
than a guessed version.

* docs(swarm): keep the limits-and-roadmap anchor after the heading rename

docs/AGENTS.md requires existing published heading ids to stay stable. The
rename from 'Limits and roadmap' to 'Limits' changed the generated fragment,
so add an explicit <a id="limits-and-roadmap" /> stub above the heading.
parseDocsDocument now reports both ids with no collisions.
2026-09-09 23:57:06 +09:00
Vincent Koc
309ae03db2
docs(tools): split the Sub-agents page into an index plus seven child pages (#142999)
docs/tools/subagents.md was 54,144 characters mixing reference, how-to, and
explanation. Move each H2 block verbatim into docs/tools/subagents/ and keep
the parent as an orientation index.

Every pre-split anchor id (75 of them, including component ids minted by
Accordion, Step, and ParamField titles) is preserved as an authored stub on
the index, because redirect sources cannot carry a fragment.

Closes r3-0797.

Co-authored-by: Vincent Koc <vincent@openclaw.org>
2026-09-09 18:41:08 +09:00