Repository navigation
feat(mobile): the microphone owns the wake lock, and the stop reply carries the tail (OTA phase C, ruling 36) - #22072
Conversation
…uling 36) An open microphone holds the screen; a closed one gives it back. The lock lives in the device-side capture on both hosts — the shell's `native.audio.start|stop` handler and the native seam — so the page never decides anything about the screen. One tag per capture, minted by the module that owns the mic. Both captures give it back on every close path: a stop, a page session ending with the capture open, a device that would not begin, and an engine that throws after the capture is open, which now ends the capture rather than leaving it live. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…, ruling 36) `native.audio.stop` drains what the ring still holds into its own reply, so the page's `end()` is one verb: stop, hand the bytes on, done. The drain, await and read-once-more ordering goes with it, and so do `ending`, `reading` and `released` — three variables that existed only to order a last read against the stop and to stop a refused read re-entering `end`. The tail fields default rather than being required: the page updates over the air and the shell does not, so a page this new can meet a shell that answers `stopped` alone. That dictation loses its tail where a required field would have lost it the stop. The heap case from PR D's bot round cannot recur: `end` issues no read, and a stop reply carries no interruption, so the lane that re-entered is gone. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`finishingIdRef` tracked the dictation a stop was finishing, and every state it could name was already named: `cancel`, a disable, an unmount and a newer start each bump the generation or clear the active id, so the finish guard answered the same either way. Its one distinguishing arm released pending audio bytes for a dictation whose budget `closeDictationAudio` had just reset, and could subtract those bytes from a newer dictation's reserve. `acceptingChunksRef` stays: it is what stops a late microphone event being sent after the capture handed over its tail and before the finish goes out. `pendingChunksRef` stays: `stop` awaits it so the finish cannot overtake the last chunk send. The finish guard is pinned by a case that cancels while the finish is in flight; neutered, it reds. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The page never names the screen now. `native.wakelock.set` is gone with its schemas, its shell server, its grant rows and its harness entry; so are the page's keep-awake owner, the Android foreground re-acquire, and the `DictationKeepAwakeDevice` the capture contract carried. One module holds the screen — the device calls the microphone's capture makes — and both device-side captures share its one tag, because there is one microphone. Deleted: native-wakelock.ts (120), native-wakelock.test.ts (140), mobile-dictation-keep-awake.ts (248), mobile-dictation-keep-awake.test.ts (440), mobile-dictation-foreground-keep-awake.ts (78). With the tag pools gone, the desktop-start flow has one stale check instead of two, no startup budget to wait out and nothing to release. A source-scanning census pins it: no module under mobile/src or mobile/app but the one owner imports expo-keep-awake, and nothing anywhere names the retired verb. It reports the file and line, and checks the owner does import the package so the absence is the rule holding and not the match missing. KNOWN RED, reported and not recorded over: 25 golden cases in the speech.* families fail. The recorder adapter had to drop its keep-awake owner, which moves `adapterSha256` for every golden that mounts it, and the deleted owner's id minting shifts the deterministic random sequence, so the recorded `dictationId` values move too. No speech.dictation.* param, reply or operation changed. Awaiting the lead's call on a scoped re-record. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Baseline bumped to 491eb35 and the corpus recorded against it. Every changed line in `goldens/` falls into six classes and nothing else: baseline 1574 lines 787 goldens lockfileSha256 1574 lines 787 goldens adapterSha256 38 lines 19 goldens scenarioSha256 8 lines 4 goldens dictationId shift 728 lines 4 goldens keep-awake effects + renumbering 63 lines 2 goldens ---- 3985 lines, which is the whole diff `recorderSha256` is untouched: no recorder module outside `adapters/` moved. The id shift is attributable arithmetic, not a behaviour change. The recording scheduler seeds `Math.random` with an LCG from seed 1; replaying it gives draw 1 `8ig2henseon` and draw 2 `dakoxjr8wun`. The deleted keep-awake owner minted its id from draw 1 during the hook's mount, so the dictation id took draw 2. With the owner gone the dictation id takes draw 1, which is why four scenario steps that pinned the literal value move with it. `adapterSha256` covers `speech.setup-sheet` as well as the three dictation families, because one adapter module hosts them all. The two goldens with vanished effects also renumber the ordinals after them, which is what the removal of an entry from a sequential counter does. `lockfileSha256` is provenance that `compareGolden` copies from the actual and never fails on. It moves in all 787 files because main's own `mobile/pnpm-lock.yaml` has moved since the corpus was last recorded; this branch does not touch it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
One conflict, in config/scripts/mobile-web-app-session-terminal-closure.test.mjs: both sides rewrote the session-route module reading and its constant. Taken main's hunk whole, because it carries C7.7's reading and the new ROUTE_ENTRY list this branch knows nothing about. Ruling 36's own -2 goes back on top of it in the measurement commit that follows, with the number measured on this merge rather than summed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The merge brought in the session route's manifest entry, which names all four dictation grants including `native.wakelock.set`. This branch deleted that verb, so the row granted a page something the shell no longer serves. Ruling 32 item 6 said C7.7 takes the dictation grant from PR D's census in this merge; this is that. Nothing caught it automatically: the shell-side grant list is derived from the verb tuple and is already three, and the closure census holds a route to the grants it needs rather than refusing ones it does not. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Measured on this merge rather than summed: 4,331 modules, 989 local. Main is red here on its own pin. `3cfb070294` measures 4,333 / 991 against a committed 4,330, three modules this branch never touched — measured in a throwaway worktree detached at that commit, with the same generators run. This merge measures 4,331 / 989, and diffing the two local lists gives the difference exactly: `mobile-dictation-keep-awake.ts` and `mobile-dictation-foreground-keep-awake.ts` leave, and nothing joins. So the branch's own effect is the -2 ruling 36 implies, and repinning to the measurement is also what takes main's closure test green again. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
One conflict, the session-route closure pin again: #22067 repinned main to 4,333 while this branch pinned its own measurement of 4,331. Taken main's side here so the file is whole. The two provenances are combined and the number re-measured on this merge in the commit that follows, which is where the reading belongs. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ith #22067 Measured on this merge: 4,331 modules, 989 local, against main's freshly repinned 4,333 / 991 at `3cfb070294`. Both provenances kept. #22067 names the three `src/shared` modules #21924 pulled into the page closure, which is what made main's earlier 4,330 stale; this branch's own -2 is the page's wake-tag owner and its Android foreground re-acquire, deleted by ruling 36. Diffing the two local lists gives exactly those two leaving and nothing joining, so the number is a reading rather than 4,333 minus an argument. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Important
The move to "the microphone owns the screen" is sound, but one start-failure path now holds the screen with no owner: a dictationSessionStart failure after capture.open() never ends the capture, and the screen stays awake with an idle audio session until a cancel, retry, or unmount.
Reviewed changes
- The microphone owns the screen lock. A single
nativeMicrophoneScreenLockreplaces the page-facingnative.wakelock.setverb and both tag ledgers;open()/starthold it,end()/releasegive it back through a microtask queue. A source census pinsexpo-keep-awaketo the one device module and bans the retired verb name. - The stop reply carries the tail.
native.audio.stopdrains the ring intobase64/droppedBytes(bounded by the read budget, defaulting for an older shell), so the page's last read and itsending/reading/releasedordering are deleted. - Cleanup.
mobile-dictation-keep-awake.ts(+test),mobile-dictation-foreground-keep-awake.ts,native-wakelock.ts(+test),finishingIdRef, the desktop-start wake budget andkeepAwakeOwner, and the retired grant/closure rows are removed. - Fixtures. 787 golden JSONs move only their pinned
baselineandlockfileSha256; 25speech.*cases re-recorded.pilot-scenarios.jsonis pinned at branch commit491eb35b4d, with a repin-to-main PR to follow per precedent.
ℹ️ The shared screen lock has no ownership count, and its two captures are not actually guaranteed exclusive
nativeMicrophoneScreenLock is a module singleton whose held boolean and single orca-microphone tag are global. dictation-capture.ts and the shell's native-audio.ts both call hold(), and either's end()/release() clears the one flag — so the first release drops the screen for a capture still holding it. The docstring's "never open at once" is a navigation assumption, not something the lock enforces.
For a single session-route instance the native/page switch is exclusive, so this is latent. But two page-served session instances (each createNativeAudioCapture against the same singleton) or a native session retained under a page-served one can both hold it. It is reachable only in __DEV__ because loadMobileWebShellEnabled is dev-gated, so it does not ship — but the deleted per-dictation tag design composed correctly, and the stated justification ("two tags would let one of them give back a screen the other still wants") is backwards: expo-keep-awake keeps the screen on while any tag is held, so distinct tags are exactly what composes.
Technical details
# The single-tag lock is not a counted lock
## Affected sites
- `mobile/src/platform/native-audio-device.ts:36-46` — one `nativeMicrophoneScreenLock`, one tag, shared by both captures.
- `mobile/src/platform/microphone-screen-lock.ts:43-56` — `hold`/`release` key on one `held` boolean with no owner identity.
- `mobile/src/platform/dictation-capture.ts:21-22,35,49,59` — native composer holds/releases the singleton.
- `mobile/src/platform/native-audio.ts:118,152,210` — shell capture holds/releases the same singleton.
- `mobile/src/platform/use-native-device-verbs.ts:28` — one shell capture per page session, all against the singleton.
## Required outcome
- Concurrent holders must not clear each other's screen. Either the lock counts holders, or each device-side capture owns a distinct tag (the prior design's shape), or the mutual-exclusion invariant is enforced where the two captures are built rather than assumed.
- At minimum the docstring's rationale should match the real reason.
## Open questions for the human
- Is the mutual exclusion an invariant worth enforcing, or is `__DEV__`-only reachability enough to leave as-is with a corrected comment?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The hook opens the microphone before it asks the desktop for a session, so a refused session left the mic open — and, since the screen rides the mic, the display held until the user cancelled, retried, or the screen unmounted. The failure arm now runs the same `rollbackRecordingStart` the commit failure does, because "undo the capture this start opened" is one thing and the hook owns it; guarded like that arm, so a seam that throws on the way down cannot take the desktop cancel with it. Red-first on both hosts. Natively, a new test drives the real seam under the engine and keep-awake mocks: the refusal used to leave `initialize` with no `toggleRecording(false)` and a held screen. On the page, the mic control's own test over the port pair saw `native.audio.start` with no `native.audio.stop`. Two unit cases pin the call itself, including for a start nobody will report. Ruling 36's own words: mic closed means released. This closes the mic rather than adding a release beside it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Baseline bumped to a1bdee9 and the corpus recorded against it. The whole diff is two classes: baseline 1574 lines 787 goldens content 74 lines 1 golden `lockfileSha256`, `adapterSha256`, `scenarioSha256` and `recorderSha256` do not move: no lockfile, adapter, scenario or recorder module changed. The one content golden is `matrix-speech.dictation-start-speech.dictation.start-1`. Its failure partitions now carry a `rollback-recording` effect at ordinal 3, which is the capture being closed, and the `speech.dictation.cancel#1` entries after it renumber from 3,4 to 3,4,4,5 — the pool holds one entry per distinct content, so a partition whose ordinal moved stops sharing an entry with the one it used to match. Removing the new effect and ignoring ordinals makes the two recordings identical, checked by dereferencing every hash rather than by reading the diff. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Important
Round 1's fix closes the capture when the desktop start fails, but it does so unconditionally — including for a start that has gone stale — and the rollback reaches the one shared capture that a newer dictation can already own. A cancel-then-restart race can silently stop the newer recording and drop the screen it holds. One inline comment.
Reviewed changes
- Closed the capture on a failed desktop start.
startMobileDictationDesktopSession'sdictationSessionStartcatch now runs the guardedrollbackRecordingStart(), then clears the active id and cancels the desktop session, so the microphone and the screen it now holds are given back. - Added coverage. A new
mobile-dictation-native-start-failure.test.tsxdrives the real native seam under the engine andexpo-keep-awakemocks;mobile-dictation-mic-control.web.test.tsxgained the page-side failure case; two unit cases inmobile-dictation-desktop-start.test.tspin the rollback call. - Re-recorded fixtures. 787 goldens move only
baseline/lockfileSha256; one content golden (matrix-speech.dictation-start-speech.dictation.start-1) gains arollback-recordingeffect with renumberedspeech.dictation.cancelordinals;pilot-scenarios.jsonbaseline pinned ata1bdee9af9.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There is one capture seam and it carries no start identity, so round 1's rollback let a stale start's rejection end a live newer dictation: A opens the capture and waits on the desktop, the user cancels, B starts and is recording, A's request finally rejects and ends B's microphone and hands back B's screen. The rollback now runs only while this start is still the current one, which is what `wasCurrent` on the line above already reads; a stale failure still cancels its own desktop session and touches nothing else. Past the generation the capture was either already ended by whatever superseded this start, or belongs to the one that did. Red-first on both hosts, driving that exact sequence rather than a spy: the native test over the real seam saw the screen go `+ - + -`, and the page's mic-control test over the port pair saw a fourth `native.audio.` verb after B was recording. Both now end with B still holding what it took. The mirror image is covered and now pinned at host level too: A's request resolving late does not commit A over B, because the stale check after the desktop start returns through `cancelStaleStart`, which cancels A's session without touching the capture. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Baseline bumped to e17b2cf. Two classes, the whole diff: baseline 1574 lines 787 goldens content 74 lines 1 golden `lockfileSha256`, `adapterSha256`, `scenarioSha256` and `recorderSha256` do not move. The one content golden is `matrix-speech.dictation-start-speech.dictation.start-1`, whose scenario is the superseded start, so every partition in it is a stale one. The `rollback-recording` effect round 1 put there is gone, and the `speech.dictation.cancel#1` entries fold back from 4 to 2 as the ordinals after it renumber — the pool holds one entry per distinct content, so partitions whose ordinals agree again share an entry again. Dropping that effect from the superseded partitions and ignoring ordinals makes the two recordings identical, checked by dereferencing every hash. `speech-desktop-start-recording-failed` is untouched: that start still owns its capture at failure time, so it still rolls back. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Gated the stale-start rollback on ownership.
startMobileDictationDesktopSession'sdictationSessionStartcatch now runsrollbackRecordingStart()only whenwasCurrent; a start that has gone stale still clears its own id and cancels its own desktop session. This closes the round-1 finding — a stale rejection could end the one shared capture and drop the screen a newer dictation was holding. - Added real-seam regression coverage. The unit case at
mobile-dictation-desktop-start.test.ts:127is renamed and its assertion flipped tonot.toHaveBeenCalled();mobile-dictation-native-start-failure.test.tsxandmobile-dictation-mic-control.web.test.tsxeach drive A-cancel-B-A-rejects across the real seam (screen/calls/verbs unchanged, B still recording), plus a stale-success mirror on the native side. - Re-recorded the affected golden.
matrix-speech.dictation-start-...start-1loses the stalerollback-recordingeffect and its cancel ordinals fold back by one; both cancel entries remain. Adapter/recorder/scenario hashes are untouched. - Merged
origin/main(73b726c64f). Textual-clean; it brings the shell-switch pending state andpageReadyprojection, none of which overlap the branch's dictation or bridge files.
The new gate does not reintroduce the round-1 leak: every path that moves the generation (cancel, stop, the disable effect, unmount cleanup, failActiveDictation) either ends the capture already or hands it to a newer start, so a stale failure owns nothing. The commit-failure arm's unconditional rollback is safe because no await separates its isCurrentStart check from the synchronous commitRecordingStart.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…22101) #22072 re-recorded the speech.* goldens with baseline at its own branch commit e17b2cf, which the squash left unreachable from main. Bumped to main's tip 86b93e0 and re-recorded: the diff is the baseline header in 787 goldens and the manifest's baseline line, nothing else, so the recordings are identical and the skipped commits changed no observed behaviour. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
C8.1 (#22141) gave the manifest route an `optionalGrants` lane and put `externalNavigation` on the session route. Three files conflicted, all of them prose this branch had already rewritten. Resolved by taking both intents. The route table keeps this branch's corrected three-verb dictation sentence -- main's side still carried the four-verb text #22072 made stale -- and gains C8.1's `externalNavigation` paragraph whole. The call-site census and its test keep this branch's counts and gain the new grant: `externalNavigation` has a census of its own, so the set this file does not repeat grows from five to six while the rows here still pin eight of the session route's thirteen required grants. The census follows the tables rather than the prose: `censusedElsewhere` counts the required and optional grants no row pins, which is the set that sentence is about, and the route table's census gains a row for C8.1's "the one optional grant in this list". Every spelled count is true on the merged table; the fence is untouched because C8.1 added modules and no route, so the tree still builds 15 routes into 67 scripts against the envelope's 71. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…d sweep (OTA phase C, C7.8) (#22152) * fix(mobile): re-derive the web app script fence from the measured spread (OTA phase C, C7.8) `4r + 16` was a guess at break-even, and its slack ran from 17 scripts at one route to 4 at thirteen -- loosest where nothing is and tightest where the tree actually sits. Re-measured by building every prefix of the sorted route key list: 15 routes emit 67 scripts, and the marginal cost of a route runs 1 to 9 depending on what it shares, so no line through the route count is both an upper bound and a budget. The sweep is now the fence's only input. The envelope is the measurement plus one margin at the swept tree, growing by the worst route the sweep saw for every route past it, so a new route breaches it only by costing more than any route measured. The margin is four, which is the most the count has been seen to move at a fixed route count with no route added: the head that wrote the old fence read 32, 43, 61 and 69 at 8, 10, 12 and 14 routes where this one reads 34, 44, 57 and 65. Two-sided in the test, which is what stops the next bump: a build more than the margin under the envelope fails there too, so the fence has to be re-measured rather than raised. The route count stays the only term and the mermaid control still tells one artifact from 172 chunks. The shell-fit crossing comes in from 50 routes to 31 with it, because the envelope grants the worst swept route where `4r + 16` granted four. Byte budgets re-read from this build and unchanged: 8,053,438 of 9,437,184 total, 1,612,006 before the first route of the 3 MiB allowed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): spell the session route's grant counts off the table (OTA phase C, C7.8) #22072 deleted `native.wakelock.set` from the session route and left both prose counts behind: "Fourteen grants" for a list of thirteen, and "the four audio verbs" for the three that remain. The all-or-none reason went stale with them -- it argued from a screen free to lock, which is the verb that was removed, and the device side has owned that lock since. It now argues from the microphone a route granted two of the three cannot close. The census beside the route-declaration test is what stops the next one. It reads which number words appear before "grants", "audio verbs", "media verbs" and "or none" anywhere in the file and compares them with the list itself, so a second spelling left in place fails rather than passing on the first correct hit, and a comment rewrapped at a different column still matches. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): the four sibling comments spell their grant counts off the tables too (round 1) #22072 removed `native.wakelock.set` from the session route and left the count standing in four more files than the route table: "fourteen grants" in the call-site census and in the hop census, "the four audio grants" in the census and its test, and "the four audio verbs" on the bridge schemas. Each is now counted off the table it describes rather than copied beside it. The six-versus-eight split in the call-site census could not be re-derived -- its own "those eight" never summed to the six rows plus the audio grants, so it was wrong before #22072 too. It is replaced by what the tables say today: six rows pin eight of the session route's thirteen grants, and the other five have censuses of their own. Both numbers come from `PAGE_GRANT_CALL_SITES` and the route list, and the existing case that names six rows covering eight grants is what holds them. The census the route table got is now `spelled-count-census.mjs`, driven from three files instead of one. A phrase restated in a file collapses to one claim, so a header and a test name may spell the same count; a phrase with no number before it reads as the empty list, which no table count matches. The bridge test is the one site with no count left to pin: it names `BRIDGE_NATIVE_VERB_NAMES` instead, and a new assertion holds its own `AUDIO_VERBS` equal to that table's audio rows, so the cases below cannot pin one set while reading as coverage of another. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): count the session sentence off the session intersection (round 2) `'of the session'` was counted off every grant in `PAGE_GRANT_CALL_SITES`, which is not what the sentence it pins is about. A row pinning a grant no route declares -- the shell can serve a verb before a screen asks for it -- would have made the census demand the comment overstate what the session route has. Proved before fixing: adding `native.share.send` to the navigate row moved `pinnedHere` from eight to nine while the session intersection stayed at eight, and the census failed asking for "nine of the session route's thirteen grants" against a sentence that was right to say eight. With the intersection it passes under the same probe, and the failure moves to `'grants this file pins'`, which is about this file's rows and does correctly demand nine. The other three rows are left as they were, for the same reason read the other way: `'grants this file pins'` and `'did not'` are about the rows here, so they keep the full list, and `'have censuses of their own'` and `'are not repeated here'` already count the session grants no row pins. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin the two counts in this file's it titles too (round 3) The census pinned the JSDoc counts and stopped there, so "names six rows covering eight grants" and "reaches every one of the eight through the session route" were free to go stale. Shown rather than argued: with a ninth grant on a row and the header corrected to nine the way the old census forced, the suite went green with both titles still saying eight. `'grants this file pins'` becomes `'grants'`, which reads the header and that title as one claim -- they are the same number, and a row per site would have let them disagree while both passed. The session title takes the intersection, for the reason round 2 gave. Every other spelled number in the file is not a count of a table: "the two tables" is how many sources the census reads, and "the one it reads", "a new one cannot be missed", "any one grant went missing" and "every one of" are quantifiers with no table behind them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): count the session-route title off the rows it asserts over (round 4) `'through the session route'` took the intersection, but the title it pins heads an assertion that compares `grantsNeeded` with every row's grants. The title names the session route and is not a claim about it: it says the rows here are all reached through that route, so it moves when the rows move. In the divergence the JSDoc already described, the two parted. With a ninth grant on a row the assertion compares nine while the census held the title at eight and passed, leaving a title reading below the assertion under it. Exactly one row takes the intersection now, the `.mjs` sentence for how many of the session route's grants these rows cover, and the JSDoc says so rather than describing a rule with two members. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): two wording fixes, and the byte readings re-measured on the merge (round 5) pullfrog on the census JSDoc, both correct. "make the census demand overstates" was a finite verb where the bare infinitive belongs. "Every other row counts the rows here" was contradicted by its own table: the rows reading the route's list and the rows counting grants no row pins take neither count, so the sentence is scoped to the rows that choose between the two and says what the rest read. The two byte readings in the fence doc are re-measured on the merged tree, since they name a head: 8,055,568 of 9,437,184 total and 1,612,253 before the first route. C8.1 added no route, so the sweep and the envelope are untouched and the tree still builds 15 routes into 67 scripts. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

Ruling 36: mic open means screen held, mic closed means released, and the page never names the screen.
What the user gets. The screen stays awake exactly while the microphone is open, and is given back the moment recording stops rather than held through transcription. A dictation cancelled mid-startup, a page swiped away mid-capture, or an engine that throws after the mic opens all release it, because the release is the capture's own. The end of an utterance no longer depends on the page fetching it:
native.audio.stopdrains the ring into its own reply, so the last half second of speech comes back with the stop.Why. The landed shape (PR D, #21905) kept two ledgers of what the device held, one on the page and one in the shell, plus a four-flag drain ordering on stop: seventeen ordering variables, eighteen defects across four review rounds, the worst two a page dying of heap exhaustion in a minute and a screen lit for the app's lifetime. Ruling 31 stands: native provides capabilities, the page the product. The lock is a property of the microphone capability, so it lives inside the capture's own start and stop, on native and shell alike.
What was deleted.
native.wakelock.setwith its schemas, shell server, grant rows and harness entry;native-wakelock.ts(120) and its test (140);mobile-dictation-keep-awake.ts(248) and its test (440);mobile-dictation-foreground-keep-awake.ts(78); theDictationKeepAwakeDeviceon the capture contract. On the page seam,ending,readingandreleasedand the drain/await/read-again ordering; in the hook,finishingIdRef, which ordered nothing the generation and the active id did not. The desktop-start flow loses a startup budget, a stale check and every release. Net 937 insertions, 1,907 deletions. Kept:timer,acceptingChunksRef(stops a late microphone event after the tail was handed over),pendingChunksRef(stop awaits it so the finish cannot overtake the last chunk).The additive reply field.
native.audio.stopanswersbase64anddroppedBytesbesidestopped, bounded by the same 160,000 B budget a read is. Both default rather than being required: the page updates over the air and the shell does not, so a page this new can meet a shell that answersstoppedalone. That dictation loses its tail where a required field would have lost it the stop.The census. A source scan pins that no module under
mobile/srcormobile/appbutnative-audio-device.tsimportsexpo-keep-awake, and that nothing anywhere names the retired verb. It reports file and line, and checks the owner does import the package, so an absence is the rule holding rather than the match missing.Goldens. Twenty-five
speech.*cases re-recorded, scoped: the recorder adapter dropped its keep-awake owner (movesadapterSha256on every golden mounting it) and the deleted owner's id minting shifted the recorder's deterministic sequence (recordeddictationIdvalues move). Nospeech.dictation.*param, reply or operation changed;recorderSha256untouched. The diff is classified line by line in the re-record commit.baselineis pinned at this branch'se17b2cf603, so a repin-to-main PR follows the squash (#21588, #21690 precedent).Round 1 (pullfrog on
21456df196). A desktop start that failed after the microphone opened used to leave it open; with the screen now riding the mic that became a held display, so this PR closes the capture on that path rather than filing it: thedictationSessionStartcatch runsrollbackRecordingStart(), the seam the commit-failure arm already uses. Red-first on both hosts. One golden moved (matrix-speech.dictation-start-speech.dictation.start-1: arollback-recordingeffect on the failure partitions, with the cancel's ordinals renumbered); re-recorded withbaselinebumped toa1bdee9af9; the diff is 1,574 baseline lines plus 74 content lines in that one file, verified by the lead.Round 2 (pullfrog on
b310033ef3). A stale start no longer rolls back: the one capture seam carries no start identity, so only a start still current at failure time ends the microphone it opened; a stale failure cancels its own desktop session and touches nothing else. Red-first on both hosts by driving A-cancel-B-A-rejects over the real seam (native: the screen went+ - + -, B's release; page: a fourthnative.audio.verb after B was recording). The mirror image, A resolving late over B, was already routed throughcancelStaleStartand is now pinned at host level. The corpus moved with the fix: every partition ofmatrix-speech.dictation-start-speech.dictation.start-1is a stale start, so round 1'srollback-recordingeffect leaves and the cancel's ordinals fold back; re-recorded withbaselineate17b2cf603, 1,574 baseline lines plus 74 content lines in that one golden, verified by the lead.Closure pin. Measured on the merged head: 4,331 modules / 989 local, against main's 4,333 / 991 (#22067). Diffing the local lists names the difference exactly:
mobile-dictation-keep-awake.tsandmobile-dictation-foreground-keep-awake.tsleave, nothing joins.Semantic conflict with C7.7, resolved here. C7.7's session route row in the page-route manifest granted all four dictation verbs, including
native.wakelock.set, which this branch deletes; the merge did not flag it because the shell-side list derives from the verb tuple and the closure census checks the grants a route needs rather than ones it must not carry. Dropped ina44afc1c03(ruling 32 item 6).Commits
0f32a31a39c5f8db40b1bfb63e2f0b491eb35b4d877c3afa7f491eb35b4d; 3,985 diff lines in six classes,recorderSha256untouched6e10cd4ebforigin/main(3cfb070294, C7.7); one textual conflict on the closure pin, main's hunk takena44afc1c032210148d1a993f2d2319origin/main(d40aac0a58, #22067); pin conflict, main's side taken21456df196851c637396origin/main(9fea4d1ade), no conflictsa1bdee9af9native.audio.startwith no stopb310033ef3a1bdee9af9e17b2cf603e94cca7631e17b2cf6031280163192origin/main(73b726c64f), no conflictsGates
Lane gates all exit 0 on
21456df196. Lead gate on21456df196againstd40aac0a58: tsc, ratchet, oxlint, format, anti-slop, both changed-code gates, react-doctor all 0;config/scripts248 files passed; mobile 801 files passed; no machine paths.Lead gate on
b310033ef3against9fea4d1ade: all lint gates 0;config/scripts248 files passed; mobile 802 files passed; no machine paths.Lead gate on
1280163192against73b726c64f: all lint gates 0;config/scripts249 files passed; mobile 804 files passed; no machine paths.