GeezerVison is showing github.com — Phase 4 (audit) of #4706 — closing state-and-route inventory + contract statement for the OpenClaw ACP adapter · Issue #4707 · developing-today/code
Phase 4 (audit) of #4706 — closing state-and-route inventory + contract statement for the OpenClaw ACP adapter #4707DescriptionPhase 4 (closing audit) of design #4706 — a prompt's state dies with the prompt: one server contract and one lifecycle for the OpenClaw ACP adapter (bin/opencode-acp-adapter.mjs). Design doc: files/designs/code-acp-adapter-prompt-lifecycle.md in the keep-the-four-repos-healthy goal workspace.
Gated on Phases 1–3 of #4706 landing (Phase 1 = #4614, the v2 server contract; Phase 2 = #4616 + #4618, scoped prompt state and the one terminal cleanup; Phase 3 = #4617, reconnect reconciliation). Do not start the audit before they land.
Scope
Produce the closing inventory for the adapter: every module-level state container and every serve route in bin/opencode-acp-adapter.mjs, dispositioned against the design contract — conforms / named exception, with the reason / gap, filed as a named follow-up issue. Rewrite the file's header mapping comment so it states the v2 contract and the prompt-lifecycle rules (scoped state, cancellation only for in-flight prompts, one terminal cleanup, lost continuity is terminal) instead of the v1 mapping it states today. The inventory is the deliverable; fixing a confirmed gap inside this issue is out of scope beyond a single-site slip (file it instead).
Required dispositions
- (a)
sessions map lifetime — entries are added at session/new and never removed; there is no session-close path. Disposition: is process-lifetime acceptable (the adapter exits with its ACP client), or does the shared standing server accumulate sessions it should be told to delete (the v2 DELETE /api/session/:id exists — see design Phase 1)? Answer from the acpx launch model, with evidence.
- (b)
pendingClientRequests cleanup — a permission request the ACP client never answers stays in the map forever and the permission reply is never posted. Disposition: bounded by what, and does the serve side's own permission expiry make that safe?
- (c) Permission flow's v2 shape — if Phase 1 (openclaw ACP adapter: use the standing server's v2 session API — v1 /session + prompt_async contract cannot create working sessions (#3997) #4614) did not land the permission-reply route's v2 form, disposition it here with evidence from the pinned server.
- (d)
partTextSent keying after Phase 2 — confirm the landed scoping matches design decision 2 ((session, part), removed only for the finishing session), and disposition any part-id collision risk across sessions that remains.
Acceptance criteria
Related
Design #4706; phases #4614 (Phase 1), #4616 + #4618 (Phase 2), #4617 (Phase 3); feature origin #1243. Activitydezren39 commented on Nov 3, 2026 agent-note:v1 — design-architect pass 41 (2026-11-02)
This issue is Phase 4 of design #DESIGN (a prompt's state dies with the prompt — one server contract and one lifecycle for the OpenClaw ACP adapter), filed by the design architect as the closing audit. It is gated on Phases 1–3 landing (Phase 1 = #4614, Phase 2 = #4616 + #4618, Phase 3 = #4617) and carries status/blocked for that gating. Triage: confirm the gating, record it, and enqueue the implementation follow-up packet once Phases 1–3 have landed — do not start the audit early, and do not re-litigate the decisions recorded on #DESIGN (flag genuine blockers there instead). dezren39 commented on Nov 3, 2026 agent-note:v1 — holder: repo-worker-code (task 6687; lane 7b47536b-c162-444c-be8a-3a9538cc4cb5), since 2026-11-03T01:43:11Z. Picked up for triage; checking current main and the Phase 1–3 landing gate before routing the follow-up. dezren39 commented on Nov 3, 2026 Triage verdict (task 6687): Phase 4 scope matches the closing audit in #4706. Fresh origin/main at 2be05f724 still shows the v1 /session and prompt_async routes and global partTextSent.clear() in bin/opencode-acp-adapter.mjs; Phases 1–3 have not landed.
Gate status: #4614 / PR #4698 (open), #4616 / PR #4629 (open), #4618 / PR #4642 (open), and #4617 / PR #4632 (open). The PRs are Drew-authored; #4632 also has another lane’s parked queue-task note. I am not touching or duplicating those PRs. This issue remains status/blocked; no audit or implementation follow-up is being started/enqueued before the gate clears. Resume when the four phase PRs merge / their issues close, then enqueue the closing-audit packet with the acceptance criteria above intact. dezren39 commented on Nov 10, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 10, 2026 agent-note:v1 — state: handed_off (task 12695, lane code-h)
dezren39 commented on Nov 10, 2026 agent-note:v1 — state: handed_off (task 12695, lane code-o)
dezren39 commented on Nov 10, 2026
Lane code-t picked up task 12695 (issue #4707) — handed off to opencode claimant.
dezren39 commented on Nov 10, 2026 agent-note:v1 — state: handed_off (task 12695, lane code-p)
dezren39 commented on Nov 10, 2026
🤖 Agent note · handed off
dezren39 commented on Nov 10, 2026 agent-note:v1
lane: code-x
task: 12695
issue: #4707
transition: handed_off
state: issue #4707 OPEN, no hard-stop labels, no status/needs-triage (verified fresh 2026-11-10). Gate still closed: issue #4617 OPEN and PR #4632 OPEN, so the Phase 4 closing audit cannot start yet.
next: opencode claimant launches the bound session for task 12695 (lane row 4508); scheduled shift is time-bounded, claimant is the persistent execution session. dezren39 commented on Nov 10, 2026 dezren39 commented on Nov 10, 2026 🤖 Agent note · handed off (task 12695, lane code-u)
dezren39 commented on Nov 10, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 10, 2026
🤖 Agent note · handed off to the opencode claimant
dezren39 commented on Nov 10, 2026 agent-note:v1
lane: code-o
task: 12695
issue: #4707
stage: parked
note: Phase 4 closing audit NOT STARTED — gate re-checked fresh 2026-11-10T19:52Z (task 12695, lane code-o, direct per #8187): PR #4632 is still OPEN (not merged) and issue #4617 is still OPEN. Per this task packet acceptance #1, the audit does not start until PR #4632 merges AND issue #4617 closes. Resume condition: both of those hold on a fresh check; then run the audit exactly as packeted (inventory + dispositions (a)-(d) on issue #4707, v2 header rewrite via branch + PR, summary on epic #4706, gaps filed as follow-ups). Parking task 12695 on this gate.
🤖 Agent note · parked (gate not cleared)
dezren39 commented on Nov 10, 2026 agent-note:v1
task: 12695
lane: code-n
stage: audit_complete
state: Phase 4 closing audit of #4706 COMPLETE. Gate re-verified fresh before starting: PR #4632 MERGED 2026-11-10T21:04:27Z, issues #4614 / #4616 / #4617 / #4618 all CLOSED. Audited at origin/main 9b65fa2, bin/opencode-acp-adapter.mjs (755 lines; line refs below are that revision — the audit PR's only change is the header comment, which shifts later lines by +31).
State-container inventory
| Container |
Site |
Disposition |
sessions Map |
:237, set at :627 |
Named exception adapter-side (process lifetime; adapter exits with its ACP client on stdin close/SIGTERM) + GAP serve-side: no DELETE ever — filed as #8313. See (a). |
pendingPrompts Map |
:238 |
Conforms (rules 2-4): registered before the prompt POST (:645), submitted gate for reconciliation, deleted by finishPrompt / submission-failure path (:655) / reconciliation. |
cancelledSessions Set |
:275 |
Conforms (rule 3, #4618 landed): added only while a prompt is pending (:670), deleted on every terminal path (finishPrompt :502, finishFromTerminalEvent, reconciliation :355, submission failure :656). |
staleTerminalFences Map |
:248 |
Conforms — new in Phase 3's PR #4632: one count per reconciliation finish, consumed (and deleted at zero) by the first later terminal event, arbitrated against GET /api/session/active. Residual: a fence whose late event never arrives persists per session for process life — same accepted process-lifetime class as sessions. |
pendingClientRequests Map |
:206 |
GAP: no timeout on the client wait — filed as #8314. See (b). |
partTextSent |
— |
REMOVED: no hits in the file. See (d). |
Credential cache (resolvedPassword/credentialResolved) |
:136 |
Conforms / named exception: resolved lazily once, process lifetime, never logged (#4615). |
Event-stream control (eventStreamReady, resolve fn, shuttingDown) |
:285 |
Conforms: process-lifetime stream bookkeeping, reconnect loop with 1s backoff, reconciliation on reconnect (rule 4). |
nextOutgoingId counter |
:205 |
Conforms: monotonic JSON-RPC id source, process lifetime by protocol necessity. |
Serve-route inventory (every serve call in the file)
| Route |
Site |
Disposition |
POST /api/session |
:622 |
Conforms v2: body location.directory, {data} envelope unwrapped in serveJson (:182). |
POST /api/session/:id/prompt |
:650 |
Conforms v2: body {text, files} (acpBlocksToPromptBody :563). |
POST /api/session/:id/interrupt |
:674 |
Conforms v2 (cancel path). |
POST /api/session/:id/permission/:permId/reply |
:465 |
Conforms v2: body {decision} — see (c). |
GET /api/session/active |
:264 |
Conforms v2: reconciliation + stale-fence arbitration read. |
GET /api/event |
:365 |
Conforms v2: SSE stream, session.text.* / session.reasoning.* delta model. |
DELETE /api/session/:id |
absent |
GAP — see (a) / #8313. No v1 route shape remains anywhere in the file. |
Required dispositions
- (a)
sessions lifetime: adapter-side process lifetime IS acceptable — acpx launches a fresh adapter per gateway session and the process exits on stdin close/SIGTERM (main). The accumulation risk is serve-side, not adapter-side: the standing serve is shared and the adapter never calls the v2 DELETE, so created sessions persist server-side past adapter exit. Confirmed gap, filed as ACP adapter: serve-side sessions are never deleted — sessions map has no close path (#4707 audit gap a) #8313 (first step there: verify whether the pinned serve expires idle sessions itself).
- (b)
pendingClientRequests: bounded only by process lifetime and by the count of permission asks — there is no adapter-side timeout, and no evidence in this repo that the serve expires an unanswered permission.asked. NOT safe as-is for the gated tool call: handlePermissionAsked awaits the client answer forever, so the reply is never posted and the serve-side call stays blocked until the session ends. Gap filed as ACP adapter: unanswered permission request leaks pendingClientRequests entry and is never replied (#4707 audit gap b) #8314 (bounded wait, then the existing reject path).
- (c) Permission flow v2 shape: LANDED in Phase 1 (openclaw ACP adapter: use the standing server's v2 session API — v1 /session + prompt_async contract cannot create working sessions (#3997) #4614).
permission.asked on the v2 event stream → ACP session/request_permission → POST /api/session/:id/permission/:permId/reply with {decision}, option mapping allow_once→once / allow_always→always / reject_*→reject (:437-470), and a failed client request already falls back to reject. Conforms; nothing left in v1 form.
- (d)
partTextSent after Phase 2: the container no longer exists. Phase 1's v2 event model made it unnecessary — the serve sends session.text.delta / session.reasoning.delta deltas (streamDelta :425 forwards them per session, only while that session has a pending prompt), so there are no client-side cumulative offsets and no part-id keying at all. The cross-session collision risk openclaw ACP adapter: finishPrompt clears streamed-text offsets for all sessions, duplicating the still-running session's text (#3997) #4616 fixed by scoping is eliminated by construction: nothing keyed by part id remains.
Header + tests
Issue #4707 closes via the audit PR (header) + this inventory; gaps live on as #8313 and #8314. dezren39 commented on Nov 10, 2026 agent-note:v1 — correction to the audit inventory (comment 6780224485), task 12695, lane code-n: four line citations were off by a few lines; exact sites at origin/main 9b65fa2 are: finishPrompt :474 (pending delete :477, cancel-marker delete :481); handlePermissionAsked :430 (permission reply POST :465); streamDelta :415; pendingPrompts.set :648; cancelledSessions.add :672 and its reconciliation delete :352. All dispositions stand as posted. The same correction applies to #8314's handlePermissionAsked cite (:430). dezren39 commented on Nov 10, 2026 agent-note:v1
task: 12695
lane: code-n
stage: done
state: task 12695 complete — outcome fixed_merged. PR #8315 MERGED 2026-11-10T21:57:02Z (merge commit db955de); issue #4707 CLOSED via the PR. Codex review on PR #8315: completed, has_any_findings=false. Adapter tests 22/22 pass on the laptop. Gaps filed: #8313, #8314. Stale in-flight labels removed in this pass.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|