Skip to content

Implement ACP bridge lifecycle handlers - #78880

Merged
amknight merged 5 commits into
mainfrom
codex/acp-bridge-lifecycle-handlers
May 7, 2026
Merged

amknight merged 5 commits into
mainfrom
codex/acp-bridge-lifecycle-handlers

Conversation

@amknight

@amknight amknight commented May 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Implement stable OpenClaw ACP bridge session/list, session/resume, and session/close handlers against the current @agentclientprotocol/sdk method names.
  • Add bounded opaque pagination, absolute cwd validation/filtering, resume-without-replay behavior, and close cleanup that cancels active bridge work and resolves pending prompts as cancelled.
  • Add ACP SDK schema fixture coverage plus lifecycle/session-store tests, update the ACP compatibility docs, and record the user-visible changelog entry.
  • Document a concise protocol smoke-test checklist in the ACP docs, with the fuller captured request/response example kept below for reviewer evidence.

Verification

  • pnpm check:changed
  • pnpm test:changed
  • pnpm docs:list
  • pnpm check:docs
  • git diff --check origin/main...HEAD
  • Crabbox Blacksmith Testbox real Gateway/ACP smoke: built the rebased checkout, started a foreground Gateway with isolated state, drove openclaw acp over stdio with @agentclientprotocol/sdk, and verified initialize, newSession, listSessions, resumeSession, closeSession, duplicate close rejection, and missing resume rejection. Lease tbx_01kr0xjfdm7pdc5071fv8m89rw, Actions run, exit 0.
  • Crabbox AWS real Gateway/ACP evidence capture: built the checkout, started a foreground Gateway with isolated state, drove openclaw acp over stdio with raw ACP JSON-RPC frames, captured server responses and Gateway logs, and verified initialize, session/new, session/list, session/resume, session/close, duplicate close rejection, and missing resume rejection. Run run_2f5648ee30ad, lease cbx_5505f5580f81, exit 0. The lease was stopped after capture.

Testing Evidence Example

The AWS Crabbox smoke sent representative ACP JSON-RPC frames to openclaw acp over stdio:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{"fs":{"readTextFile":false,"writeTextFile":false},"terminal":false},"clientInfo":{"name":"openclaw-acp-crabbox-evidence","version":"1.0.0"}}}
{"jsonrpc":"2.0","id":3,"method":"session/list","params":{"cwd":"/tmp/openclaw-acp-evidence-4jaUEQ/workspace","_meta":{"limit":5}}}
{"jsonrpc":"2.0","id":4,"method":"session/resume","params":{"sessionId":"agent:main:acp-smoke","cwd":"/tmp/openclaw-acp-evidence-4jaUEQ/workspace","mcpServers":[]}}
{"jsonrpc":"2.0","id":5,"method":"session/close","params":{"sessionId":"agent:main:acp-smoke"}}

The OpenClaw ACP server response shape included the stable lifecycle capabilities and a Gateway-backed session list:

{
  "initialize": {
    "protocolVersion": 1,
    "agentCapabilities": {
      "loadSession": true,
      "sessionCapabilities": {
        "list": {},
        "resume": {},
        "close": {}
      }
    },
    "agentInfo": {
      "name": "openclaw-acp",
      "title": "OpenClaw ACP Gateway",
      "version": "2026.5.6"
    }
  },
  "listSessions": {
    "sessions": [
      {
        "sessionId": "agent:main:acp-smoke",
        "cwd": "/tmp/openclaw-acp-evidence-4jaUEQ/workspace",
        "title": "ACP seeded gateway session",
        "updatedAt": "2026-05-07T00:00:00.000Z",
        "_meta": {
          "sessionKey": "agent:main:acp-smoke",
          "kind": "direct"
        }
      }
    ],
    "nextCursor": null
  },
  "closeSession": {}
}

The same run captured ACP update notifications and the live Gateway log proof:

{
  "notificationTypes": [
    "session_info_update",
    "available_commands_update",
    "session_info_update",
    "usage_update",
    "available_commands_update"
  ],
  "gatewayLogTail": [
    "[gateway] ready",
    "[ws] ⇄ res ✓ sessions.list 305ms"
  ]
}

Note: the evidence smoke avoided openclaw gateway call sessions.list as the sole proof because that CLI path can request a fresh-token operator scope upgrade. The ACP bridge was verified through ACP stdio frames plus the live Gateway sessions.list response log.

Notes

  • No issue number is attached; this is the first implementation PR for ACP bridge compatibility work.
  • docs/refactor/external-scheduler-plan.md and docs/refactor/heartbeat-hosted-scheduler-notes.md remain local untracked files and are not part of this PR.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L maintainer Maintainer-authored PR labels May 7, 2026
@clawsweeper

clawsweeper Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

Summary
The branch adds stable ACP bridge session list, resume, and close handlers, session-store deletion, lifecycle/schema tests, ACP docs, and changelog coverage.

Reproducibility: not applicable. this is a maintainer feature and compatibility PR rather than a standalone bug report. Source inspection still confirms the current-main gap: OpenClaw pins SDK 0.21.0, whose dispatcher calls listSessions/resumeSession/closeSession, while current main only exposes unstable_listSessions for listing.

Real behavior proof
Not applicable: Maintainer MEMBER PRs are exempt from the external contributor proof gate, and the PR body still includes Testbox/Crabbox ACP stdio smoke evidence.

Next step before merge
No automated repair is needed; this automerge-opted maintainer PR should proceed through exact-head CI and merge gating.

Security
Cleared: The diff is limited to ACP bridge code, tests, docs, and changelog, with no dependency, workflow, secret, package, or release-supply-chain changes.

Review details

Best possible solution:

Land the bridge-local lifecycle implementation after exact-head checks finish, preserving the cwd/cursor filtering and close-cleanup regression coverage.

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

Not applicable; this is a maintainer feature and compatibility PR rather than a standalone bug report. Source inspection still confirms the current-main gap: OpenClaw pins SDK 0.21.0, whose dispatcher calls listSessions/resumeSession/closeSession, while current main only exposes unstable_listSessions for listing.

Is this the best way to solve the issue?

Yes; implementing the stable ACP methods in src/acp/translator.ts with session-store cleanup in src/acp/session.ts is the narrow maintainable boundary. The only remaining gate I saw is exact-head CI completion, not a code repair.

What I checked:

  • Protected maintainer PR: The live PR metadata shows authorAssociation MEMBER, the protected maintainer label, and clawsweeper:automerge on head 6323c6a. (6323c6ab7a7f)
  • Current-main ACP gap: Current main advertises session list capability but implements only unstable_listSessions in the ACP bridge. (src/acp/translator.ts:608, c41a73b82829)
  • Pinned SDK dispatcher contract: OpenClaw pins @agentclientprotocol/sdk 0.21.0, whose dispatcher calls agent.listSessions, agent.resumeSession, and agent.closeSession for session/list, session/resume, and session/close. (package.json:1680, c41a73b82829)
  • Stable lifecycle implementation: The PR head advertises list/resume/close capabilities and implements listSessions, resumeSession, and closeSession on the ACP bridge with cursor, cwd, resume, and close cleanup logic. (src/acp/translator.ts:676, 6323c6ab7a7f)
  • Session cleanup implementation: The PR head adds deleteSession to the ACP session store, reusing the existing removeSession path that aborts active controllers and clears run mappings. (src/acp/session.ts:171, 6323c6ab7a7f)
  • Lifecycle regression coverage: The PR adds tests for capability advertisement, filtered cursor pagination, missing-workspace filtering, resume without transcript replay, missing resume rejection, and close cancellation/deletion behavior. (src/acp/translator.lifecycle.test.ts:129, 6323c6ab7a7f)

Likely related people:

  • steipete: GitHub file history shows the original experimental ACP support and several recent ACP translator/docs hardening commits in the same bridge surface. (role: introduced behavior and recent maintainer; confidence: high; commits: de3b68740aa9, 20ed5974957f, c2e2b87f28f0; files: src/acp/translator.ts, src/acp/session.ts, docs/cli/acp.md)
  • obviyus: Recent ACP translator commits focused on reconnect, prompt lifetime, and pending-run lifecycle behavior adjacent to this PR's close and cancellation semantics. (role: recent lifecycle maintainer; confidence: medium; commits: 304da2cbd735, 73c1b458195a, d983970704c2; files: src/acp/translator.ts)
  • vincentkoc: History shows ACP docs maintenance and session-load replay fixes adjacent to the docs and resume-without-replay behavior changed here. (role: adjacent docs and session-load maintainer; confidence: medium; commits: 32fdd21c80fa, 742c005ac8bc, e85fd2abcda6; files: src/acp/translator.ts, docs/cli/acp.md)
  • amknight: The PR author also appears in current-main merged ACP-adjacent history, including a recent ACP control-plane fix, so they are a valid routing candidate beyond this proposal. (role: recent adjacent maintainer; confidence: medium; commits: fa445003b5eb, bf3b99437816; files: src/acp/control-plane/manager.core.ts, src/acp/control-plane/manager.test.ts)

Remaining risk / open question:

  • Exact-head GitHub checks still had queued jobs at review time; merge should wait for required CI to finish.

Codex review notes: model gpt-5.5, reasoning high; reviewed against c41a73b82829.

@amknight
amknight force-pushed the codex/acp-bridge-lifecycle-handlers branch from c098490 to b3b4725 Compare May 7, 2026 10:04
@amknight
amknight marked this pull request as ready for review May 7, 2026 10:11
@amknight
amknight force-pushed the codex/acp-bridge-lifecycle-handlers branch 2 times, most recently from 0759d3c to 039e1af Compare May 7, 2026 10:48
@amknight
amknight force-pushed the codex/acp-bridge-lifecycle-handlers branch from 039e1af to 089edb7 Compare May 7, 2026 13:26
@amknight

amknight commented May 7, 2026

Copy link
Copy Markdown
Member Author

/clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 7, 2026
@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper automerge is enabled.

  • Head: 6323c6ab7a7f
  • Label: clawsweeper:automerge
  • Action: exact-head review queued (workflow sweep.yml, event repository_dispatch).
  • Flow: review this head, repair/rebase only if needed, then re-review the exact repaired head before merge.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-05-07 13:52:20 UTC review queued 6323c6ab7a7f (queued)

@amknight
amknight merged commit 6a8b4e4 into main May 7, 2026
86 of 88 checks passed
@amknight
amknight deleted the codex/acp-bridge-lifecycle-handlers branch May 7, 2026 20:26
petermilord pushed a commit to petermilord/openclaw that referenced this pull request May 7, 2026
* Implement ACP bridge lifecycle handlers

* docs: add acp smoke evidence example

* docs: trim acp smoke example

* docs: remove acp pr plan file

* fix: tighten acp session list filters

---------

Co-authored-by: Alex Knight <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* Implement ACP bridge lifecycle handlers

* docs: add acp smoke evidence example

* docs: trim acp smoke example

* docs: remove acp pr plan file

* fix: tighten acp session list filters

---------

Co-authored-by: Alex Knight <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* Implement ACP bridge lifecycle handlers

* docs: add acp smoke evidence example

* docs: trim acp smoke example

* docs: remove acp pr plan file

* fix: tighten acp session list filters

---------

Co-authored-by: Alex Knight <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* Implement ACP bridge lifecycle handlers

* docs: add acp smoke evidence example

* docs: trim acp smoke example

* docs: remove acp pr plan file

* fix: tighten acp session list filters

---------

Co-authored-by: Alex Knight <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge docs Improvements or additions to documentation maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant