Skip to content

openclaw ACP adapter: finishPrompt clears streamed-text offsets for all sessions, duplicating the still-running session's text (#3997) #4616

Closed

Description

@dezren39

Finding (from PR review)

When two sessions have prompts in flight, completing either one clears the streamed-text offsets for both, duplicating already-delivered text for the still-running session. Codex (P2, PR #3997):

The next cumulative text update for the still-running session is then emitted from character zero, duplicating content already delivered to its ACP client. Exercising the current handlers with session B emitting Hello, session A becoming idle, and B updating its part to Hello world produces the concatenated output HelloHello world. Keep offsets scoped to each session and remove only the completed session's entries.

Evidence

Acceptance criteria

  • Streamed-text offsets are scoped per session: finishing one session's prompt removes only that session's entries.
  • A regression test covers two concurrent sessions where one completes and the other's cumulative text update is not re-emitted from character zero.
  • 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. 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
  4. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked_up
    task: 6518 (repo-health-code-pilot; worker repo-worker-code; OpenChamber scheduled lane 02cafe76-eafd-4d0b-aaa6-2b7a737d68dc)
    action: triage revalidation against current source in progress.

  5. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: triaged
    task: 6518 (repo-health-code-pilot; worker repo-worker-code; OpenChamber scheduled lane 02cafe76-eafd-4d0b-aaa6-2b7a737d68dc)
    verdict: CONFIRMED on origin/main 12da950. bin/opencode-acp-adapter.mjs declares partTextSent as a shared Map keyed only by part.id (line 129); streamPartText(sessionId, part, delta) reads/writes that key without session scoping (221-228); finishPrompt(sessionId, ...) clears the whole map (286-291). This matches the two-session duplication report. Focused test file bin/opencode-acp-adapter.test.mjs exists; no open fix PR found.
    route: enqueued scoped small_fix task 6534 to key offsets by session+part and add the concurrent-session cumulative-text regression test. Note: the source issue is 4616; the packet's unrelated home/openclaw/default.nix scope entry was excluded from the follow-up.

  6. 52 remaining items

  7. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

    • Agent: fleet monitor
    • Session / ID: task 8434 (repo-fleet-monitor run 2026-11-05T15:45:48Z)
    • Found via: monitor reconciliation (Duty 1 claim/label divergence repair)
    • Task: Claim evaporated: task 8434 is queued and unclaimed in repo-health-code-pilot, but this issue still carried claimed labels. Labels reset to the truth (queue/queued + status/needs-triage). Checkpoint stage at evaporation: handed_off.
    • Expectation: The next lane claim picks task 8434 up from the queued state and posts a fresh pickup note.
  8. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Picked up by repo-worker-code-f — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-f posts progress markers; after 30 minutes of silence any other worker may pick this up.)

    Lane F shift 2026-11-06 fallback pickup: triage — verify that the openclaw ACP adapter's finishPrompt clears streamed-text offsets for all sessions, against current main.

  9. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    🤖 Agent note · picked up

  10. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 7, 2026
  11. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Progress from repo-worker-code-f: verified: NO LONGER REPRODUCIBLE — the cumulative-offset mechanism was deleted wholesale by the server v2 migration (commit 744ced9, #4614, 2026-11-03): partTextSent and its .clear() in finishPrompt are gone (0 occurrences repo-wide on main); streaming is now true per-session deltas. Next: closing this issue with the evidence.

  12. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    🤖 Agent note · done (triage verdict: NO LONGER REPRODUCIBLE — mechanism removed by the #4614 v2 migration; closing)

    Verdict: NO LONGER REPRODUCIBLE — the finding was accurate when filed; the mechanism it describes no longer exists

    Verified fresh this shift against current main (bin/opencode-acp-adapter.mjs, blob 59a1618a, 572 lines):

    • partTextSent has zero occurrences in the entire repo on current main (code search), and finishPrompt (lines 339-350) now touches only the finishing session's own state: pendingPrompts.delete(sessionId) and cancelledSessions.delete(sessionId).
    • The removal is attributable, not drift: commit 744ced90a (2026-11-03, "fix(acp-adapter): migrate to the standing server v2 session API (openclaw ACP adapter: use the standing server's v2 session API — v1 /session + prompt_async contract cannot create working sessions (#3997) #4614)") deletes the partTextSent Map, its offset arithmetic, and the partTextSent.clear() line from finishPrompt (all visible as - lines in that commit's patch for this file), replacing cumulative-part diffing with true delta events: session.text.delta → streamDelta(sessionId, 'text', data.delta), which forwards the serve-provided delta verbatim for that session only. There is no shared cross-session streaming state left to clear.
    • The sibling finding from the same PR, openclaw ACP adapter: cancellation marker survives a finished prompt and mislabels the next prompt as cancelled (#3997) #4618 (stale cancel markers), was fixed in the same window (commit 125418eee), and its guard comment is visible in the current finishPrompt.
    • Tests: bin/opencode-acp-adapter.test.mjs covers the delta-streaming path (session.text.delta → session/update, chunks joining to the full text). The two-session regression test the criteria named is moot: it would protect a shared offset map that the migration deleted; with per-session delta forwarding there is no offset to re-emit from character zero.

    Per this issue's own acceptance criteria ("or the finding is resolved by a documented decision on this issue") and the fleet rule that already-fixed issues close with evidence rather than manufactured work: closing #4616 as superseded by #4614. No reply is made to the source PR #3997 thread (pr-comment-review rules). If the adapter ever returns to cumulative part updates, the per-session scoping requirement in the criteria is the contract to reinstate.

  13. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Released by repo-worker-code-f (outcome: done). Triaged NO LONGER REPRODUCIBLE (verdict note on #4616: commit 744ced9 / #4614 deleted the partTextSent offset map and its cross-session clear; streaming is per-session true deltas on current main, blob 59a1618a). Issue closed with the evidence; no fix work remains.

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)source/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