fix(sessions_spawn): tolerate ACP-only fields for subagent runtime#72614
Conversation
Greptile SummaryThis PR changes Confidence Score: 4/5Safe to merge; the logic change is intentional, well-tested, and limited to dropping ACP-only fields before a subagent dispatch. Only P2 findings present. The implementation correctly strips the ACP-only fields in the subagent path and the tests verify both the stripping and the ACP passthrough. The one gap is a stale schema description for resumeSessionId that was not updated in parallel with streamTo. src/agents/tools/sessions-spawn-tool.ts — resumeSessionId description update
|
0443906 to
69446c6
Compare
|
ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical. Source PR: #72614 |
|
ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical. Source PR: #72614 |
7056b56 to
2afa9ae
Compare
25c1312 to
8062f56
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 sessions_spawn ACP resumeSessionId not redacted when tool arguments are JSON strings
Description
However, some tool-call block formats (notably OpenAI-style Impact:
Vulnerable code: function redactSessionsSpawnAcpArgs(value: unknown): unknown {
if (!value || typeof value !== "object") {
return value; // JSON-string arguments are not redacted
}
...
}RecommendationHandle stringified tool arguments/inputs by attempting to parse JSON when the value is a string, redact in the parsed object, then re-serialize. Example fix: function redactSessionsSpawnArgs(value: unknown): unknown {
// First handle object payloads
const direct = redactSessionsSpawnAcpArgs(redactSessionsSpawnAttachmentsArgs(value));
if (direct !== value) return direct;
// Then handle JSON-string payloads (OpenAI functionCall style)
if (typeof value === "string") {
try {
const parsed = JSON.parse(value) as unknown;
const redacted = redactSessionsSpawnAcpArgs(redactSessionsSpawnAttachmentsArgs(parsed));
return redacted === parsed ? value : JSON.stringify(redacted);
} catch {
return value;
}
}
return value;
}Also add tests covering Analyzed PR: #72614 at commit Last updated on: 2026-04-27T16:36:13Z |
|
ProjectClownfish follow-up: the Greptile note is addressed in the current head. |
|
ProjectClownfish follow-up: addressed the Aisle transcript finding in the current head. sessions_spawn now redacts ACP-only resumeSessionId and streamTo fields in both persisted arguments and input payloads, with regression coverage for both shapes. |
2b1d89e to
fa0fd0e
Compare
|
ProjectClownfish follow-up: addressed the latest Aisle edge case too. ACP-only sessions_spawn routing keys are now redacted by key presence, not by string type, so object/array/number payloads cannot persist through transcript repair. Remote Blacksmith validation: pnpm test:serial src/agents/session-transcript-repair.attachments.test.ts src/agents/session-transcript-repair.test.ts passed (38 tests). |
|
ProjectClownfish follow-up: addressed the Aisle IDOR finding in the current head. runtime="acp" resumeSessionId now passes only when it matches an ACP identity already recorded in OpenClaw session state and owned by the requester session; otherwise it returns resume_forbidden before sessions.patch or ACP runtime initialization. Remote Blacksmith validation passed: pnpm test:serial src/agents/acp-spawn.test.ts src/agents/tools/sessions-spawn-tool.test.ts src/agents/session-transcript-repair.attachments.test.ts src/agents/session-transcript-repair.test.ts (115 tests). |
Summary
streamToandresumeSessionIdas ACP-only values consumed only whenruntime="acp".runtime="subagent", ignore those ACP-only fields before dispatch so schema-following providers cannot fail otherwise valid subagent spawns.Credit
This carries forward the focused implementation work from #68397, #65282, #58686, #56342, and #40102. Contributor credit is preserved in this PR and the changelog entry.
Validation
pnpm -s vitest run src/agents/tools/sessions-spawn-tool.test.tspnpm check:changedNotes
This PR intentionally does not change ACP resumeSessionId authorization or session ownership semantics. Security-sensitive refs #63121 and #72331 remain routed to central OpenClaw security handling.
ProjectClownfish replacement details: