Skip to content

provider-acp silently drops agent-initiated turns (unprompted session updates, e.g. OMP async-job delivery) #2122

Closed

Description

@bradhallett

1. Summary

An ACP agent that emits session updates with no prompt in flight — i.e. an agent-initiated (unprompted) turn, such as OMP's async-job auto-delivery resuming the agent after a background job settles — has all of that output dropped by the provider-acp bridge. The agent runs, streams text and tool calls, and the bb thread shows nothing: no turn, no message, no error. The work is silently lost.

2. Versions and environment

  • bb 0.39.0 (desktop app, macOS 15 / Darwin 27, arm64); code path re-verified against main at c9aef75145268906a58c054641e183ee89418847.
  • Provider: OMP (oh-my-pi) 17.4.0 (Homebrew) over the ACP bridge (omp acp). Any ACP agent that produces unprompted updates is affected; OMP is the concrete case because its async-job completion follow-up turns are agent-initiated by design.
  • Nothing unusual: local daemon, default data dir, tools.approvalMode: yolo (rules out permission stalls).

3. Steps to reproduce

Closest faithful repro is a unit test at the exact code path (live repro needs OMP; marked unverified live beyond the observation below):

  1. pnpm -C plugins/provider-acp test with a test that, after a normal prompt turn completes, drives handleLine with unsolicited session/update notifications: a user_message_chunk (OMP echoes the injected job result) followed by agent_message_chunks.
  2. Before the fix: zero turn/started / item/* events reach the thread — the updates vanish.
  3. After the fix (branch fix/acp-agent-initiated-turns on my fork): the bridge opens a vouched turn, the chunks render as an agent message, and the turn settles.

The fake-agent behaviors spontaneous-stream:N / spontaneous-noise in src/bridge/fake-acp-agent.mjs on that branch encode this wire shape exactly.

Negative space: updates arriving while a prompt is in flight render fine; the drop only affects the no-prompt-in-flight window. Non-work updates (e.g. available_commands_update, usage_update) are correctly invisible either way.

4. Expected vs actual

Observed live (thread thr_8c5qxujrpw), from the events table in ~/.bb/bb.db:

turn/completed                          bt1113dc70-1-2   created_at 1787273348808  (00:49:08Z)
                                          <- OMP job bg_4 settles 00:49:21Z; agent runs an
                                             unprompted follow-up turn and streams a response ->
client/turn/requested                                     created_at 1787274074384  (01:01:14Z, next user message)

Actual: zero persisted events between those timestamps — no turn, no items, no error. Expected: a turn containing the agent's async-delivery message, same as any other agent output.

5. Evidence

  • Root cause, pre-fix on main @ c9aef75:
    • handleAgentNotification forwards session/update to the translator with no turn bracketing when no prompt is in flight (ACP itself sends no turn_started for agent-initiated output).
    • noTurnFallbackFor classifies those updates unhandled with onlyIfNoTurn: true — invisible by design for noise, fatal for real agent work.
    • user_message_chunk is classified as noise (input-echo suppression), which is correct for echoes and also swallows OMP's async-result injection — but the message chunks alone already carry the loss.
  • Provider-side confirmation: a standalone probe against omp showed the agent emitting user_message_chunk + agent_message_chunks after session/prompt returned — the bytes reach the bridge and are dropped there.
  • The sanctioned escape hatch already exists: docs/provider-bridge-protocol.md turn lifecycle rule 3 permits bridge-emitted turn.open for turns the user did not initiate (the compaction path already uses it; the claude-code translator auto-opens turns on streamed text).

6. What I ruled out

  • Not a permission/approval stall: approvalMode: yolo, no pending permissions at the time.
  • Not daemon/provider reaping: the omp acp provider process for the thread stayed alive across the window (verified by PID/elapsed).
  • Not OMP failing to emit: wire probe shows the updates on stdout.
  • Not the DB write path: streaming deltas during prompted turns persist fine in the same thread.
  • Searched open/closed issues; nothing covers unprompted ACP session updates being dropped.

7. Suggested priority and effort

Hits every OMP-over-ACP user who uses background jobs (auto-delivery is OMP's core resume mechanism); output is silently lost with no user-side workaround; fix is bridge-local with no wire changes. I'd guess P1-ish, small effort. Suggested fix in the linked PR: the bridge vouches the turn (emits the existing bridge turn-started command) when idle agent-work updates arrive, settles it on a quiet window / before the next bb-initiated turn / on stop; non-work updates stay noise.

AGENT GENERATED: by zai/glm-5.3

Activity

  1. added theissue type on Aug 21, 2026
  2. added
    providers
    provider-acp
    omp
    on Aug 21, 2026
  3. SawyerHood commented on Aug 21, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2122.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): The ACP bridge forwards unprompted session/update work with no turn.open (it only opens turns for prompts it sent), so the runtime delta assembler's no-turn rule demotes every agent_message_chunk/tool_call to a thread-scoped provider/unhandled row, which the timeline hides unless showUnhandledProviderEvents is on.
    • Linked PR review: Vouch agent-initiated ACP turns so async job delivery renders #2123 → REQUEST CHANGES — A vouched (agent-initiated) turn is never settled when the agent process exits: removeSession clears spontaneousTurnOpen without emitting a boundary and emitSessionError skips the settling error because activePromptKind is null, so the thread hangs in 'Working...' forever (confirmed live and by a fa
    • Proposed fix: In plugins/provider-acp/src/bridge/bridge.ts, fold agent-initiated turns into the existing open-turn mirror (activePromptKind: 'turn' | 'compaction' | 'agent' | null) instead of a parallel boolean; in handleAgentNotification open the turn (emit ACP_TURN_STARTED_METHOD) when activePromptKind is null and the update is a work kind derived from visibility.ts's normalized kinds; settle it on every exit path: before the next turn/start or compaction (end_turn), on thread/stop interrupt (cancelled), and on agent exit/emitSessionError (emit the settling error while the turn is still marked open); trea…
    • Caveats: No real OMP async-job session was driven (costs usage; machine has omp 16.3.10 vs the reported 17.4.0); the repro uses a scripted fake ACP agent emitting the wire shape the issue describes, run against the real bridge, real assembler, and a real dev instance. The issue's 'zero persisted events' claim is refuted on fcada5a: chunks persist as provider/unhandled rows that production hides (showUnha…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  4. added
    confirmed-repro
    on Aug 21, 2026
  5. self-assigned this
    on Aug 21, 2026
  6. bradhallett commented on Aug 24, 2026

    @bradhallett
    ContributorAuthor

    Correction to §5 ("zero persisted events"), confirmed against the reproduction report: pre-fix on current main, the unsolicited chunks do persist — as thread-scoped provider/unhandled rows that the timeline hides unless showUnhandledProviderEvents is enabled. The user-visible outcome is unchanged (dropped work), but the events table contains the rows.

    #2123 is being updated to settle vouched turns on every exit path — including agent exit and session errors, per the report's hang finding — and will document the changes on the PR.

  7. bradhallett commented on Aug 26, 2026

    @bradhallett
    ContributorAuthor

    Live production specimen on OMP 18.0.5 — it confirms a frame-level dead end for the bracket approach on current omp, and the structural fix is now tracked on both sides.

    Timeline (production thread thr_5esghkmr5x on acp-omp, bb 0.40.1-nightly, all UTC 2026-08-26):

    00:50:37    turn/completed — orchestrator ends turn, 2 background agents in flight
    01:01–01:04 agents finalize inside OMP
    01:05:32–53 OMP's detached resume completes: gate passes, commit 75e0691 lands
                01:05:34 (14 files, +793/−149), close-out written to the OMP
                session transcript only
    bb events:  zero turn events; one acp/fs/write at 01:05:32 as a hidden
                provider/unhandled row; no session/update of any kind
    

    The work shipped; the thread never reported it. Two consequences:

    1. The vouched-turn bracket can't catch 18.x. Bracket agent-initiated ACP turns so unprompted work renders #2220's own verification already observed real omp "never emit[s] session/update once a session/prompt has settled — omp's ACP prompt handler returns early"; this is that behavior in production, on 18.0.5, with the follow-up turn fully completing invisibly. There are no frames to bracket. My second hardening suggestion on Bracket agent-initiated ACP turns so unprompted work renders #2220 (classify acp/fs/write as agent work) would have opened a bracket around the file write — but the orchestrator's close-out message still never crosses the wire, so at best you'd render an empty-looking turn around a commit. The bracket remains the right fix for any agent that does stream unprompted updates (omp 17.4.0 did); it just can't reach the current one.

    2. The delivery has to originate agent-side. OMP tracks it at ACP: async-job auto-delivery turns reach clients unbracketed; allowAgentInitiatedTurns never enabled can1357/oh-my-pi#9157 — maintainer weighing (a) wait for ACP v2/RFD, (b) private _meta capability, (c) restore in-prompt draining. (b) is endorsed there with a full wire design: capability-gated _-prefixed wake notification + parked delivery, answered by a client session/prompt. The bb consumption half — routing _-prefixed notifications (today handleAgentNotification drops them), synthetic resume via the provider-retry send path, and backgroundTask materialization so activeBackgroundAgentCount counts ACP agents — is filed at provider-acp: no consumption path for agent-wake notifications — ACP agents with settled background work can't be resumed (OMP async-job delivery) #2461. The busy-rejection hardening from my Bracket agent-initiated ACP turns so unprompted work renders #2220 comment stays necessary under that design too: a wake racing a user prompt into omp's Agent is already processing rejection should queue-and-retry, not fail the synthetic turn.

    #2122 stays open as the right tracking issue for the rendering layer (any agent emitting unprompted session/update still needs the bracket); the 18.x delivery loss routes through #2461 + the OMP side.

  8. added a commit that references this issue on Oct 10, 2026
    fe1a02d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-reproompprovider-acpproviders

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions