Skip to content

fix: amplifier panes no longer stuck blue on provider errors - #639

Merged
danshapiro merged 8 commits into
mainfrom
the-usual/amplifier-stuck-busy
Aug 11, 2026
Merged

fix: amplifier panes no longer stuck blue on provider errors#639
danshapiro merged 8 commits into
mainfrom
the-usual/amplifier-stuck-busy

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Problem

Freshell derives busy/blue status for amplifier terminal panes by tailing the Amplifier CLI's events.jsonl. The reducer entered busy on prompt:submit but cleared it ONLY on prompt:complete/session:end (or PTY exit).

When an amplifier turn dies on a provider error (observed live: Anthropic mid-stream overloaded_error), the CLI writes provider:error + orchestrator:complete but never prompt:complete — so the pane stayed stuck blue forever (the 120s deadman deliberately never fabricates completions).

Verified against a real stuck session: 6 prompt:submit vs 5 prompt:complete, log ends at orchestrator:complete.

Solution

Teaches BOTH event reducers to treat orchestrator:complete as a turn-end boundary:

  • Node reference: server/coding-cli/amplifier-events-reducer.ts
  • Rust production: crates/freshell-activity/src/amplifier/reducer.rs (kept 1:1 sync)

Implementation details

  • Sub-agent guard: orchestrator:complete with non-null parent_id ignored (delegate-heavy turns can't clear busy early)
  • Exactly-once completion: prompt:complete + orchestrator:complete on the same turn = one turn-complete, no duplicate chime; no-op while idle
  • Prefilter widening: Both file tailers' prefilters widened to pass the event through
  • No fabrication: orchestrator:complete is a real turn-end record written by the CLI itself, consistent with the "never fabricate a completion" policy

Testing

  • Integration, WebSocket, and browser e2e tests added
  • Docs updated
  • Evidence: Census of 4,718 real turns — 3.3% end with no prompt:complete (the stuck class); only 0.064% stray mid-turn events (worst case: idle a few seconds early)

Reviews

  • Plan review + delta review both passed round 1
  • Full suite green:
    • Client: 4906
    • Server: 4953
    • Electron: 350
    • Cargo: 663
  • Independent whole-branch review verdict: ready to merge

…tion findings

Full-corpus census (16,326 files / 4,718 root turns) refines the stray rate
to 0.064% (3/4,718, statuses success x2 / error x1 - no status gate can
block them) and adds the 3.3% OC-no-PC exposure figure; CLI source reading
confirms orchestrator:complete emission is structural (always-path in
loop-streaming _execute_one_turn) while falsifying cross-orchestrator
uniformity (loop-agent never emits OC - boundary set is additive, so no
regression); parent_id confirmed session-scoped (delegate:* uses
parent_session_id); spec text now pins verified versions (CLI
2026.08.05-5462f1e, core 1.6.0, schema amplifier.log 1.0.0, loop-streaming
e5438b4c9) and documents residual hard-cancel/goal-mode gaps; e2e local run
feasibility verified (chromium-1208 present, --list discovery green); fixed
a 2-space over-indent in the Task 6 Site D needle.
@danshapiro
danshapiro merged commit 9897cca into main Aug 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant