Repository navigation
fix(subagents): deliver child replies that match the empty placeholder - #130647
Conversation
…splay copy Three sites in the subagent announce delivery pipeline decided control flow by comparing a completion event's `result` against the literal string `"(no output)"` — which is also the user-visible placeholder rendered into the parent's prompt. Display copy and delivery behavior were therefore the same value: rewording the placeholder silently changed whether the announce was refused as `visible_reply_missing` and retried, and a child whose own output happened to read like the placeholder was treated as having produced nothing. The sites were `subagent-announce-direct-delivery.ts` (`hasRequiredSubagentNoOutputCompletion`) and, in `subagent-announce-completion-delivery.ts`, both `hasFailedSubagentNoOutputCompletion` and the direct text fallback `resolveTextCompletionDirectFallback`. `AgentTaskCompletionInternalEvent` now carries the absence as a fact: `noVisibleResult?: boolean`, recorded by the producer that substituted the placeholder — `runSubagentAnnounceFlow`, where `childCompletionFindings || reply` is already the authoritative "did the child say anything" answer. All three branch sites read it through one total read, `hasVisibleCompletionResult` in `internal-event-contract.ts` (the leaf both the producers and the prompt formatter already depend on), so absence semantics live in exactly one documented place. The field is optional and absent on the ordinary has-output path, keeping persisted payloads and the gateway `internalEvents` request boundary byte-identical for every existing producer. Two deliberate consequences. A subagent completion whose real child output happens to equal the placeholder string is now treated as output — that is the decoupling working, not a regression. And the other two `task_completion` producers (`agent-harness-task-runtime.ts`, `media-generate-background-shared.ts`) are left unchanged: they receive `result` from their caller and cannot know the fact, so they stay on the absent default. The only behavior delta there is a harness plugin passing the literal placeholder, which now counts as content; deriving the fact from emptiness instead would newly gate empty harness results and that belongs in its own change. `result` and `noVisibleResult` are two fields a producer must keep consistent, which the repo's "make impossible states unrepresentable" guidance disfavors. The alternative — a discriminated `result` shape — breaks every consumer of `event.result` including the gateway request boundary and the plugin SDK harness surface, so the additive fact plus a single total read is the smaller correct change. Production delta is +38/-5, of which 17 lines are the mandated inline/JSDoc comments on the invariant and 4 are import-list reformatting. Tests: new `subagent-announce-completion-delivery.test.ts` unit-pins `hasFailedSubagentNoOutputCompletion` against a reworded placeholder and against a result that merely reads like one; a matched pair of boundary tests in `subagent-announce-delivery.test.ts` does the same through the real delivery path with identical inputs apart from the fact; `subagent-announce.timeout.test.ts` pins the producer both ways. All four decoupling assertions were verified to fail with the string comparisons temporarily restored, and to fail for the intended reason (gate fired/skipped opposite to the fact). Validation from the topic worktree: pnpm tsgo:core EXIT=0 pnpm tsgo:core:test EXIT=0 vitest src/agents/subagents 40 files / 1107 tests passed vitest src/agents/internal-events 1 file / 3 tests passed vitest src/plugin-sdk 80 files / 776 passed, 13 skipped vitest <new completion-delivery test> 1 file / 6 tests passed pnpm config:schema:check [base-config-schema] ok pnpm plugin-sdk:surface:check package-exported forbidden subpaths: 0 node scripts/run-oxlint.mjs <8 files> EXIT=0 oxfmt --check <8 files> All matched files use the correct format. git diff --check clean Beads: openclaw-umk4
…ent request boundary
`a232f54f718` (this branch's first commit) replaced the `"(no output)"`
control-flow sentinel with a typed fact, `noVisibleResult?: boolean`, on
`AgentTaskCompletionInternalEvent`. Its commit message claimed the change kept
"the gateway `internalEvents` request boundary byte-identical for every existing
producer." That claim is false on exactly the path the fact was introduced for.
`AgentInternalEventSchema` in `packages/gateway-protocol/src/schema/agent.ts` is
a `closedObject`, so it rejects any property it does not name. The producer
`runSubagentAnnounceFlow` sets `noVisibleResult: true` whenever the child
produced no output, and the subagent announce is delivered through the gateway
`agent` method, whose params are validated by `validateAgentParams` in
`src/gateway/server-methods/agent-run-handler.ts`. A no-output completion
therefore fails validation at the wire, on both the direct and direct-primary
delivery paths:
invalid agent params: at /internalEvents/0: unexpected property 'noVisibleResult'
The announce retries once and gives up at expiry, so a subagent that finished
successfully never reaches its requester. Observed repeatedly on a live gateway
built from this branch (runs 446ee4a6-…, 82734b05-…; one gave up with
endedAgo=1825s — the child had been done for ~30 minutes). The failure mode is
worse than a dropped message: "no completion arrived" reads as "the child died,"
so it actively produces wrong triage.
The field is a legitimate, typed, documented part of the completion event, and
the delivery gates deliberately read the fact instead of matching placeholder
copy — so it has to survive the boundary. The schema is the stale side; it gains
the field as an optional boolean. The validator is NOT loosened to accept
unknown properties: closed-object strictness is retained, one named field is
added.
Why the original gates missed it: every existing test on the no-output path
either drives the delivery helpers directly or asserts against a mocked
transport, so none of them ever ran the real compiled `validateAgentParams`
against the real params. The regression test added here closes exactly that
gap — it builds the params through the real `deliverSubagentAnnouncement` path
and then runs the same `validateAgentParams` instance the production handler
imports, reporting the validator's own message so future schema drift surfaces
as the rejected property name rather than a bare `false`.
Tests:
packages/gateway-protocol/src/schema/agent.test.ts
accepts the no-output fact a subagent completion records (schema level)
src/agents/subagents/announce/subagent-announce-delivery.test.ts
sends no-output completion agent params the gateway validator accepts
(real delivery path -> real production validator)
Both were verified to FAIL against the pre-fix schema with the exact production
error string, and to pass after.
Validation from the topic worktree:
pnpm protocol:check PASS (registry, gen, swift, kotlin, since guard,
no tracked artifact diff)
pnpm tsgo:core EXIT=0
pnpm tsgo:core:test EXIT=0
pnpm vitest run (4 announce/protocol suites)
6 project-file units / 438 tests passed
(pre-fix: 3 failed / 389 passed, delivery test
reporting the byte-exact production error)
pnpm config:schema:check ok
pnpm plugin-sdk:surface:check ok
node scripts/run-oxlint.mjs EXIT=0
git diff --check clean
pnpm check:changed EXIT=0 (full changed-file CI-equivalent gate)
Beads: openclaw-w01j
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 6:30 AM ET / 10:30 UTC (Revision 9). ClawSweeper reviewWhat this changesThe PR records whether a child result is absent, carries that fact through Gateway validation, and allows genuine Merge readiness✅ Ready for maintainer review This remains a useful fix: current main and v2026.9.4 still confuse literal child output with the empty placeholder. The prior finding is resolved, the supplied real-world proof covers the intended behavior, and no blocking patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherSubagent announcements carry completed child results back to the requesting agent. The Gateway validates these events, and completion delivery either observes the requester’s reply or uses the existing direct-message fallback. flowchart TD
A[Child terminal result] --> B[Announcement producer]
B --> C[Result text and absence fact]
C --> D[Gateway validation]
D --> E[Requester reply]
E --> F{Visible delivery confirmed?}
F -->|Yes| G[Delivery settled]
F -->|No| H[Existing fallback or retry]
C --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +28, Tests +192. Total +220 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep absence classification with the completion producer and reuse existing delivery, silence, cancellation, and requester-ownership contracts. Do we have a high-confidence way to reproduce the issue? Yes: an external child returning authoritative visible Is this the best way to solve the issue? Yes: separating result presence from display text repairs the existing owner and all three consumers without adding a parallel delivery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f50d4ce71e3e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Exact-head real-behavior proof is now complete at GPG-verified A real isolated @clawsweeper re-review Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude). |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…ible-result-fact # Conflicts: # packages/gateway-protocol/src/schema/agent.test.ts # packages/gateway-protocol/src/schema/agent.ts # src/agents/internal-events.ts # src/agents/subagents/announce/subagent-announce.timeout.test.ts # src/agents/subagents/announce/subagent-announce.ts
Current-main merge and exact-head proofCurrent upstream is now merged at signed head The five textual conflicts and one inherited semantic fixture were resolved by preserving both contracts: upstream's Exact-head evidence:
@clawsweeper re-review at exact head Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude). |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b796ab45e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…vent contract (review feedback) Addresses the one remaining actionable finding on PR openclaw#130647: [P2] Move the predicate test behind a lightweight import src/agents/subagents/announce/subagent-announce-completion-delivery.test.ts:5 The reviewer's objection was dependency shape, not behavior: importing the pure predicate `hasFailedSubagentNoOutputCompletion` from `subagent-announce-completion-delivery.ts` dragged that module's static `delivery.runtime` import chain — configuration, outbound messaging, hooks and embedded-run code — into six predicate-only test cases. What changed: - `hasFailedSubagentNoOutputCompletion` moves to `src/agents/internal-event-contract.ts`, which has no runtime imports at all, and its parameter type is widened to the structural shape the predicate actually reads (`type`/`source`/`status`/`noVisibleResult`) instead of the full `AgentInternalEvent`. - Its single production call site in `subagent-announce-direct-delivery.ts` now imports from the contract module. The literal `"task_completion"` comparison is replaced by the existing `AGENT_INTERNAL_EVENT_TYPE_TASK_COMPLETION` constant, whose value is `"task_completion"`, so the predicate is unchanged. - The six focused cases stay in `subagent-announce-completion-delivery.test.ts` — the existing path, so the core tsgo agents-root file budget is untouched — and that file's only imports are now `vitest` and `../../internal-event-contract.js`. Five cases are consolidated into an `it.each` table; the absent/empty-list case remains separate. All six assertions are preserved. Behavior is identical: same predicate logic, same single call site, no schema or wire change. This commit is a dependency-boundary and test-placement repair. Validation on this tree (every log ends in an explicit terminal EXIT marker, because a gate log without one is not a result): pnpm install --frozen-lockfile INSTALL_EXIT=0 git diff --check / --cached --check DIFFCHECK_EXIT=0 focused predicate suite (1 file / 6 tests) PLACEMENT_EXIT=0 focused sibling suites (5 files / 324 tests) FOCUSED_EXIT=0 check:changed --base origin/main (10 paths, 30 lanes, 30/30 ok, 0 failed) GATE_EXIT=0 base config schema --check SCHEMA_EXIT=0 plugin-sdk surface --check SDK_EXIT=0 deadcode unused-files (production + full tree, 0 entries each) UNUSED_EXIT=0 pnpm build (5m14s) BUILD_EXIT=0 cold-cache pnpm tsgo:core COLDTSGO_CORE_EXIT=0 cold-cache pnpm tsgo:core:test COLDTSGO_CORE_TEST_EXIT=0 Beads: openclaw-y816 Co-Authored-By: Claude Opus 5 <[email protected]>
|
Round on head [P2] Move the predicate test behind a lightweight import —
|
Carry producer-owned absence through the strict event boundary so literal child output can use the existing direct fallback. Preserve the contributor history and pinned baseline while adding the literal producer regression.
|
landpr-approve-unrelated-red |
|
Thanks @zeroaltitude! Proof: A real Telegram Test Server requester used public
All 354 focused tests passed. Independent behavior acceptance and exact-head source review passed within the recorded limits: blank success and cancellation keep intentional non-delivery, and active wake proves requester handoff only. The two fixture expectation timeouts remain recorded. Unknown event fields and non-boolean absence values remain rejected. CI: Run 34589072622, attempt 1 completed with all 159 jobs terminal. Hosted build, type checks, lint, and the other selected groups passed. The guarded unrelated-failure exception covered exactly these two setup failures:
Both failed before project tests when the unchanged Matrix crypto 0.6.6 postinstall download returned HTTP 500. Its existing Standing approval: #130647 (comment). No CI rerun was used. Contributor credit and Ayaan's co-author credit are preserved. |
Preserve the reviewed harness while incorporating the landed benchmark prerequisite. Punchcard-Session: coral-orchard-orchard-d4 * commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits) fix(perf): isolate benchmark subprocess transport (#144159) refactor(auth): await Copilot cache persistence (#144810) refactor(web-fetch): exercise URL normalization through the public tool (#144887) fix(ollama): preserve hosted subdomain model context (#144891) fix(doctor): explain Codex plugin health failures (#144813) fix(channels): honor pinned accounts in Mattermost model menus (#144880) fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729) fix(logging): preserve OpenClaw package references in diagnostics (#144808) fix: retain plugin detail tab selections while inspection loads (#144647) fix: keep discovered models when sign-in tokens renew (#144861) fix(update): preserve local package overrides (#89985) fix(update): resolve compatibility bridges within the runtime graph (#144831) chore(i18n): refresh native locales (#144856) fix: preserve child signal termination during CLI respawn (#144838) fix(text): hide encoded MiniMax tool envelopes (#126307) fix(subagents): deliver child replies that match the empty placeholder (#130647) fix(cli): reject blank message channel selectors (#144802) fix(telegram): preserve mixed text order and pending stop (#144839) fix(memory): restore FTS fallback for same-name view collisions (#144783) chore(release): close out 2026.9.4 on main (#144708) ...
openclaw#130647) ## What Problem This Solves Fixes an issue where users could miss a finished external child agent's reply when its exact text was `(no output)`. The result could remain in delivery retries after the requester produced no separate visible reply. ## Why This Change Was Made The completion producer records whether it inserted placeholder text for an absent result. The existing strict Gateway schema carries that optional boolean, and all three delivery decisions read the recorded fact. The failed-child predicate lives in the lightweight event contract. The embedded runtime's display sanitizer and requester-yield ownership stay unchanged. ## User Impact The existing direct fallback delivers genuine child text that matches the placeholder. Explicit silent results retain their missing-deliverable handling. Successful blank results retain their existing intentional non-delivery. ## Evidence A real Telegram Test Server direct-message requester used public `sessions_spawn` with an external child through the Agent Client Protocol (ACP). The same deterministic protocol peer, requester responses, and delivery route were exercised on pinned baseline `d47b47789b0fbbc23bdef6431f1144d6c0d9315c` and the repaired source. | Baseline | Repaired source | | --- | --- | | Child completed with authoritative visible `(no output)`; no child reply reached Telegram; delivery remained pending and retryable. | Telegram received `(no output)` once; the child delivery state became delivered. | - A normal child-text control reached Telegram and settled on baseline. - The real Gateway rejected an unknown event property and a non-boolean `noVisibleResult`; valid true and false values reached successful terminal runs. - Independent validation exercised nine real child cases. It confirmed literal delivery, explicit silence, normal and optional results, failures, timeouts, cancellation, and clarified blank success. Active wake proved requester handoff only; no child Telegram delivery is claimed for that case. The two preserved fixture timeouts waited for completion events on intentional blank/cancelled paths. - All 354 focused tests passed. The two display/fact comparison regressions failed in opposite directions on baseline. - Formatting, syntax lint, line-size and assertion ratchets, and the core graph boundary check passed on the native execution host. Full type checks and CI remain hosted. - Run-owned messages were deleted using their original account-specific receipts; credential leases, processes, and listeners were cleaned. The earlier embedded-runtime literal attempt exercised intentional display sanitation and automatic requester yielding. It is retained as contrary evidence and is not the baseline reproduction. The schema-rejection incident in the original description concerned an intermediate contributor revision, not the admitted baseline. Finite observations establish retries, not elapsed hard expiry. Thanks to @zeroaltitude for the fix and regression coverage. Private raw evidence is retained with account and infrastructure details withheld from publication. Co-authored-by: Ayaan Zaidi <[email protected]>
…tale upstream copies Ports 14 fork test files to the merged code: the session controller (openclaw#175837) replaces the reply-run registry and chat-abort types; the delivery-runtime option is isSessionRunActive; persistence restarts go through activateSubagentPersistenceRegistry; the rollback scope reads row run ids (write.versions removed, 3f22cf5); a restored completion announces under its saved operator source (37d210e), so the continuation-return fixture saves one; session-fork awaits clearReplacedSessionRuntimeState; compact hooks publish a runtime config snapshot per test. completion-contract drops two copies of upstream tests whose asserted mechanism upstream retired; upstream's current versions are in the merged subagent-announce-delivery.test.ts: - "keeps synthetic missing output on the generic retry path" (openclaw#135846) was renamed by openclaw#130647 and rewritten without completion steering by openclaw#175837; the fork copy was the 09-12 substrate restore's resurrection. - "gates a reworded no-visible-result placeholder for channel completions" was the fork's automatic-mode restore (bcd8ff7) of a pair upstream folded into its message-tool-only regression (e15fa0b); openclaw#170534 then changed the NO_REPLY payload semantics it relied on. The retired queue-outcome dependency the first one needed goes with it. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Fixes an issue where users could miss a finished external child agent's reply when its exact text was
(no output). The result could remain in delivery retries after the requester produced no separate visible reply.Why This Change Was Made
The completion producer records whether it inserted placeholder text for an absent result. The existing strict Gateway schema carries that optional boolean, and all three delivery decisions read the recorded fact.
The failed-child predicate lives in the lightweight event contract. The embedded runtime's display sanitizer and requester-yield ownership stay unchanged.
User Impact
The existing direct fallback delivers genuine child text that matches the placeholder. Explicit silent results retain their missing-deliverable handling. Successful blank results retain their existing intentional non-delivery.
Evidence
A real Telegram Test Server direct-message requester used public
sessions_spawnwith an external child through the Agent Client Protocol (ACP). The same deterministic protocol peer, requester responses, and delivery route were exercised on pinned baseline1fc55c8d17c589e4c83919b065b693781dd2f1deand the repaired source.(no output); no child reply reached Telegram; delivery remained pending and retryable.(no output)once; the child delivery state became delivered.noVisibleResult; valid true and false values reached successful terminal runs.The earlier embedded-runtime literal attempt exercised intentional display sanitation and automatic requester yielding. It is retained as contrary evidence and is not the baseline reproduction. The schema-rejection incident in the original description concerned an intermediate contributor revision, not the admitted baseline. Finite observations establish retries, not elapsed hard expiry.
Thanks to @zeroaltitude for the fix and regression coverage. Private raw evidence is retained with account and infrastructure details withheld from publication.