Repository navigation
fix(dashboard): keep voice ownership through a mode flip under a live batch capture - #22603
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff adds one condition to a hook's ownership-clear effect plus a test. It adds or changes no control, string or markup, so no screenshot or recording is needed. [UX-REVIEWED] a961005 Description read[DESCRIPTION-READ] c437d701552bb4914a67fc7a59ee5e1c260cc7cc3d6a042f0713a41b5d5aca66 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This is a one-term fix at the mechanism level for a linked issue (#14163). It ships a regression test that fails on the base, and it adds no new surface. What this change shipsInventory (2 items) — 2 justifiedIntent: keep the mic showing "recording" for a live capture when the user flips the streaming setting mid-recording. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] a961005 Description read[DESCRIPTION-READ] 6be6532d29e950b70a2c8289187c3a1316184b741e4f71a3428501346967affb That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The guard now checks the recorder that is actually running, not the saved setting, which is the cause of the bug, and the change is one added condition. Notes
[DESIGN-REVIEWED] a961005 Description read[DESCRIPTION-READ] 563be40bedd5916f71a507493f57adf6e4dc9c16143bb9bf2b837580a45e8e07 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
abc5bcc to
1d6a292
Compare
|
Frontend Tests (1) / Frontend Coverage Merge red on 1d6a292 is main's, not this PR's: |
1d6a292 to
a961005
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: useVoiceInput's ownership-clear effect now also requires the batch recorder to be idle, so turning streaming on in Settings during a live batch capture no longer clears the owner of that recording; a test reproduces the mode flip.
Problem / Motivation
Goal: A live voice capture keeps its session owner when the streaming preference is flipped mid-recording, so the mic never reads idle while it is still recording.
In
useVoiceInput, an effect clears voice session ownership whenever the streaming preference is on and no stream session is in flight. The condition reads the saved preference (streamEnabled) as a stand-in for "this hook owns a stream" — but that is equally true of a live BATCH capture while the preference says streaming. Flipping the setting to streaming under a live batch capture fires the effect and nulls the owner of a recording that is still running.Why it matters
useComposerVoicegatesvoiceRecordingon ownership, andChatInputreadsvoiceRecordingfor the pulsing red mic button, therecording_click_mic_to_stopplaceholder, the Escape-to-cancel handler and the dictation panel'srecordingprop. With the owner nulled, every one of those reads idle while the microphone is still capturing — a privacy-relevant UI state where the interface reports no recording during a live capture.Not a goal
voiceRecordingis owner-gated at all, or the cross-slot attribution semantics of ownership.What changed (motivation → approach → change)
The mic button read idle during a live batch capture after the streaming setting was flipped. The root cause is the ownership-clear effect in
website/src/hooks/useVoiceInput.tsrouting on the saved preference (streamEnabled), which describes the transport the next utterance will take, not the one in flight — the same class of defectstop(),cancel()andisRecordingalready avoid by routing on the transport in flight. The change conjoins the first-hand batch recorder flag: the effect now clears the owner only whenstreamEnabled && !streamRecording && !streamDraining && !recording && !startingRef.current, so a live batch recorder keeps its owner. The effect only ever touchedsessionOwner, so this never stops a capture; it only stops the owner being nulled under one.Backwards compatibility
Compatible: the effect still clears a genuinely stale owner in every case it did before; the added
!recordingterm only withholds the clear while this hook's own batch recorder is live, which is exactly the capture whose owner must not be dropped.Removes nothing: no path, record, key or function is removed, hidden or renamed — one AND term is added to an existing effect's guard.
Tests
Added a regression case to
useVoiceInput.transportAnchoredCancel.test.tsx, whose flip harness already drives this scenario: it starts a batch capture owned byslot-A, flips the streaming setting ON while the recorder is live, and asserts the owner is stillslot-A, the recorder is stillrecording, and therecordingflag the mic button reads is still true. Proven to catch the bug: with the production guard reverted the new test fails withexpected null to be 'slot-A', and passes with the fix. Deterministic — driven by awaited React state viarenderHook/act/waitFor, no timers or sleeps.Manual verification
N/A — unit coverage sufficient. The flip window is not reachable in the product today (navigation unmounts the composer, which stops the recorder), so the behaviour is exercised at the hook with the test harness that reproduces the flip directly.
Screenshots / video
Why no screenshot: The change is a hook-state guard that keeps
sessionOwner/voiceRecordingat their correct values in a window not reachable in the product today; it renders no new or changed markup, layout or styles, so there is no visual delta to capture.Related Issues
Fixes #14163
Pattern harvest
Rule candidate: an effect or handler that clears/routes in-flight capture state must gate on a first-hand signal of what is actually in flight (
recording/streamRecording/streamDraining), never on the saved preference (streamEnabled), which describes the next utterance's transport — the same anchoringstop(),cancel()andisRecordingalready apply.Pattern:
useEffectclearing/deciding live-capture state off a settings flag instead of the first-hand in-flight flag.