Skip to content

openclaw ACP adapter: pending prompts are never reconciled when the SSE event stream reconnects (#3997) #4617

Open

Description

@dezren39

Finding (from PR review)

If the SSE event stream drops during an active prompt and the server completes that prompt before reconnection, the prompt's final session.idle event is lost and the ACP request hangs forever. Codex (P2, PR #3997):

This reconnect path neither resolves or rejects pending prompts nor queries their current status, and session/prompt has no other completion mechanism. The ACP request therefore remains pending indefinitely, with subsequent prompts rejected as already in flight even after the stream reconnects. Reconcile pending sessions after reconnecting, or explicitly fail their outstanding requests when event continuity is lost.

Evidence

Acceptance criteria

  • After an event-stream reconnect, pending prompts are reconciled against the server's current session state (resolved/rejected accordingly) or explicitly failed when event continuity was lost.
  • A test simulates a stream drop + completion during the gap and shows the prompt does not remain pending indefinitely.
  • Or the finding is resolved by a documented decision on this issue.

Activity

  1. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 2, 2026
  5. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — CONFIRMED on current main

    Fresh evidence (all read this shift via gh):

    Routing: a small_fix follow-up task has been enqueued from this triage: on event-stream reconnect, reconcile each pending prompt against the server's current session state (resolve/reject accordingly) or explicitly fail it when event continuity was lost, plus a drop-and-complete test using the existing stub harness. Note for sequencing: issue #4614 (triage task 6516) covers migrating this same adapter to the standing server's v2 session contract — if that migration lands first, implement the reconciliation against the v2 contract instead of the v1 prompt_async flow.

  6. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  7. 57 remaining items

  8. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-n
    • Session / ID: task 12170
    • Found via: queue claim
    • Task: triage of the remainder on issue openclaw ACP adapter: pending prompts are never reconciled when the SSE event stream reconnects (#3997) #4617 (openclaw ACP adapter: pending prompts never reconciled on SSE reconnect)
    • Verdict: REAL and CURRENT — confirmed against current main a23b3ce454:
      • bin/opencode-acp-adapter.mjs:196 — pendingPrompts Map (acpSessionId → {requestId}).
      • runEventStream (~lines 229–259) — on stream close/error it logs "reconnecting", waits 1s, and reconnects; it never reconciles, resolves, or rejects entries in pendingPrompts and never queries current session status. Entries are removed only on terminal serve events, prompt-post error, or cancel — all event-driven — so a terminal event lost during a disconnect still hangs the ACP request indefinitely and later prompts are rejected as already in flight.
      • PR fix(acp-adapter): migrate to the standing server's v2 session API (#4614) #4698 (v2 session migration) changed the event model but not this path; bin/opencode-acp-adapter.test.mjs (375 lines) has no reconnect/stream-drop test.
    • Routing: remainder converted to a fix packet — task 12842 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:4617), scoped to the reconnect-reconciliation remainder only. Per Drew's triage doctrine (code#7016), this triage completion does not close issue openclaw ACP adapter: pending prompts are never reconciled when the SSE event stream reconnects (#3997) #4617; it returns to the queue for real work as task 12842.
    • Expectation: task 12842 lands the reconciliation + reconnect test and closes this issue via a merged PR with a closing keyword.
  9. added
    status/triagedTriaged and routed (see agent note)
    and removed
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  10. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · picked up

  11. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · triaged (remainder after partial verification)

    Verdict: REAL AND CURRENT (verified fresh 2026-11-08, lane code-t):

    • Issue openclaw ACP adapter: pending prompts are never reconciled when the SSE event stream reconnects (#3997) #4617 is OPEN, no hard-stop labels. The Codex P2 finding from PR feat(openclaw): ACP-to-HTTP adapter so OpenClaw shares the standing opencode serve (#1243) #3997 (merged 2026-11-02 as-is; review thread discussion_r4437436115 never answered) is still live on origin/main b7b7f596e4e9.
    • Direct code evidence: in bin/opencode-acp-adapter.mjs, runEventStream's reconnect loop (~lines 230–262) logs "event stream closed; reconnecting", waits 1s, and retries — nothing reconciles, resolves, or rejects pendingPrompts on reconnect. Prompt completion is deferred entirely to serve terminal events (session/prompt registers pendingPrompts and returns undefined; finishPrompt fires on session.execution.succeeded/.failed), so a terminal event lost during a drop leaves the ACP request pending indefinitely, and the next prompt is rejected as already in flight (~line 469) even after reconnect.
    • Test home exists: bin/opencode-acp-adapter.test.mjs is on main alongside the adapter.

    Disposition: the fix packet for this issue already exists in the queue as task 12842 (dedupe repo-health:v1:fix:developing-today/code:issue:4617, queued 2026-11-08T04:59:48Z — my enqueue attempt deduped against it, no duplicate created). Its scope is the acceptance on this issue: reconcile pending prompts against server session state after reconnect (or explicitly fail them when continuity was lost), plus the drop+completion regression test, preserving the #4618 cancel-marker semantics. Issue #4617 stays OPEN.

  12. added
    queue/queuedHas a queued task in the Supabase agent queue
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/triagedTriaged and routed (see agent note)
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority/normalOrdinary priority (the default)queue/queuedHas a queued task in the Supabase agent queuesource/design-architectFiled by the repo design architect jobsource/pr-comment-reviewFiled by the pr-comment-review jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions