Summary
KIZ-762 found two related subagent completion-announcement regressions in the OpenClaw runtime:
- Assistant text attached to a tool-use turn can be treated as terminal subagent completion output even though it is only progress while the child is still running.
- The same terminal child result can be delivered more than once for the same
childSessionKey + childRunId.
This produced premature/duplicate subagent completion announcements during live orchestration work.
Proposed fix
Prepared and locally validated source patch touches:
src/agents/subagent-announce-output.ts
src/agents/subagent-announce-output.test.ts
src/agents/subagent-announce.ts
src/agents/subagent-announce.test.ts
Behavioral changes:
- If an assistant message has tool calls, treat any attached assistant text as progress, not terminal output.
- After non-
sessions_yield tool use, wait for a later assistant message without tool calls before selecting final output.
- Do not promote tool-result text to terminal completion while waiting for that final assistant response.
- Add bounded in-memory terminal announce idempotency keyed by the existing stable announce id (
childSessionKey + childRunId, via current announce-id machinery).
Local validation
Validated in a fresh public source checkout:
PATH="/tmp/kiz775-bin:$PATH" OPENCLAW_TEST_FAST=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/subagent-announce-output.test.ts src/agents/subagent-announce.test.ts
2 test files passed, 17 tests passed
Also ran git diff --check clean on the prepared source patch.
Notes
I attempted to push a PR branch from a fork, but the available GitHub token lacks workflow scope and GitHub rejected branch creation because the upstream/fork history includes workflow files. I am filing this issue as the upstream tracking artifact instead of silently leaving the fix local.
The prepared local branch/commit is:
/tmp/openclaw-source-kiz775
branch: kiz-762-subagent-announcement-fix
commit: 2ae383dd fix: avoid premature subagent completion announcements
I can provide the full patch if preferred.
Summary
KIZ-762 found two related subagent completion-announcement regressions in the OpenClaw runtime:
childSessionKey + childRunId.This produced premature/duplicate subagent completion announcements during live orchestration work.
Proposed fix
Prepared and locally validated source patch touches:
src/agents/subagent-announce-output.tssrc/agents/subagent-announce-output.test.tssrc/agents/subagent-announce.tssrc/agents/subagent-announce.test.tsBehavioral changes:
sessions_yieldtool use, wait for a later assistant message without tool calls before selecting final output.childSessionKey + childRunId, via current announce-id machinery).Local validation
Validated in a fresh public source checkout:
Also ran
git diff --checkclean on the prepared source patch.Notes
I attempted to push a PR branch from a fork, but the available GitHub token lacks
workflowscope and GitHub rejected branch creation because the upstream/fork history includes workflow files. I am filing this issue as the upstream tracking artifact instead of silently leaving the fix local.The prepared local branch/commit is:
I can provide the full patch if preferred.