Skip to content

fix(agents): deliver complete subagent answers to waiting parents - #149223

Merged
obviyus merged 13 commits into
mainfrom
bugloop/subagent-announce-complete-result
Sep 15, 2026
Merged

obviyus merged 13 commits into
mainfrom
bugloop/subagent-announce-complete-result

Conversation

@obviyus

@obviyus obviyus commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

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 and run-entry.test.ts:928–931. 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.

Before After
Missing field Complete field

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).

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 15, 2026, 3:06 PM ET / 19:06 UTC (Revision 5).

ClawSweeper review

What this changes

Delivers complete child answers from active or archived transcripts to waiting parents, preserves each child’s own conclusion, and marks incomplete results when retention has removed the original answer.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful, proof-backed fix for incomplete parent answers. The earlier archive-decoding and retention blockers are addressed, and this review found no new blocking correctness defect.

Priority: P1
Reviewed head: 18d1265de54fb7986f73b197d92ec898f001cb78
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A solid repair with convincing behavior proof and addressed prior findings; the remaining landing question concerns acceptance of the intentional context-budget tradeoff.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.
Evidence reviewed 11 items Introduced changes and review continuity: The checkout matches the pinned PR head. Compared with the previous reviewed head, the only changes are four explicit session-accessor mock additions; production behavior is unchanged.
Still necessary on current main: Fetched main retains the 512-character child-result projection and the 6,000-character event and steering projections. The central truncation problem therefore remains outside this branch.
Latest release retains truncation: The v2026.9.4 source still declares the 512-character per-child and 4,096-character aggregate limits and applies them in completion formatting.
Findings None None.
Security None None.

How this fits together

Subagent completion delivery carries finished child work back into the parent agent’s next model request. It reads retained session transcripts, checks the selected run, and prepares either an immediate completion event or a queued result.

flowchart TD
  A[Child finishes work] --> B[Completion delivery]
  C[Active transcript] --> B
  D[Registered archive] --> B
  B --> E{Exact answer retained?}
  E -->|Yes| F[Complete escaped answer]
  E -->|No| G[Marked retained snapshot]
  F --> H[Parent model request]
  G --> H
Loading

Decision needed

Question Recommendation
Does the recorded September 15 owner acceptance cover delivering whole answers when they can exceed the parent model’s available context? Confirm the existing acceptance: Confirm that complete inline delivery and its larger-context tradeoff are covered by the recorded owner decision.

Why: The branch intentionally replaces shipped context protections; the proof establishes complete delivery at the demonstrated sizes but cannot establish the owner’s tolerance for larger inputs.

Before merge

  • Resolve merge risk (P1) - Removing the shipped projection caps permits a complete answer or settled batch to exceed the parent model’s available context; the inspected proof does not establish recovery for that extreme. The body records owner acceptance, but that decision’s scope was not independently verified.
  • Complete next step (P2) - Confirm that the recorded owner acceptance covers complete inline answers exceeding the parent’s available context.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +422, Tests +1715, Docs +15. Total +2152 across 41 files.

View PR surface stats
Area Files Added Removed Net
Source 18 851 429 +422
Tests 22 1924 209 +1715
Docs 1 15 0 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 41 2790 638 +2152

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +422 lines; tests and test support +1,715 lines The body justifies production growth through exact-run reading and streamed archive access; most net growth supplies regression coverage.
Completion budget change 512- and 6,000-character item caps removed; 4,096-character aggregate cap removed This intentionally favors complete parent input over the previous fixed projection budgets.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #138555
Summary: This PR is the explicit implementation candidate for the reported requester-settle truncation; the issue remains open until a fix lands.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm full-answer delivery acceptance (recommended)
    Accept the documented larger-context tradeoff through the existing owner decision while retaining complete answers and visible retention-loss markers.
  2. Hold for context-overflow recovery
    Pause landing if complete inline delivery must also guarantee progress when the answer exceeds the parent model’s context.

Technical review

Best possible solution:

Keep complete answers within the existing transcript and delivery owners, retain explicit retention-loss markers, and make the accepted parent-context tradeoff clear.

Do we have a high-confidence way to reproduce the issue?

Yes: spawn a child whose answer contains a required tail beyond 512 escaped characters, then yield the parent. Current main and release source enforce that truncation; the supplied before/after capture demonstrates the failure and correction, though this review did not execute it.

Is this the best way to solve the issue?

Yes, subject to the documented context tradeoff: reading the existing exact-run transcript avoids a second durable result store, and the marked fallback preserves parent progress after pruning.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fcb4d12acda7.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The linked report establishes required answer fields being lost before a waiting parent processes successful child work.
  • merge-risk: 🚨 availability: Whole-answer delivery removes shipped context limits and can exceed a parent model’s available input budget.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after Chat captures and the linked isolated-Gateway scenario exercise child spawn, parent yield, complete-answer delivery, and retained history after deletion through the changed completion path. The required field is absent before and present after; registered retention and continuation regressions provide supplemental coverage.

Evidence

What I checked:

  • Introduced changes and review continuity: The checkout matches the pinned PR head. Compared with the previous reviewed head, the only changes are four explicit session-accessor mock additions; production behavior is unchanged. (18d1265de54f)
  • Still necessary on current main: Fetched main retains the 512-character child-result projection and the 6,000-character event and steering projections. The central truncation problem therefore remains outside this branch. (src/agents/subagents/announce/subagent-announce-output.ts:40, fcb4d12acda7)
  • Latest release retains truncation: The v2026.9.4 source still declares the 512-character per-child and 4,096-character aggregate limits and applies them in completion formatting. (src/agents/subagents/announce/subagent-announce-output.ts:36, 3a9d69db306c)
  • Exact-run result ownership: The reader selects terminal visible assistant text for the recorded run, excludes non-final message-tool mirrors and silent replies, checks source identity after asynchronous reads, and returns a marked snapshot when the answer is unavailable. It does not rewrite lifecycle evidence. (src/agents/subagents/announce/subagent-announce-result.ts:77, 18d1265de54f)
  • Earlier archive blocker addressed: Archive decoding now streams lines inside the existing serialized worker. Registered hash, session header, logical owner, and exact-run checks remain; no schema or archive-retention change appears in the introduced diff. (src/config/sessions/session-accessor.sqlite-archive-read.ts:56, 18d1265de54f)
  • Earlier parent-progress blocker addressed: The registered retention regression publishes and prunes a real archive, supplies a healthy sibling and an unrelated replacement session, then checks the marked fallback, complete sibling answer, cleared leases, and successful next parent turn. These tests were inspected, not executed during this read-only review. (src/agents/embedded-agent-runner/run/attempt-prompt-submit.retention.test.ts:99, 18d1265de54f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-15T15:47:16.035Z sha d9ae977 :: blocked before merge. :: [P2] Stream archived result lookup instead of decoding the whole transcript
  • reviewed 2026-09-15T16:49:45.645Z sha a97d75a :: blocked before merge. :: [P1] Keep an unavailable child result from aborting every parent turn
  • reviewed 2026-09-15T17:37:46.037Z sha c5b5e2e :: blocked before merge. :: [P1] Keep an unavailable child result from aborting every parent turn
  • reviewed 2026-09-15T18:16:23.111Z sha 1fedcd7 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 15, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 15, 2026
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 149223
head: c5b5e2e
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 15, 2026 17:18
@kvnloo

kvnloo commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Pre-merge finding: concurrent parent read vs formatter / identity cleanup still has no lost-field fixture

Confirmed on head c5b5e2efda8edcb77c67110c09b7e75c7504c756 (re-fetched; sampled d9ae97706287 is not this revision).

Waiting parents are supposed to see the complete exact-run answer, including required escaped tails, even when announce formatting and identity cleanup overlap the parent read. On this head that overlap is not pinned.

readChildCompletionFindings fans out with Promise.all then formats (src/agents/subagents/announce/subagent-announce-output.ts). The registered concurrent cases either reject identity change (subagent-announce-result.test.ts) or only assert wake/routing. Sequential tails (required-tail, required-source-tail, complete answer tail, …) stay green without starting the parent read while formatter/delete-identity is still in flight.

Please name one concrete lost-field fixture in Evidence — the parent-visible payload that dropped a required tail when the parent read overlapped formatter finish or identity cleanup — and register a test that holds that overlap and still expects the escaped tail present.

Live validation

Local on c5b5e2efda8edcb77c67110c09b7e75c7504c756:

  • announce suites: 147 passed
  • format e2e: 91 passed
  • prompt/steering: 54 passed
  • internal-events 13 + steering-queue 21
  • sqlite suites: 24 passed
    All exit 0. None held formatter/identity cleanup in flight and then asserted a required field still present on the parent-visible payload.

Ask (design, light):

  1. Overlap contract: wait for format + deliver complete tail, or keep fail-closed identity reject?
  2. After this head retires assertSteeringCurrent post-first-stream, must the first delivered complete answer remain authority?

@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 149223
head: 1fedcd7
scope: owner-review

@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 149223
head: 18d1265
scope: owner-review

@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-unrelated-red
pr: 149223
head: 18d1265
run: 35010837098 attempt: 1
failed: check-lint job=104522348179 conclusion=failure
check: openclaw/ci-gate

@obviyus
obviyus merged commit 31172cf into main Sep 15, 2026
197 of 201 checks passed
@obviyus
obviyus deleted the bugloop/subagent-announce-complete-result branch September 15, 2026 20:36
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @aleps001!

Proof: A long child answer reaches the waiting parent complete, remains available in parent history after child cleanup, and supports the visible required field. Public nested completion carries the middle child's own conclusion.

  • Bug: Completed child answers lost required content before their parent could use it.
  • Fix: Announcements and deferred parent input carry complete answers from the exact child run. If retention has removed that answer, the parent receives the marked retained snapshot and can continue.
Before After
The parent received a truncation marker and missed the required field. The parent receives the complete escaped answer and reports the required field.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…enclaw#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 openclaw#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 openclaw#119731 and openclaw#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](https://github.com/openclaw/openclaw/blob/a97d75a928ed8f5a9f70ee7977da8e767d03acea/src/agents/embedded-agent-runner/run-entry-terminal.ts#L153) and [run-entry.test.ts:928–931](https://github.com/openclaw/openclaw/blob/a97d75a928ed8f5a9f70ee7977da8e767d03acea/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 <[email protected]>
obviyus added a commit that referenced this pull request Sep 17, 2026
…150128)

Model resolution, both spawn paths, catalog publication, aliases, and Doctor change together so unsupported selections cannot bypass the shared decision. Most added lines are regression tests.

## What Problem This Solves

A saved `Grok → xai/auto` alias could create a child that the native API rejected. A custom provider name could also make retired native `auto` appear usable in the picker. Provider recognition and an endpoint URL were being treated as model support. Refs #115617, #142136.

## Why This Change Was Made

Spawn and prepared aliases use the existing model resolver. Catalog publication and Doctor consume the same compiled retirement rules for the selected route. The catalog uses main's shared projection owner from #150509. Prepared aliases have one writer; Doctor keeps its existing config and session writers.

## User Impact

Unsupported explicit choices fail before child creation with recovery guidance. Automatic choices retain their primary and fallback order. Picker views omit known retired routes; the admin inventory retains saved definitions. Custom endpoints and logical provider/account choices remain intact.

## Compatibility

Native IDs need a definition, catalog support, or provider-owned resolution. This deliberately replaces #125931's endpoint-only inference: previously accepted unlisted native IDs need explicit definitions when their provider cannot resolve them. Custom/local endpoints, authored private models, and models supplied by native runtimes remain supported. Doctor repairs known retirements, preserves account pins and allowlists, and retains unresolved choices with guidance. It does not invent definitions for unverified IDs. No new configuration keys, schema, or protocol changes.

## Evidence

- The real Gateway regression fails with the browse filter removed and passes with it restored: retired native `personal/auto` disappears, while custom endpoint and admin inventory controls remain intact. Command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/server.models-native-retirement.test.ts`.
- Final package `08e2f6002888` passed upgrades driven by published 2026.9.3 and 2026.9.4, followed by candidate startup and existing/new/custom conversations. Both preserved the seven original transcript events. All 26 Doctor commands passed, including repeated repair, logical native aliases, custom models, account pins, and allowlists.
- Both upgraded fixtures passed all 10 Telegram Test Server controls: retired/unknown rejection, native/custom/friendly-alias completion, and correct picker buttons. The previously missing 2026.9.3 custom-model reply is now observed.
- Four final-build Gateway cases passed: native account/history continuity, saved-token selection, a new reply across a 60-second process freeze, and recovery after a settled failure. Each matched exactly one intended test and left no child processes.
- Source coverage includes 172 model/Doctor/Gateway tests, 220 affected fixture tests, and focused delivery, hook, lifecycle, and compaction checks; these counts overlap. Production/test types, lint, formatting, size limits, assertion limits, exports, architecture, and test registration checks passed.

Limits: updater tests use `--no-restart` followed by separate candidate startup. The first 2026.9.3 update hit its shipped 30-second package-scan limit; the retained installation was verified intact, and one normal retry after a measured 11-second scan succeeded. Telegram uses the real Test Server with local model fixtures. An extra final-package fallback run completed through the Gateway and Telegram accepted its sends, but the recorder timed out before capturing user-side receipt; that run is not counted as passed. Earlier `b12d66a91bc1` fallback runs retain their original identity and successful observations.

## Consumers

Visible/background spawn, prompt aliases, model materialization, picker publication, and Doctor use the shared support facts. No public SDK contract changes.

## Invalidation

Existing config, catalog, account, and plugin owners control freshness. Alias hints belong to the prepared turn snapshot. Admission rechecks freshness after asynchronous resolution.

## Tests

Coverage includes native/custom/private models, selected routes, namespace identity, pins, fallback order, stale generations, and repeated Doctor repair. A separate follow-up answer defect from #149223 remains behind #126263's task-ownership prerequisite; its assertion remains active and this PR does not claim to fix it.

## Screenshots

Packaged comparison at `b12d66a91bc1`: native Personal Auto is removed, while custom Private Auto remains.

| Before | After |
| --- | --- |
| ![Before: native Auto is selectable](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/86ad7e678f0160bdc9fc4809b7e2e930750f12bf/retirement-before-8afb413.png) | ![After: native Auto is removed and custom Auto remains](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/86ad7e678f0160bdc9fc4809b7e2e930750f12bf/retirement-after-b12d66a.png) |

Final-package model-list responses match both pictured comparisons. The native metadata remains readable: model name, 1M context, and Medium thinking.

| Before | After |
| --- | --- |
| ![Before model picker](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/ce7158ba21ac5a4e9bf4d592febf86647bcbd899/before-picker.png) | ![After model picker](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/a4053b9fb3e81d74ecd505cbf7041a10c827fa98/after-picker.png) |

<details>
<summary>Production changes: +705 lines</summary>

The added code implements shared admission, native alias support, and Doctor repair. It adds no state manager or configuration surface.

| File | Net | Responsibility |
| --- | ---: | --- |
| `cli-runner/helpers.ts` | +4 | Pass prepared aliases |
| `cli-runner/prepare.ts` | 0 | Use async prompt preparation |
| `cli-runner/prompt-context.ts` | +33 | Capture the existing prepared owner |
| `model.configured-fallback.ts` | +10 | Apply shared support rules |
| `model.configured-overrides.ts` | +60 | Validate selected transport support |
| `model.provider-hooks.ts` | -55 | Defer hook binding through the existing resolver |
| `model.provider-hooks.types.ts` | +31 | Keep existing hook types separate |
| `model.provider-transport.ts` | +35 | Relocate existing transport resolution |
| `model.registry-resolution.ts` | -40 | Remove competing resolution paths |
| `model.static-catalog-row.ts` | +36 | Relocate existing row conversion |
| `model.static-catalog.ts` | +64 | Reuse canonical native metadata |
| `model.static-catalog.types.ts` | +2 | Keep donor facts in the existing cache |
| `model.ts` | +13 | Share resolution and recovery errors |
| `prepared-compaction-runtime.ts` | +1 | Pass prepared aliases |
| `attempt-system-prompt-prepare.ts` | +1 | Pass prepared aliases |
| `model-catalog-visibility.ts` | +20 | Filter retirement after route projection |
| `model-runtime-choice.ts` | +224 | Share admission across spawn paths |
| `openclaw-tools.ts` | 0 | Use current session configuration |
| `prepared-model-runtime.configured-completion.ts` | +88 | Prepare aliases without inventing catalog rows |
| `prepared-model-runtime.full-catalog.ts` | +9 | Publish captured alias facts |
| `prepared-model-runtime.types.ts` | +2 | Represent derived alias facts |
| `materialize-model.ts` | +4 | Share final route validation |
| `subagent-spawn-child-plan.ts` | -96 | Remove separate admission checks |
| `subagent-spawn-deps.ts` | -3 | Remove obsolete dependency surface |
| `subagent-spawn-plan.ts` | +42 | Consume shared admission |
| `subagent-spawn.runtime.ts` | -1 | Remove obsolete argument |
| `system-prompt-config.ts` | -2 | Render supplied facts only |
| `sessions-spawn-visible.ts` | 0 | Use common async admission |
| `commands-models.ts` | -4 | Use captured retirement metadata |
| `commands-system-prompt.ts` | +8 | Capture prompt facts before rendering |
| `model-runtime-normalization.ts` | +9 | Relocate existing normalization |
| `codex-route-session-repair.ts` | 0 | Use the session repair module |
| `retired-model-ref-repair.ts` | +8 | Use selected-route retirement policy |
| `retired-session-model-repair.ts` | +59 | Relocate existing session repair |
| `models-list-result.ts` | +1 | Pass captured metadata |
| `manifest-model-suppression.ts` | +136 | Compile native retirement policy once |
| `manifest-model-suppression.types.ts` | +6 | Carry effective route facts |

</details>

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…penclaw#150128)

Model resolution, both spawn paths, catalog publication, aliases, and Doctor change together so unsupported selections cannot bypass the shared decision. Most added lines are regression tests.

## What Problem This Solves

A saved `Grok → xai/auto` alias could create a child that the native API rejected. A custom provider name could also make retired native `auto` appear usable in the picker. Provider recognition and an endpoint URL were being treated as model support. Refs openclaw#115617, openclaw#142136.

## Why This Change Was Made

Spawn and prepared aliases use the existing model resolver. Catalog publication and Doctor consume the same compiled retirement rules for the selected route. The catalog uses main's shared projection owner from openclaw#150509. Prepared aliases have one writer; Doctor keeps its existing config and session writers.

## User Impact

Unsupported explicit choices fail before child creation with recovery guidance. Automatic choices retain their primary and fallback order. Picker views omit known retired routes; the admin inventory retains saved definitions. Custom endpoints and logical provider/account choices remain intact.

## Compatibility

Native IDs need a definition, catalog support, or provider-owned resolution. This deliberately replaces openclaw#125931's endpoint-only inference: previously accepted unlisted native IDs need explicit definitions when their provider cannot resolve them. Custom/local endpoints, authored private models, and models supplied by native runtimes remain supported. Doctor repairs known retirements, preserves account pins and allowlists, and retains unresolved choices with guidance. It does not invent definitions for unverified IDs. No new configuration keys, schema, or protocol changes.

## Evidence

- The real Gateway regression fails with the browse filter removed and passes with it restored: retired native `personal/auto` disappears, while custom endpoint and admin inventory controls remain intact. Command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/server.models-native-retirement.test.ts`.
- Final package `08e2f6002888` passed upgrades driven by published 2026.9.3 and 2026.9.4, followed by candidate startup and existing/new/custom conversations. Both preserved the seven original transcript events. All 26 Doctor commands passed, including repeated repair, logical native aliases, custom models, account pins, and allowlists.
- Both upgraded fixtures passed all 10 Telegram Test Server controls: retired/unknown rejection, native/custom/friendly-alias completion, and correct picker buttons. The previously missing 2026.9.3 custom-model reply is now observed.
- Four final-build Gateway cases passed: native account/history continuity, saved-token selection, a new reply across a 60-second process freeze, and recovery after a settled failure. Each matched exactly one intended test and left no child processes.
- Source coverage includes 172 model/Doctor/Gateway tests, 220 affected fixture tests, and focused delivery, hook, lifecycle, and compaction checks; these counts overlap. Production/test types, lint, formatting, size limits, assertion limits, exports, architecture, and test registration checks passed.

Limits: updater tests use `--no-restart` followed by separate candidate startup. The first 2026.9.3 update hit its shipped 30-second package-scan limit; the retained installation was verified intact, and one normal retry after a measured 11-second scan succeeded. Telegram uses the real Test Server with local model fixtures. An extra final-package fallback run completed through the Gateway and Telegram accepted its sends, but the recorder timed out before capturing user-side receipt; that run is not counted as passed. Earlier `b12d66a91bc1` fallback runs retain their original identity and successful observations.

## Consumers

Visible/background spawn, prompt aliases, model materialization, picker publication, and Doctor use the shared support facts. No public SDK contract changes.

## Invalidation

Existing config, catalog, account, and plugin owners control freshness. Alias hints belong to the prepared turn snapshot. Admission rechecks freshness after asynchronous resolution.

## Tests

Coverage includes native/custom/private models, selected routes, namespace identity, pins, fallback order, stale generations, and repeated Doctor repair. A separate follow-up answer defect from openclaw#149223 remains behind openclaw#126263's task-ownership prerequisite; its assertion remains active and this PR does not claim to fix it.

## Screenshots

Packaged comparison at `b12d66a91bc1`: native Personal Auto is removed, while custom Private Auto remains.

| Before | After |
| --- | --- |
| ![Before: native Auto is selectable](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/86ad7e678f0160bdc9fc4809b7e2e930750f12bf/retirement-before-8afb413.png) | ![After: native Auto is removed and custom Auto remains](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/86ad7e678f0160bdc9fc4809b7e2e930750f12bf/retirement-after-b12d66a.png) |

Final-package model-list responses match both pictured comparisons. The native metadata remains readable: model name, 1M context, and Medium thinking.

| Before | After |
| --- | --- |
| ![Before model picker](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/ce7158ba21ac5a4e9bf4d592febf86647bcbd899/before-picker.png) | ![After model picker](https://gist.githubusercontent.com/obviyus/edbedb48d37b680d54f2047d457376e2/raw/a4053b9fb3e81d74ecd505cbf7041a10c827fa98/after-picker.png) |

<details>
<summary>Production changes: +705 lines</summary>

The added code implements shared admission, native alias support, and Doctor repair. It adds no state manager or configuration surface.

| File | Net | Responsibility |
| --- | ---: | --- |
| `cli-runner/helpers.ts` | +4 | Pass prepared aliases |
| `cli-runner/prepare.ts` | 0 | Use async prompt preparation |
| `cli-runner/prompt-context.ts` | +33 | Capture the existing prepared owner |
| `model.configured-fallback.ts` | +10 | Apply shared support rules |
| `model.configured-overrides.ts` | +60 | Validate selected transport support |
| `model.provider-hooks.ts` | -55 | Defer hook binding through the existing resolver |
| `model.provider-hooks.types.ts` | +31 | Keep existing hook types separate |
| `model.provider-transport.ts` | +35 | Relocate existing transport resolution |
| `model.registry-resolution.ts` | -40 | Remove competing resolution paths |
| `model.static-catalog-row.ts` | +36 | Relocate existing row conversion |
| `model.static-catalog.ts` | +64 | Reuse canonical native metadata |
| `model.static-catalog.types.ts` | +2 | Keep donor facts in the existing cache |
| `model.ts` | +13 | Share resolution and recovery errors |
| `prepared-compaction-runtime.ts` | +1 | Pass prepared aliases |
| `attempt-system-prompt-prepare.ts` | +1 | Pass prepared aliases |
| `model-catalog-visibility.ts` | +20 | Filter retirement after route projection |
| `model-runtime-choice.ts` | +224 | Share admission across spawn paths |
| `openclaw-tools.ts` | 0 | Use current session configuration |
| `prepared-model-runtime.configured-completion.ts` | +88 | Prepare aliases without inventing catalog rows |
| `prepared-model-runtime.full-catalog.ts` | +9 | Publish captured alias facts |
| `prepared-model-runtime.types.ts` | +2 | Represent derived alias facts |
| `materialize-model.ts` | +4 | Share final route validation |
| `subagent-spawn-child-plan.ts` | -96 | Remove separate admission checks |
| `subagent-spawn-deps.ts` | -3 | Remove obsolete dependency surface |
| `subagent-spawn-plan.ts` | +42 | Consume shared admission |
| `subagent-spawn.runtime.ts` | -1 | Remove obsolete argument |
| `system-prompt-config.ts` | -2 | Render supplied facts only |
| `sessions-spawn-visible.ts` | 0 | Use common async admission |
| `commands-models.ts` | -4 | Use captured retirement metadata |
| `commands-system-prompt.ts` | +8 | Capture prompt facts before rendering |
| `model-runtime-normalization.ts` | +9 | Relocate existing normalization |
| `codex-route-session-repair.ts` | 0 | Use the session repair module |
| `retired-model-ref-repair.ts` | +8 | Use selected-route retirement policy |
| `retired-session-model-repair.ts` | +59 | Relocate existing session repair |
| `models-list-result.ts` | +1 | Pass captured metadata |
| `manifest-model-suppression.ts` | +136 | Compile native retirement policy once |
| `manifest-model-suppression.types.ts` | +6 | Carry effective route facts |

</details>

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: requester-settle truncates child completion to 512 chars before parent processing

2 participants