Skip to content

ACP Issue #109961

Closed
Closed

Description

@FUSED-ID

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary
In the ACP bridge (dist/acp-cli-*.js, source under src/.../acp), newSession()
awaits sendSessionSnapshotUpdate() — which emits a session_info_update
session/update notification — BEFORE returning the session/new JSON-RPC
result. Clients that key off session_info_update to learn the session's
sessionId receive the notification before they've parsed the result, so the
notification references a sessionId they haven't learned yet.

Version
openclaw 2026.7.1

Repro
Use scripts/r1-acp-verify.py from github.com/FUSED-ID/m4-macbook-pro-setup
against a local openclaw ACP bridge instance. It captures the raw JSON-RPC
stream on stdout and asserts message ordering. Run:
python3 r1-acp-verify.py --target
It fails on stock openclaw 2026.7.1 with the notification preceding the
result; passes after the local patch described below.

Expected vs actual ordering
Expected: session/new result (with sessionId) → session_info_update
notification (referencing that sessionId).
Actual: session_info_update notification (sessionId not yet known to
client) → session/new result.

Impact
Rabbit R1's rabbit-agent (closed-source node service) gates session/prompt
delivery on receiving session_info_update after the result. With the
current ordering, sessions never receive a prompt and hang indefinitely.

Suggested fix location
newSession() in the ACP bridge — defer the sendSessionSnapshotUpdate()
call until after the session/new result is returned/flushed (e.g.
setTimeout(..., 0) or a microtask deferred past the RPC response write).
We validated a 30ms setTimeout defer locally as a workaround; a proper fix
should guarantee ordering without relying on a timer.

Local workaround (not proposed as the fix, just proof of concept)
See patch script in a private fork: defers the snapshot emission by 30ms.
Happy to share the diff if useful.

Steps to reproduce

  1. Start a local openclaw ACP bridge instance (openclaw 2026.7.1).
  2. Run scripts/r1-acp-verify.py from github.com/FUSED-ID/m4-macbook-pro-setup
    against it: python3 r1-acp-verify.py --target
  3. Observe the captured JSON-RPC stream: the session_info_update
    notification arrives before the session/new result, instead of after.
  4. Script assertion on message ordering fails on stock 2026.7.1; passes
    after deferring the notification (see local workaround in description).

Expected behavior

The session/new JSON-RPC result (containing the sessionId) should be
returned/flushed to the client before the session_info_update
notification for that session is emitted. Clients should never receive a
session_info_update referencing a sessionId they haven't learned yet.

Actual behavior

newSession() in the ACP bridge awaits sendSessionSnapshotUpdate() — which
emits the session_info_update notification — BEFORE returning the
session/new result. So the notification is sent first, referencing a
sessionId the client hasn't received yet. Downstream, Rabbit R1's
rabbit-agent gates prompt delivery on receiving session_info_update after
the result, so with this ordering R1 sessions hang indefinitely.

Version: openclaw 2026.7.1
Suggested fix: defer sendSessionSnapshotUpdate() until after the
session/new result is returned/flushed. We validated a 30ms setTimeout
defer locally as a workaround.

OpenClaw version

2026.7.1

Operating system

CLAW (droplet): Ubuntu 24.04.4 LTS, kernel 6.8.0-134-generic with M4: macOS 26.5.2 (build 25F84)

Install method

systemd service (oc-update managed)

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex (direct)

Additional provider/model setup details

Anthropic dropped as of 2026-04-11 policy change. Primary model
openai-codex/gpt-5.4, fallbacks grok-3-mini, grok-3, gemini-2.5-flash.
Not model-specific — this is a protocol-level ACP ordering bug,
reproducible independent of which model is configured.

Logs

Screenshots, recordings, and evidence

No response

Impact and severity

No response

Additional information

No response

Activity

  1. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    on Jul 17, 2026
  2. clawsweeper commented on Jul 17, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 5, 2026, 2:41 PM ET / 18:41 UTC.

    Summary
    The ordering defect remains in current main and v2026.9.1. The linked open repair PR already owns the work, so this issue should remain open without another repair branch.

    Reproducibility: yes. at source level: newSession awaits notification delivery before returning, and the ACP SDK responds only after the handler resolves. No runtime reproduction was executed in this read-only review.

    Next step
    Review and resolve #110455 as the existing repair candidate; another fix PR would duplicate that work.

    Review details

    Best possible solution:

    Guarantee result-before-update ordering at the ACP output boundary while preserving existing-session replay and streaming, through the linked repair PR.

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

    Yes, at source level: newSession awaits notification delivery before returning, and the ACP SDK responds only after the handler resolves. No runtime reproduction was executed in this read-only review.

    Is this the best way to solve the issue?

    A deterministic output-ordering guarantee is the appropriate repair; a timer does not establish that guarantee. The linked PR’s complete implementation still needs its own review.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The reported Rabbit R1 prompt hang was not independently exercised; source inspection establishes the early notifications, not the closed-source client’s full behavior.

    Codex review notes: model internal, reasoning medium; reviewed against 9d5ebf6bc948.

    Label changes

    Label justifications:

    • P1: A source-supported ordering defect in the shipped ACP bridge can prevent affected clients from progressing to prompt delivery.
    • impact:session-state: Initial session notifications reach clients before the response that introduces their session identity.
    Evidence reviewed

    What I checked:

    • Current-main failure location: newSession awaits sendSnapshotUpdate and sendAvailableCommands before returning the newly generated sessionId. (src/acp/translator.session-lifecycle.ts:87, 9d5ebf6bc948)
    • Notification delivery path: sendSnapshotUpdate emits session_info_update through the session-update owner, whose emit method calls connection.sessionUpdate immediately and normally awaits delivery. (src/acp/translator.session-updates.ts:141, 9d5ebf6bc948)
    • Applicable dependency and implementation boundary: The stdio server directly imports AgentSideConnection and ndJsonStream from @agentclientprotocol/sdk, pinned to 1.4.0 in package.json. docs/cli/acp.md distinguishes this Gateway bridge from external Codex/Claude harness sessions; the reported ordering does not depend on the Codex runtime. (src/acp/server.ts:247, 9d5ebf6bc948)
    • ACP SDK response ordering: Inspected the published v1.4.0 source: legacyAgentApp forwards session/new to the implementation; registerAppRequest awaits that handler before responding; sessionUpdate directly sends a notification. Repository identity is confirmed by the package manifest. See SDK source and package metadata. (src/acp.ts:1060)
    • Serialized transport writes: The v1.4.0 sendNotification method submits directly to sendWireMessage; that method serializes writer.write calls through writeQueue. There is no session-introduction barrier in this path. See JSON-RPC transport source. (src/jsonrpc.ts:1038)
    • Latest-release behavior: The v2026.9.1 lifecycle implementation retains the same update-before-result sequence; this is not established as fixed in the latest release. (src/acp/translator.session-lifecycle.ts:87, ad6fe23aecb9)

    Likely related people:

    • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    • NianJiu: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. added
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions