Skip to content

fix(agents): preserve ACP requester agent overrides - #55723

Closed
RichardCao wants to merge 1 commit into
openclaw:mainfrom
RichardCao:fix/acp-requester-agent-override
Closed

RichardCao wants to merge 1 commit into
openclaw:mainfrom
RichardCao:fix/acp-requester-agent-override

Conversation

@RichardCao

Copy link
Copy Markdown
Contributor

Summary

  • pass requesterAgentIdOverride through the ACP sessions_spawn path
  • resolve ACP requester heartbeat/relay eligibility from the explicit override before falling back to the parent session key
  • add regression coverage for the tool passthrough and for implicit parent-stream gating using the overridden requester agent

Testing

  • pnpm exec vitest run src/agents/tools/sessions-spawn-tool.test.ts src/agents/acp-spawn.test.ts

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Mar 27, 2026
@greptile-apps

greptile-apps Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a gap where requesterAgentIdOverride — already threaded through the subagent spawn path — was silently dropped when the ACP (runtime="acp") path was used via sessions_spawn. The fix adds the field to SpawnAcpContext, propagates it from the tool layer into spawnAcpDirect, and makes both isHeartbeatEnabledForSessionAgent and resolveAcpSpawnRequesterState consult the override before falling back to the parsed session key.

  • sessions-spawn-tool.ts: passes opts?.requesterAgentIdOverride into the ACP context (it was already passed into the subagent context on line 205).
  • acp-spawn.ts: adds requesterAgentIdOverride to SpawnAcpContext; resolves requesterAgentId with override priority in both the heartbeat-eligibility helper and the requester-state resolver.
  • Two regression tests are added: one verifying tool-layer passthrough, one verifying that the override correctly gates implicit parent-stream relay when the overridden agent lacks a heartbeat config.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix that mirrors an already-validated pattern from the subagent path.

The change is a pure gap-fill: requesterAgentIdOverride was already correctly handled in subagent-spawn.ts and just wasn't wired into the ACP path. The implementation follows the exact same override-then-fallback pattern used in subagent-spawn.ts:391. Both callsites in acp-spawn.ts are updated consistently, and the two new tests cover the two distinct behaviors being fixed. No logic errors or unintended side-effects were found.

No files require special attention.

Important Files Changed

Filename Overview
src/agents/tools/sessions-spawn-tool.ts Passes requesterAgentIdOverride into the ACP context; was already present for subagent path.
src/agents/acp-spawn.ts Adds requesterAgentIdOverride to SpawnAcpContext and applies override-first resolution in both heartbeat and requester-state helpers.
src/agents/tools/sessions-spawn-tool.test.ts Adds requesterAgentIdOverride to the ACP routing test to verify tool-layer passthrough.
src/agents/acp-spawn.test.ts Adds regression test verifying that the override correctly gates implicit parent-stream relay when the overridden agent lacks a heartbeat config.

Reviews (1): Last reviewed commit: "fix(agents): preserve ACP requester agen..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open. Current main and v2026.6.10 only partially preserve ACP requester overrides: the tool and spawn entry point carry the override, but heartbeat eligibility still derives from the parent session key, so this PR remains useful while needing a refresh and real behavior proof before merge.

Root-cause cluster
Relationship: canonical
Canonical: #55723
Summary: This PR is the canonical open implementation attempt for the ACP requester override heartbeat/relay mismatch; related work is either an earlier duplicate, adjacent merged requester override plumbing, or a broader session-mode request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes, source-level. Current main resolves the ACP requester id from requesterAgentIdOverride, but the heartbeat gate still parses the parent session key, so an overridden requester can inherit the wrong heartbeat/relay eligibility without a live run being needed to see the path.

Is this the best way to solve the issue?

Yes in direction. ACP spawn requester-state is the right boundary, but the mergeable current-main version should use the already-resolved requester identity rather than landing the stale branch without refresh.

Security review:

Security review cleared: Security review cleared: the diff is limited to internal ACP requester routing and tests, with no dependency, lockfile, CI, credential, install, or external code-execution changes.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-03-27T10:14:59Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • steipete: Commit 1fef20c96bdc preserved requester agent attribution across ACP spawn and sessions_spawn, directly overlapping the current-main partial implementation this PR extends. (role: recent area contributor; confidence: high; commits: 1fef20c96bdc; files: src/agents/acp-spawn.ts, src/agents/tools/sessions-spawn-tool.ts, src/agents/acp-spawn.test.ts)
  • jalehman: Commit 9512294e8f62 recently changed ACP metadata and session accessor behavior in acp-spawn.ts, the owner surface this PR must refresh against. (role: recent area contributor; confidence: medium; commits: 9512294e8f62; files: src/agents/acp-spawn.ts, src/agents/acp-spawn.test.ts)
  • scotthuang: Commit 7f1a920a893b changed stream-to-parent ACP spawn registration in the same sessions_spawn delivery path affected by this PR. (role: adjacent contributor; confidence: medium; commits: 7f1a920a893b; files: src/agents/tools/sessions-spawn-tool.ts, src/agents/tools/sessions-spawn-tool.test.ts)
  • obviyus: Commit 4c9b72498725 and related ACP relay work changed parent commentary/streaming behavior adjacent to ACP parent-stream relay eligibility. (role: adjacent contributor; confidence: medium; commits: 4c9b72498725, 1f4b08ad2a19; files: src/agents/acp-spawn-parent-stream.ts)

Codex review notes: model internal, reasoning high; reviewed against 843ad143647e.

@RichardCao
RichardCao force-pushed the fix/acp-requester-agent-override branch from 3281817 to 699bc97 Compare April 30, 2026 05:41
@RichardCao

Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto latest upstream/main (99950c7f1272dff6e2c34c2be45dfc5f89e62a60) and force-pushed the updated branch.

New head: 699bc97f32a9f7c6861aee4269a6146f6a61ad96

What changed:

  • Rebuilt the original minimal fix on top of current main.
  • Preserved requesterAgentIdOverride through the sessions_spawn ACP path.
  • Updated ACP requester-state resolution to prefer the trusted override while keeping the existing parsed-session fallback.
  • Added/kept regression coverage for both tool-layer forwarding and ACP parent-stream eligibility.

Review:

  • Fresh gpt-5.5 xhigh review found no important issues requiring changes before push.

Verification:

  • Passed: ./node_modules/.bin/vitest run --config test/vitest/vitest.agents-core.config.ts src/agents/acp-spawn.test.ts
  • Result: 1 file passed, 56 tests passed.
  • Blocked locally: src/agents/tools/sessions-spawn-tool.test.ts failed during import because this local node_modules is missing the declared typebox package. No test assertions ran in that suite.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@RichardCao
RichardCao force-pushed the fix/acp-requester-agent-override branch from 699bc97 to 3fee03d Compare June 1, 2026 06:36
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 15, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant