fix(agents): ignore ACP-only streamTo on subagent sessions_spawn#55483
fix(agents): ignore ACP-only streamTo on subagent sessions_spawn#55483Mintalix wants to merge 12 commits into
Conversation
Greptile SummaryThis PR fixes a correctness bug in Confidence Score: 5/5Safe to merge — targeted one-line logic change with full regression test coverage and no impact on ACP behavior. The change is minimal (one conditional assignment replaces a rejection guard), the old behavior for ACP is provably unchanged (the ternary forwards requestedStreamTo when runtime === "acp"), the subagent path never consumed streamTo anyway, and two new tests directly lock in the fixed contract. No other call sites are affected. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/agents/tools/sessions-spawn-tool.ts | Replaces the hard rejection of streamTo on non-ACP runtimes with a silent drop: streamTo is now conditionally forwarded only when runtime === "acp". The removed guard and the new two-step parse are both correct. |
| src/agents/tools/sessions-spawn-tool.test.ts | Old error-expectation test replaced with two new passing tests: explicit runtime="subagent" and omitted runtime both succeed when streamTo is present, and verify spawnSubagentDirect is called without the field. |
Reviews (1): Last reviewed commit: "agents: ignore ACP-only streamTo on suba..." | Re-trigger Greptile
There was a problem hiding this comment.
Pull request overview
This PR fixes sessions_spawn entrypoint validation so ACP-only streamTo does not cause otherwise-valid subagent spawns to fail, improving compatibility with upstream callers that may carry ACP-only fields.
Changes:
- Treat
streamToas ACP-only: forward it only whenruntime="acp", otherwise ignore it. - Remove the prior rejection of
streamTowhen runtime is not ACP. - Add regression tests covering explicit and default (omitted) subagent runtime with
streamTopresent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/agents/tools/sessions-spawn-tool.ts | Drops streamTo for subagent runtime and preserves ACP forwarding behavior. |
| src/agents/tools/sessions-spawn-tool.test.ts | Adds tests ensuring subagent spawns ignore streamTo while ACP behavior remains covered elsewhere. |
| const requestedStreamTo = params.streamTo === "parent" ? "parent" : undefined; | ||
| // Some callers retain ACP-only fields when they fall back to subagent runtime. | ||
| // Treat streamTo as ACP-only and drop it for subagent requests. | ||
| const streamTo = runtime === "acp" ? requestedStreamTo : undefined; |
There was a problem hiding this comment.
streamTo is now treated as ACP-only in the implementation, but the tool schema doesn’t communicate that to callers (unlike resumeSessionId, which has a description noting runtime="acp"). Consider adding a description to the streamTo schema property stating it’s only used for runtime="acp" and ignored for subagent spawns to prevent API confusion.
|
Re-checked against current |
Remove memory_search and memory_get from SUBAGENT_TOOL_DENY_ALWAYS. These are read-only tools with no side effects that are essential for multi-agent setups relying on shared memory for context retrieval. Rationale: - Read-only tools (memory_search, memory_get) have no side effects and cannot modify state, send messages, or affect external systems - Other read-only tools (read, web_search, web_fetch) are already available to sub-agents by default - Multi-agent deployments with shared knowledge depend on memory tools for context retrieval - The workaround (tools.subagents.tools.alsoAllow) works but requires manual configuration that contradicts memorySearch.enabled: true Fixes openclaw#55385
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1911129201
ℹ️ 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".
| export const definePluginEntry: FacadeModule["definePluginEntry"] = createLazyFacadeObjectValue( | ||
| () => loadFacadeModule()["definePluginEntry"] as object, | ||
| ) as FacadeModule["definePluginEntry"]; |
There was a problem hiding this comment.
Export definePluginEntry as callable facade
definePluginEntry is wrapped with createLazyFacadeObjectValue, which always returns a proxy over {} (src/plugin-sdk/facade-runtime.ts), so this export is no longer callable. Any consumer importing openclaw/plugin-sdk/browser-runtime and invoking definePluginEntry(...) will hit a runtime TypeError because the value is an object proxy instead of a function.
Useful? React with 👍 / 👎.
| export const MemoryIndexManager: FacadeModule["MemoryIndexManager"] = createLazyFacadeObjectValue( | ||
| () => loadFacadeModule()["MemoryIndexManager"] as object, | ||
| ) as FacadeModule["MemoryIndexManager"]; |
There was a problem hiding this comment.
Preserve class-valued MemoryIndexManager export
MemoryIndexManager is also wrapped via createLazyFacadeObjectValue, which changes the export from a class/function value into a plain object proxy. This breaks class semantics for SDK consumers (for example new, instanceof, or prototype-based checks) compared to the prior direct re-export from memory-core/runtime-api.
Useful? React with 👍 / 👎.
Some callers retain ACP-only fields (streamTo) when falling back to subagent runtime. Silently drop streamTo for non-ACP requests instead of returning an error. Closes openclaw#43556 Ref: PR openclaw#55483 (correct fix, closed due to unrelated scope creep)
Some callers retain ACP-only fields (streamTo) when falling back to subagent runtime. Silently drop streamTo for non-ACP requests instead of returning an error. Closes openclaw#43556 Ref: PR openclaw#55483 (correct fix, closed due to unrelated scope creep)
Summary
sessions_spawncallers retainstreamTo: "parent"even when the effective runtime issubagent, so the tool rejects an otherwise valid subagent spawn at the entrypoint.sessions_spawnfail for upstream callers that automatically attach ACP-only fields, even though subagent runtime never consumesstreamTo.sessions_spawnnow treatsstreamToas ACP-only, forwards it only forruntime="acp", and ignores it for subagent requests. Added regression tests for explicit and implicit subagent runtime.streamTo="parent"behavior is unchanged, andresumeSessionId/ ACP-only validation still stays strict.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
src/agents/tools/sessions-spawn-tool.tsvalidatedstreamTobefore dispatch and rejected any non-ACP runtime, even though only ACP runtime consumesstreamTo.git blame, prior PR, issue, or refactor if known):streamTois ACP-only and is only used insrc/agents/acp-spawn.ts.streamTowhile switching or defaulting to subagent runtime, which turns a recoverable extra param into a hard failure.acp-spawn.ts; ACP handling remains unchanged.Regression Test Plan (if applicable)
src/agents/tools/sessions-spawn-tool.test.tsstreamTowhen runtime is explicitlysubagentand when runtime is omitted and defaults tosubagent.streamTo="parent"behavior is already covered insrc/agents/acp-spawn.test.ts.User-visible / Behavior Changes
Previously,
sessions_spawnreturned an error when a subagent request includedstreamTo. Now it ignoresstreamTofor subagent requests and continues the spawn.Diagram (if applicable)