Skip to content

fix(subagents): deliver child replies that match the empty placeholder - #130647

Merged
obviyus merged 10 commits into
openclaw:mainfrom
zeroaltitude:fix/subagent-no-visible-result-fact
Sep 11, 2026
Merged

obviyus merged 10 commits into
openclaw:mainfrom
zeroaltitude:fix/subagent-no-visible-result-fact

Conversation

@zeroaltitude

@zeroaltitude zeroaltitude commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

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 1fc55c8d17c589e4c83919b065b693781dd2f1de 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.

…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
@clawsweeper

clawsweeper Bot commented Aug 27, 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 app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: M labels Aug 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 6:30 AM ET / 10:30 UTC (Revision 9).

ClawSweeper review

What this changes

The PR records whether a child result is absent, carries that fact through Gateway validation, and allows genuine (no output) replies through the existing delivery fallback.

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
Reviewed head: 0d065644f1f0ab7db84f2f11e5612fa884e9526b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and relevant real-channel before/after evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied before/after Telegram Test Server observations exercise public spawning, the announcement producer, Gateway validation, and direct fallback: literal child text changes from pending retries to one delivered message. Silence and blank-result controls are distinguished from requester handoff; private raw traces were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied before/after Telegram Test Server observations exercise public spawning, the announcement producer, Gateway validation, and direct fallback: literal child text changes from pending retries to one delivered message. Silence and blank-result controls are distinguished from requester handoff; private raw traces were not independently inspected.
Evidence reviewed 9 items Current main still contains the defect: The direct fallback explicitly excludes result text equal to (no output), and the failed-child predicate also infers absence from that string.
Latest release retains the same exclusion: Inspection of the supplied v2026.9.4 release commit shows the same literal-string exclusion; this fix is not present in that release.
Producer owns the absence decision: The announcement producer records noVisibleResult only when substituting the placeholder. Literal visible text remains intact, while delivery consumers use the recorded boolean.
Findings None None.
Security None None.

How this fits together

Subagent 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +28, Tests +192. Total +220 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 6 47 19 +28
Tests 4 205 13 +192
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 252 32 +220

Review metrics

Metric Value Why it matters
Completion-event contract 1 optional boolean; 0 new configuration options The producer and strict Gateway schema carry the same absence fact without adding operator settings.

Technical review

Best 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 (no output) reaches a current-main fallback that explicitly rejects that text. The supplied baseline Telegram observations corroborate this path; this review did not execute it.

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.

Labels

Label justifications:

  • P2: This fixes a narrow, source-supported child-reply delivery failure triggered by placeholder-shaped text.
  • 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 (live_output): The supplied before/after Telegram Test Server observations exercise public spawning, the announcement producer, Gateway validation, and direct fallback: literal child text changes from pending retries to one delivered message. Silence and blank-result controls are distinguished from requester handoff; private raw traces were not independently inspected.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after Telegram Test Server observations exercise public spawning, the announcement producer, Gateway validation, and direct fallback: literal child text changes from pending retries to one delivered message. Silence and blank-result controls are distinguished from requester handoff; private raw traces were not independently inspected.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Literal child-reply delivery is visible in Telegram, and the supplied Test Server evidence already covers it.

Evidence

What I checked:

  • Current main still contains the defect: The direct fallback explicitly excludes result text equal to (no output), and the failed-child predicate also infers absence from that string. (src/agents/subagents/announce/subagent-announce-completion-delivery.ts:74, f50d4ce71e3e)
  • Latest release retains the same exclusion: Inspection of the supplied v2026.9.4 release commit shows the same literal-string exclusion; this fix is not present in that release. (src/agents/subagents/announce/subagent-announce-completion-delivery.ts:74, 3a9d69db306c)
  • Producer owns the absence decision: The announcement producer records noVisibleResult only when substituting the placeholder. Literal visible text remains intact, while delivery consumers use the recorded boolean. (src/agents/subagents/announce/subagent-announce.ts:577, 0d065644f1f0)
  • Strict wire contract updated together: The existing closed completion-event schema accepts an optional boolean. The production agent handler still validates requests before preflight, and the delivery regression checks the actual generated request against that validator. (packages/gateway-protocol/src/schema/agent.ts:52, 0d065644f1f0)
  • Earlier import finding is resolved: The predicate test now imports the runtime-free internal event contract; its production caller uses the same owner. The supplied previous review recorded no remaining findings. Comparing the earlier revision locally was blocked by an unavailable Git object, so no unchanged-line attribution is claimed. (src/agents/subagents/announce/subagent-announce-completion-delivery.test.ts:3, 0d065644f1f0)
  • Real Telegram before/after observations: The complete supplied PR body, captured under sourceRevision e42a39990b5869e9399b98892111855b203dd708666d0a9ac7e5eb0becf229e6, reports public sessions_spawn with an external ACP child and a real Telegram Test Server requester. Baseline left literal output pending; repaired source delivered it exactly once and settled delivery. Normal output, silence, failures, timeouts, cancellation, and strict Gateway validation were also exercised. Private raw traces were not supplied for independent inspection.

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: 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 (8 earlier review cycles)
  • reviewed 2026-08-27T03:30:29.066Z sha 044d68f :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T06:17:43.826Z sha 7f8caa6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-01T19:22:13.982Z sha 5fdcce1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-04T04:40:19.755Z sha 5fdcce1 :: blocked before merge. :: none
  • reviewed 2026-09-04T06:15:00.457Z sha 8b796ab :: blocked before merge. :: none
  • reviewed 2026-09-04T15:00:00.535Z sha c59d452 :: blocked before merge. :: [P2] Move the predicate test behind a lightweight import
  • reviewed 2026-09-08T01:01:46.425Z sha f56016f :: needs changes before merge. :: [P2] Move the predicate test behind a lightweight import
  • reviewed 2026-09-08T19:01:49.508Z sha 7b7dd74 :: needs maintainer review before merge. :: none

@zeroaltitude

Copy link
Copy Markdown
Contributor Author

Exact-head real-behavior proof is now complete at GPG-verified 5fdcce1dbf8a18dca0d561a8f9378df8630d125d.

A real isolated dist/entry.js gateway run accepted the strict subagent completion event carrying noVisibleResult: true, rendered it into the requester turn, sent it across the real Gateway/provider boundary, emitted the provider response, and settled agent.wait with status=ok. The provider request log independently contained the unique task marker. The exact-head production build also passed.

@clawsweeper re-review

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 4, 2026
…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
@zeroaltitude

Copy link
Copy Markdown
Contributor Author

Current-main merge and exact-head proof

Current upstream is now merged at signed head 8b796ab45ea3bec408da0de682e6d8fb9da1e43f.

The five textual conflicts and one inherited semantic fixture were resolved by preserving both contracts: upstream's modelRouteChange fact and this PR's noVisibleResult fact cross the same closed event schema. An upstream test that still used literal "(no output)" as control state now sets noVisibleResult: true; the matched opposite regression proves identical user-authored text remains ordinary deliverable output.

Exact-head evidence:

  • focused schema/producer/delivery suites: 304/304
  • complete pnpm check:changed: pass, including core + core-test typechecks, dead-export scan, lint, and runtime guards
  • full pnpm build: pass
  • real isolated Gateway/WebSocket proof: pass — strict noVisibleResult: true event accepted, observed by the provider boundary, and settled with terminal requester output
gateway_agent_status=accepted
gateway_wait_status=ok
provider_observed_task_label=PROOF130647_NO_VISIBLE_RESULT
provider_response=PROOF130647 requester accepted completion event.
result=PASS: strict noVisibleResult event crossed the real Gateway and reached terminal requester execution

@clawsweeper re-review at exact head 8b796ab45ea3bec408da0de682e6d8fb9da1e43f.

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 4, 2026
@zeroaltitude
zeroaltitude marked this pull request as ready for review September 4, 2026 14:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T14:09:16.932333Z 8b796ab Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Sep 8, 2026
…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]>
@zeroaltitude

Copy link
Copy Markdown
Contributor Author

Round on head 7b7dd747f4fe8dbb1df459c15aaefb4d2373e39d (signed, GPG verified; fast-forward from the reviewed head f56016f9ef6, no force-push).

[P2] Move the predicate test behind a lightweight import — subagent-announce-completion-delivery.test.ts:5

The problem, as I read it. The objection was dependency shape rather than behavior: the six predicate-only cases imported hasFailedSubagentNoOutputCompletion from subagent-announce-completion-delivery.ts, and that module statically imports delivery.runtime, so evaluating a pure boolean predicate dragged in configuration, outbound messaging, hooks and embedded-run code.

What I did. Took the first of the two options the review named and moved the predicate into the lightweight event contract:

  • hasFailedSubagentNoOutputCompletion now lives in src/agents/internal-event-contract.ts, a module with no runtime imports at all. Its parameter type is narrowed to the structural shape the predicate actually reads (type / source / status / noVisibleResult) rather than the full AgentInternalEvent.
  • The one production call site, subagent-announce-direct-delivery.ts:211, imports from the contract module. The literal "task_completion" comparison became the existing AGENT_INTERNAL_EVENT_TYPE_TASK_COMPLETION constant, whose value is "task_completion" — so the predicate logic is unchanged, and there is exactly one caller.
  • The six cases stay at their existing path, and that test file's complete import list is now vitest plus ../../internal-event-contract.js. Five are consolidated into an it.each table; the absent/empty-list case remains separate. All six assertions are preserved.

One thing worth flagging, because it constrains the fix. Relocating the cases into a new src/agents/internal-event-contract.test.ts is the shape you might expect, and it is what an earlier attempt did — but it takes the core tsgo agents-root graph from 720 to 721 files and fails the core tsgo graph boundary lane:

Core test graph ownership validation failed
[check:changed] FAILED (exit 1)          1.18s  failed:1   core tsgo graph boundary

Keeping the existing test path while moving only the predicate satisfies the lightweight-import requirement without touching that budget. If you would rather have the dedicated contract test file, that needs a graph-budget decision I did not want to make unilaterally in this PR.

Result. Every check ran on this exact head and wrote a durable log whose literal last line is an explicit terminal EXIT marker:

INSTALL_EXIT=0            pnpm install --frozen-lockfile
DIFFCHECK_EXIT=0          git diff --check + git diff --cached --check
PLACEMENT_EXIT=0          focused predicate suite, 1 file / 6 tests
FOCUSED_EXIT=0            focused sibling suites, 5 files / 324 tests
GATE_EXIT=0               check:changed over the 10 PR paths — 30 lanes, 30/30 ok, 0 failed
SCHEMA_EXIT=0             base config schema --check
SDK_EXIT=0                plugin-sdk surface --check
UNUSED_EXIT=0             deadcode unused-files: production and full-tree scans, 0 entries each
BUILD_EXIT=0              pnpm build, 5m 14s
COLDTSGO_CORE_EXIT=0      pnpm tsgo:core with the incremental cache moved aside
COLDTSGO_CORE_TEST_EXIT=0 pnpm tsgo:core:test with the incremental cache moved aside, ~14m

The markers are not decoration. A passing tsgo:core:test prints essentially nothing, so a pass and a run that died before doing any work produce indistinguishable logs; the previous local gate on this tree ended mid-summary with no terminal line and was therefore treated as an unknown outcome and discarded, not as a pass. The two typecheck lanes were also rerun cold on purpose: inside the gate they finished in ~6 s each off an incremental tsbuildinfo, which would only have proven that the same inputs typechecked at some earlier point.

Not claimed

  • No fresh live-Gateway capture on this head. The isolated-Gateway proof in the body was recorded on 8b796ab45ea. The schema and the delivery decision are unchanged in behavior between that revision and this one, so the boundary claim still holds, but I did not repeat the live run and am not implying I did.
  • No rating claim. The grade is yours to set; I have not touched labels or asserted a change.

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 8, 2026
@obviyus obviyus self-assigned this Sep 11, 2026
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.
@obviyus obviyus changed the title fix(subagents): gate no-output completions on a recorded fact the wire schema carries fix(subagents): deliver child replies that match the empty placeholder Sep 11, 2026
@clawsweeper clawsweeper Bot added the proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. label Sep 11, 2026
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 130647
head: 0d06564
run: 34589072622 attempt: 1
failed: checks-node-changed-extensions-bundle-13 job=103230156411 conclusion=failure
failed: checks-node-compact-large-17 job=103230159014 conclusion=failure
check: openclaw/ci-gate

@obviyus
obviyus merged commit 3db1566 into openclaw:main Sep 11, 2026
213 of 216 checks passed
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks @zeroaltitude!

Proof: A real Telegram Test Server requester used public sessions_spawn with an external Agent Client Protocol child. The child returned literal (no output) on both revisions.

  • Bug: The baseline treated that real reply as an empty placeholder, so the child message remained pending through retries.
  • Fix: The completion producer records absence separately. Existing delivery decisions read that fact, and the strict Gateway schema carries it.
Before After
No child reply reached Telegram; delivery remained pending. Telegram received the literal once; delivery settled.

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 download-lib.js:83 then referenced undefined err, obscuring the download error. The tested merge 4ba9d1b55b766fdff98aaf8407d220236c10424c and its main parent d9ad56cbe319ac6ba1c106a27ab547c4d50c7f05 have identical dependency, lockfile, setup-action, and workflow inputs. This change does not execute during that download. Independence is established by those inputs and the complete failure logs; no matching main-run failure or introducing product commit is claimed. The aggregate gate failed only because these two children failed.

Standing approval: #130647 (comment). No CI rerun was used. Contributor credit and Ayaan's co-author credit are preserved.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
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)
  ...
@zeroaltitude
zeroaltitude deleted the fix/subagent-no-visible-result-fact branch September 11, 2026 18:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
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]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

2 participants