Repository navigation
Conversation
Greptile SummaryAdds a targeted guard in Confidence Score: 5/5Safe to merge; only remaining finding is a P2 metadata inaccuracy that does not affect correctness. The fix is well-reasoned, narrowly scoped to the problematic target type, and has no effect on any other sessions_send path. The only open issue is that delivery.status remains pending in the synchronous-reply path even when A2A is skipped — a cosmetic inaccuracy that does not cause data loss or behavioral regression. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17fcc98479
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Re: the P2 finding on misleading (Same commit also addresses the Codex reviewer-ownership gate — the skip now requires the caller to be the parent of the target, not just that the target is a parent-owned oneshot ACP session.) |
The A2A ping-pong + announce flow in runSessionsSendA2AFlow treats the send target as a peer agent and echoes replies back and forth between requester and target. When the target is an ACP child spawned by the requester, this creates an infinite loop: the parent is woken with the child's reply, generates a user-facing response, and has that response forwarded back to the child as a new user message — effectively granting the child an implicit sessions_send capability back to the parent. ACP children already report their results through the [Internal task completion event] announcement path, so no A2A flow is needed when the send target is a parent-owned background ACP session. Detect this case via isParentOwnedBackgroundAcpSession and short-circuit startA2AFlow before runSessionsSendA2AFlow is invoked.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
f632afb to
6ee0182
Compare
Greptile/Codex review follow-ups on #69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
|
Landed via rebase onto Verification:
Landed commits:
Thanks @scotthuang! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ee01821dd
ℹ️ 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".
| const targetSessionEntry = loadSessionEntryByKey(resolvedKey); | ||
| const skipA2AFlow = isRequesterParentOfBackgroundAcpSession( | ||
| targetSessionEntry, | ||
| effectiveRequesterKey, |
There was a problem hiding this comment.
Use tool config when loading target session metadata
This ownership gate now calls loadSessionEntryByKey(resolvedKey), but that helper reads from global loadConfig() (src/agents/subagent-announce-delivery.ts:317-322) instead of the cfg already resolved for this sessions_send invocation. In environments that inject a non-default config/session store (for example tests, embedded runs, or custom store paths), this can read the wrong session store and misclassify ACP parent ownership, causing the A2A skip decision to flip unexpectedly (re-enabling ping-pong or reporting incorrect delivery behavior). The session-entry lookup here should be wired to the same config/store context used by the rest of the tool.
Useful? React with 👍 / 👎.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches. (cherry picked from commit 8a7c214)
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Greptile/Codex review follow-ups on openclaw#69817: - Narrow skipA2AFlow from target-only detection to a combined check that the caller is the parent of the target (new isRequesterParentOfBackgroundAcpSession helper). Under tools.sessions.visibility=all a non-parent sender can see the same oneshot ACP session; the previous guard would have suppressed their only follow-up delivery path. With requester ownership required, those senders continue through the normal A2A flow. - When the A2A flow is skipped, return delivery.status="skipped" instead of "pending" so the parent LLM does not wait for a second result that will never arrive. - Add unit tests for resolveAcpSessionInteractionMode and isRequesterParentOfBackgroundAcpSession covering both the new ownership gate and the existing target-type branches.
Summary
sessions_sendto a parent-owned background ACP child enters an A2A ping-pong: the child's reply is forwarded to the parent as a user message, the parent replies, that reply is forwarded back to the child, repeat. The loop is bounded bymaxPingPongTurns(defaults to 5), so it always terminates — but from the user's point of view the conversation keeps producing turns on its own for several rounds before stopping.sessions_sendtool but effectively gets one via A2A echo — an implicit capability leak. It also pollutes the parent's context and wastes turns/tokens. Results already reach the parent via[Internal task completion event].maxPingPongTurnsguardrail prevents a truly infinite loop, the user-visible behavior is that the chat keeps auto-replying to itself without any user input. To anyone not familiar with the A2A internals this looks like a runaway agent that "won't stop talking" — a bug-class experience, not a graceful bounded handshake.sessions-send-tool.ts, detect parent-owned background ACP targets viaisParentOwnedBackgroundAcpSessionand skipstartA2AFlow.mode=run(oneshot background children spawned by the current parent).mode=session(persistent) ACP targets, externally-opened ACP sessions that are not parent-owned, non-ACP peer targets, and any othersessions_sendpath are not touched.mode=sessionACP sessions and peer agents); ACP protocol, session binding, inline delivery.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
maxPingPongTurnsAPI surface the issue suggests.Root Cause (if applicable)
runSessionsSendA2AFlowtreats the target as a peer and echoes replies in both directions for up tomaxPingPongTurns. For parent-owned background ACP children, this path coexists with[Internal task completion event], so the parent is both notified and fed the child's reply as a user message — creating the loop.Regression Test Plan (if applicable)
src/agents/tools/sessions-send-tool.a2a.test.tsstartA2AFlowis skipped when the target entry is a parent-owned background ACP session (spawned withmode=run); still runs formode=sessionACP targets and peer targets.User-visible / Behavior Changes
Background ACP children spawned with
mode=runby the current requester no longer participate in A2A ping-pong. Their results still reach the parent via[Internal task completion event].mode=session(persistent) ACP targets and all othersessions_sendtargets are unchanged.Diagram (if applicable)
Security Impact (required)
No— actually removes an unintended implicit capability (ACP child gaining de-factosessions_sendvia A2A echo).NoNoNoNoRepro + Verification
Environment
pnpm openclaw gatewaySteps
agent:main:main) in webchat.mode=run, Claude) viasessions_spawn.sessions_sendto that child with a short greeting.Expected
[Internal task completion event]reaches the parent.Actual
Evidence
Same repro in both runs, captured from the webchat UI against a local
pnpm openclaw gateway(v2026.4.20):sessions_spawn.sessions_sendto that child with a short greeting.Before fix — A2A ping-pong
What the screenshot shows:
sessions_send, the ACP child's raw reply appears in the main conversation as a new user message (A2A echo).sessions_sendcall — the ping-pong loop. The loop eventually stops on its own becausemaxPingPongTurnscaps it, but during those intermediate turns the UI looks like an agent that has gone runaway: messages keep appearing without any user input, and there is no signal to the user that a bounded guardrail will eventually end it.After fix — single completion event, no loop
What the screenshot shows:
sessions_sendresolves with exactly one[Internal task completion event]reaching the main agent.Net effect: the only path by which the child's result reaches the parent is the existing completion-announcement channel, matching the "After" branch of the diagram above.
Human Verification (required)
agent:main:main) → ACP Claude child viasessions_send; single completion event; no ping-pong; no echo back to child. Repeated sends behave consistently.Review Conversations
Compatibility / Migration
YesNoNoRisks and Mitigations
isParentOwnedBackgroundAcpSessionmatches onlyacp.mode === "oneshot"sessions withspawnedBy/parentSessionKeyset — exactly the subset that uses the announcement path for result delivery. Persistent (acp.mode === "persistent") sessions and ACP sessions that are not owned by the current parent are not matched.