You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ADR-027 W11 fix-up wedge #12. Two M4 polish gaps from v1.0.667 dev-box
smoke: context chip works now, but cancel-button stuck after MCP-tool
turns + token-flow pill blank.
- Cancel-button race: hookStop posted turn.result SYNCHRONOUSLY the
moment claude invoked Stop hook — before the JSONL tailer had a
chance to read + post the preceding assistant text frame. Wire seq
order: turn.result(N) → text(N+1) → usage(N+2). Mobile's
_isAgentBusy walks tail-first: usage skip (v1.0.667), text → busy.
turn.result at lower seq never reached.
Fix: emit turn.result from the JSONL's own system{subtype:
turn_duration} frame (LAST frame of a turn, written after text +
stop_hook_summary). Now turn.result has the HIGHEST seq, walker
hits it first, idle. Dropped turn.result emission from hookStop;
FSM transition kept.
- Token-flow pill: _TelemetryStrip gates on modelTotals.isNotEmpty,
populated only from turn.result.by_model (codex/claude stream-json
shape). M4's turn.result has no by_model. Pill suppressed even
though usage was flowing.
Fix: synthesise a _ModelTokens entry from per-message usage when
modelTotals is empty. SET semantics on every field (NOT add) so
the pre-v1.0.662 sum-across-tool-use-iterations bug doesn't
reappear. Bucket key = per-message model or "claude-code".
Tests: TestMapLine_TurnDurationSystemEmitsTurnResult (new mapper
shape), TestOnHook_StopOnlyTransitionsFSM (rewrites the
"hookStop emits turn.result" assertion to "hookStop posts nothing").
Latency note: turn.result lands ~250ms later than before (one
tailer poll-tick after turn_duration frame written), in exchange
for deterministic seq ordering against text/usage. Net win — the
prior fast-but-out-of-order path left the cancel button stuck.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments