Skip to content

Commit 8040f28

Browse files
100menotu001steipete
authored andcommitted
fix(subagents): make completion handoff review-first
1 parent 25090f6 commit 8040f28

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai
2929
- CLI/docs: call the canonical lowercase docs MCP search tool and surface MCP errors instead of returning empty search results. Fixes #82702. (#82704) Thanks @hclsys.
3030
- QA-Lab: ignore heartbeat-only operational transcripts when capturing runtime parity cells so background checks cannot replace the scenario reply. (#80323) Thanks @100yenadmin.
3131
- Gateway/exec approvals: wait for accepted async approval follow-up runs instead of direct-fallback sending duplicate completions when retries use different nonce keys. Fixes #82711. (#82717) Thanks @udaymanish6.
32+
- Agents/subagents: mark completed subagent handoffs as ready for parent review so requester agents verify results and continue required follow-up work before reporting done.
3233
- CLI/config: add `--dry-run` support to `openclaw config unset`, with `--json` output and allow-exec validation parity with `config set`/`config patch` dry-run handling. (#81895) Thanks @giodl73-repo.
3334
- Memory-core: retry disabled dreaming cron cleanup until cron is available after startup, so persisted managed dreaming jobs are removed after restart. Fixes #82383. (#82389) Thanks @neeravmakwana.
3435
- Providers/xAI: keep retired Grok 3, Grok 4 Fast, Grok 4.1 Fast, and Grok Code slugs out of model pickers while preserving compatibility resolution for existing configs.

‎docs/tools/subagents.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ requester chat when the run finishes.
9999
- `Result` — latest visible `assistant` reply text, otherwise sanitized latest tool/toolResult text. Terminal failed runs do not reuse captured reply text.
100100
- `Status` — `completed successfully` / `failed` / `timed out` / `unknown`.
101101
- Compact runtime/token stats.
102-
- A delivery instruction telling the requester agent to rewrite in normal assistant voice (not forward raw internal metadata).
102+
- A review instruction telling the requester agent to verify the result before deciding whether the original task is done.
103+
- Follow-up guidance telling the requester agent to continue the task or record a follow-up when the child result leaves more action.
104+
- A final-update instruction for the no-more-action path, written in normal assistant voice without forwarding raw internal metadata.
103105

104106
</Accordion>
105107
<Accordion title="Modes and ACP runtime">

‎src/agents/subagent-announce.format.e2e.test.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,13 @@ describe("subagent announce formatting", () => {
511511
expect(msg).toContain("</prompt-data>");
512512
expect(msg).toContain("raw subagent reply");
513513
expect(msg).toContain("Stats:");
514-
expect(msg).toContain("A completed subagent task is ready for user delivery.");
515-
expect(msg).toContain("Convert the result above into your normal assistant voice");
514+
expect(msg).toContain("A completed subagent task is ready for parent review.");
515+
expect(msg).toContain(
516+
"Review/verify the result above before deciding whether the original task is done.",
517+
);
518+
expect(msg).toContain(
519+
"If additional action is required, continue the task or record a follow-up; otherwise send a truthful user-facing update.",
520+
);
516521
expect(msg).toContain("Keep this internal context private");
517522
expect(call?.params?.internalEvents?.[0]?.type).toBe("task_completion");
518523
expect(call?.params?.internalEvents?.[0]?.taskLabel).toBe("do thing");
@@ -697,7 +702,10 @@ describe("subagent announce formatting", () => {
697702
expect(msg).toContain("tokens 1.0k (in 12 / out 1.0k)");
698703
expect(msg).toContain("prompt/cache 197.0k");
699704
expect(msg).toContain("session_id: child-session-usage");
700-
expect(msg).toContain("A completed subagent task is ready for user delivery.");
705+
expect(msg).toContain("A completed subagent task is ready for parent review.");
706+
expect(msg).toContain(
707+
"If additional action is required, continue the task or record a follow-up; otherwise send a truthful user-facing update.",
708+
);
701709
expect(msg).toContain(
702710
`Reply ONLY: ${SILENT_REPLY_TOKEN} if this exact result was already delivered to the user in this same turn.`,
703711
);

‎src/agents/subagent-announce.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ function buildAnnounceReplyInstruction(params: {
8888
return `Convert this completion into a concise internal orchestration update for your parent agent in your own words. Keep this internal context private (don't mention system/log/stats/session details or announce type). If this result is duplicate or no update is needed, reply ONLY: ${SILENT_REPLY_TOKEN}.`;
8989
}
9090
if (params.expectsCompletionMessage) {
91-
return `A completed ${params.announceType} is ready for user delivery. Convert the result above into your normal assistant voice and send that user-facing update now. Keep this internal context private (don't mention system/log/stats/session details or announce type).`;
91+
return `A completed ${params.announceType} is ready for parent review. Review/verify the result above before deciding whether the original task is done. If additional action is required, continue the task or record a follow-up; otherwise send a truthful user-facing update. Keep this internal context private (don't mention system/log/stats/session details or announce type).`;
9292
}
93-
return `A completed ${params.announceType} is ready for user delivery. Convert the result above into your normal assistant voice and send that user-facing update now. Keep this internal context private (don't mention system/log/stats/session details or announce type), and do not copy the internal event text verbatim. Reply ONLY: ${SILENT_REPLY_TOKEN} if this exact result was already delivered to the user in this same turn.`;
93+
return `A completed ${params.announceType} is ready for parent review. Review/verify the result above before deciding whether the original task is done. If additional action is required, continue the task or record a follow-up; otherwise send a truthful user-facing update. Keep this internal context private (don't mention system/log/stats/session details or announce type), and do not copy the internal event text verbatim. Reply ONLY: ${SILENT_REPLY_TOKEN} if this exact result was already delivered to the user in this same turn.`;
9494
}
9595

9696
function buildAnnounceSteerMessage(events: AgentInternalEvent[]): string {

0 commit comments

Comments
 (0)