Skip to content

fix(sessions_spawn): silently strip ACP-only fields for runtime=subagent#68397

Closed
skernelx wants to merge 1 commit into
openclaw:mainfrom
skernelx:fix/sessions-spawn-strip-acp-only-fields
Closed

fix(sessions_spawn): silently strip ACP-only fields for runtime=subagent#68397
skernelx wants to merge 1 commit into
openclaw:mainfrom
skernelx:fix/sessions-spawn-strip-acp-only-fields

Conversation

@skernelx

Copy link
Copy Markdown

Summary

sessions_spawn currently hard-errors when runtime="subagent" receives streamTo or resumeSessionId, even though the subagent code path never consumes either field. Schema-strict providers (most notably gpt-5.4 via the OpenAI bridge) auto-fill every advertised tool parameter on every call regardless of the runtime value the model also picks, which makes subagent spawns fail 90%+ of the time for those models.

This PR switches the two ACP-only fields from "reject with error" to "silently drop when runtime!=='acp'". ACP semantics are unchanged — when runtime==='acp' the fields flow through unmodified and the existing ACP spawn logic validates them.

Why the silent-drop approach

Related issues

Addresses (non-exhaustive):

Test plan

  • Updated existing rejects resumeSessionId without runtime=acp and rejects streamTo when runtime is not "acp" cases to assert the new silent-drop contract: the tool forwards to spawnSubagentDirect without the ACP-only keys and returns no error.
  • Unchanged: runtime=acp path still passes streamTo / resumeSessionId through to spawnAcpDirect (existing tests at lines 177, 226 still cover this).
  • Suggested: add an integration test that round-trips a runtime="subagent" call with streamTo="parent" through the tool-call bridge to catch future regressions at the schema layer.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Apr 18, 2026
@greptile-apps

greptile-apps Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Switches sessions_spawn from hard-erroring to silently dropping streamTo and resumeSessionId when runtime !== "acp". Both fields are now only read/computed on the ACP branch, so schema-strict providers (e.g. gpt-5.4) that auto-fill every advertised parameter can no longer cause subagent spawns to fail. The ACP code path is entirely unchanged.

Confidence Score: 5/5

Safe to merge — no P0/P1 issues; only a minor schema description wording nit remains.

The logic change is minimal and correctly scoped: the subagent call never forwarded these fields before this PR, so the only behavioral delta is that non-ACP callers no longer receive an error result. ACP semantics are fully preserved. Tests are updated to verify both the drop and the continued pass-through for ACP.

No files require special attention.

Comments Outside Diff (1)

  1. src/agents/tools/sessions-spawn-tool.ts, line 92-96 (link)

    P2 Schema description no longer reflects actual behavior

    The description string still says Requires runtime="acp" but the field is now silently dropped for non-ACP runtimes rather than rejected. A schema-strict model reading this description could still try to honour the constraint, but a human reading the tool schema will see an enforced requirement that no longer exists. A small wording update keeps the schema honest:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agents/tools/sessions-spawn-tool.ts
    Line: 92-96
    
    Comment:
    **Schema description no longer reflects actual behavior**
    
    The `description` string still says `Requires runtime="acp"` but the field is now silently dropped for non-ACP runtimes rather than rejected. A schema-strict model reading this description could still try to honour the constraint, but a human reading the tool schema will see an enforced requirement that no longer exists. A small wording update keeps the schema honest:
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/tools/sessions-spawn-tool.ts
Line: 92-96

Comment:
**Schema description no longer reflects actual behavior**

The `description` string still says `Requires runtime="acp"` but the field is now silently dropped for non-ACP runtimes rather than rejected. A schema-strict model reading this description could still try to honour the constraint, but a human reading the tool schema will see an enforced requirement that no longer exists. A small wording update keeps the schema honest:

```suggestion
  resumeSessionId: Type.Optional(
    Type.String({
      description:
        'Resume an existing agent session by its ID (e.g. a Codex session UUID from ~/.codex/sessions/). Only applies when runtime="acp"; silently ignored for runtime="subagent". The agent replays conversation history via session/load instead of starting fresh.',
    }),
  ),
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(sessions_spawn): silently strip ACP-..." | Re-trigger Greptile

Schema-following LLMs (notably gpt-5.4) auto-fill every advertised tool
parameter, including streamTo and resumeSessionId, regardless of the
runtime value they also set. Under runtime="subagent" the executor
rejected those fields with a hard error, making subagent spawn
effectively unusable for these models (see openclaw#43556, openclaw#56193, openclaw#63120,

Since the subagent code path never reads either field, treat them as
no-ops when runtime!=="acp" instead of failing. ACP semantics are
unchanged: when runtime==="acp" the fields still flow through
unmodified and the existing ACP spawn logic validates them.

Tests updated to match the new silently-drop behavior.
@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #72331
Source PR: #68397
Contributor credit is preserved in the replacement PR body and changelog plan.

@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #72331
Source PR: #68397
Contributor credit is preserved in the replacement PR body and changelog plan.

@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #72614
Source PR: #68397
Contributor credit is preserved in the replacement PR body and changelog plan.

@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #72331
Source PR: #68397
Contributor credit is preserved in the replacement PR body and changelog plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants