Skip to content

Don't let the phase stream's opening .idle end the iPhone's first dictation - #413

Merged
alexkroman merged 2 commits into
mainfrom
claude/fix-coordinator-release-flake
Nov 25, 2026
Merged

alexkroman merged 2 commits into
mainfrom
claude/fix-coordinator-release-flake

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

The failure

On #410, ios-sanitizers (address) failed in Dictation coordinator › "a release from the owner…". The 7 failed expectations:

  • The release was acked .nothingInFlight.
  • stopAccepted and stopAddress were never set.
  • No result was delivered.
  • The phase never reached .pasted, and the test ran out at 60 s.

#410 doesn't touch the iPhone, so the cause is on main.

The cause

DictationSession.phaseStream() starts by sending the session's current phase. DictationCoordinator.start() subscribes from a task, so a fresh session's .idle waits in the stream until that task next runs on the main actor.

A press accepted in that gap sets inFlight. Then the waiting .idle, which counts as terminal, renders and calls dictationEnded. That clears inFlight and stops the watchdog. The owner's release finds nothing in flight, and the session records until the test gives up. The address sanitizer's slowdown widens the gap enough for this to happen.

The fix

observePhases() skips the stream's first phase when it matches the phase the coordinator already shows, which on a fresh coordinator is .idle. A first phase that differs still renders, such as a press the session took before subscribing (.connecting, .recording, a readiness .failed) or a dictation that already ended. Skipping it has no side effects: start() publishes .idle itself, and the rest of dictationEnded does nothing on a fresh launch.

The swift6-concurrency-reviewer agent confirmed the diagnosis and that the fix is race-free. One case it can't tell apart is a dictation that ends with .idle (a too-short tap) before the observer's first subscription. That would need a press and its release both handled before the subscription's first hop to the session actor, which start() queues ahead of any command.

Testing

No new test. Making a press land between the subscription and its first render needs a hook in the coordinator; ownerRelease under the address sanitizer is the test that hits this. scripts/check.sh --portable passes; CI runs the Swift build and tests.


Generated by Claude Code

DictationSession.phaseStream() opens on the session's current phase. The
coordinator subscribes from start(), so a fresh session's .idle sat in
the stream until the observer next ran on the main actor; a press
accepted in that gap set inFlight, and the .idle (terminal) then rendered
and ran dictationEnded: inFlight cleared, the watchdog stopped, the
owner's release acked nothingInFlight, and the session recorded on.

That is the address-sanitizer failure of "a release from the owner" on
PR #410: commandAck .nothingInFlight, stopAccepted unset, no stopAddress,
no result, the phase never .pasted, the test out at 60 s.

The stream's opening phase now renders only when it differs from what
the coordinator already shows: a fresh session's .idle is no news, while
a press the session took first, or a dictation that already ended,
still renders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1TXn83VM7ihZ3iFgU5
SwiftLint's file_length (and check.sh's size budget) failed at 401.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1TXn83VM7ihZ3iFgU5
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit c110ea8 Nov 25, 2026
16 checks passed
@alexkroman
alexkroman deleted the claude/fix-coordinator-release-flake branch November 25, 2026 18:49
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Brings in #413's coordinator fix for ios-sanitizers (address). One
conflict: LibraryAccessibilityAuditUITests, where #405 added the Library
menus test and this branch the live-recording page; both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1TXn83VM7ihZ3iFgU5
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
… CI run

Recent multi-commit PRs (#410, #413, #414, #416, #420, #422, #423, #425, #426)
mostly spent their extra ~37-minute runs on things nothing caught before CI:

- scripts/check-swift-lint-lite.sh: a toolchain-free text match for the opt-in
  SwiftLint/swift-format rules it can see (modifier_order, no_empty_block,
  NoBlockComments, swift-format's `catch  where`). Run by check.sh (so
  --portable and --lint-only) and the swift-budgets edit hook; would have
  flagged the pre-fix files of #414, #422 and #425.
- .claude/hooks/push-gate.sh: a PreToolUse hook that runs
  `check.sh --portable` (~20 s) before any `git push` and blocks a red one —
  jscpd clones (#420, #422) and post-merge size overruns (#363, #378) were
  pushes that skipped the documented portable run.
- AGENTS.md / CLAUDE.md: a "Rules only CI catches" list for the rest
  (variable_shadowing, one_declaration_per_file, type_contents_order,
  multiline_function_chains, MemberImportVisibility, one argument per line),
  and the new hook and script in the hooks table and permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1UDUZXyuF6g7GUmmNu
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.

2 participants