Skip to content

ui-react: same-page recording lock contention is reported as another Brain tab #3326

Closed

Description

@schlessera

Context

Found while working #1266. That issue's failure was in the test fixture: it called discard directly while the page's own mounted tray recovery still held the native recording lock. The fixture now waits for that recovery (#3327, merged). This note records a related product observation that #1266 does not change.

Observed in source (first at epic/578-offline-transitions a62db8f27; re-verified unchanged at main 3d3516a02):

  • Every recording mutation and recovery takes brain-ui:recording without waiting (async function acquire, packages/ui-react/src/lib/recordings.ts:206-216). When the lock is unavailable, it always rejects with Recording in another Brain tab (line 210), whoever holds it.
  • The holder can be the same page. During a run on the pinned image, the ui-react: investigate full-origin discard refusal during mounted recovery #1266 failure receipt showed navigator.locks.query() reporting the exclusive brain-ui:recording lock under the same clientId as the page's own root/presence locks, held by its own pending unassigned recovery. The existing runtime test also asserts that a second root in the same page is refused with exactly this message (packages/ui-react/tests/association-signout-runtime.test.ts:639).
  • The tray's startup refresh(true) (packages/ui-react/src/components/voice/recordings-tray.tsx:73) recovers each readable partition under that lock (const refresh, packages/ui-react/src/components/voice/recordings-tray.tsx:50-70). Its store subscription calls the list-only refresh() (line 71), which can publish rows while that startup recovery is still running (generation check at line 67).

Whether a person can click Discard (or another mutation) inside that window has not been reproduced. Under the ruling below the change is correct whether or not the window is reachable through the UI, so no reproduction is required before the work.

Decision (maintainer, 2026-11-03)

A. Message only. Keep the immediate refusal. When this store itself holds the lock (its own recovery or listing), reject with exactly:

Recordings are still being checked. Try again in a moment.

No change to locking or timing. When the holder is another tab, or a real recording is in progress in any tab, the refusal keeps Recording in another Brain tab.

Rejected: B (bounded wait for own maintenance) and C (no change).

Scope

In packages/ui-react/src/lib/recordings.ts, track whether this store currently holds brain-ui:recording for its own maintenance, and choose the rejection message from that. Make sure the tray item's error display shows the message.

Out of scope

Changing cross-tab exclusion, recording ownership, generation fences, recovery semantics or lock timing. Adding any waiting path. Removing the native lock.

Acceptance criteria

  • A mutation refused while this store's own maintenance holds the lock rejects with exactly Recordings are still being checked. Try again in a moment., and the tray item shows it.
  • A holder that is not this store still refuses with Recording in another Brain tab: another root's store in the same page (the existing cold-root assertion, association-signout-runtime.test.ts:639, stays unchanged), a second tab, or a real recording in any tab, proven by the existing assertions, unchanged: the cross-page holder at association-signout-runtime.test.ts:617-618, where another page holds the lock through holdRecordingLock, and the same-page other root at :639. A real recording in progress needs a new assertion.
  • A real-browser runtime case holds the store's own maintenance lock (driving the mounted UI where reachable; otherwise holding the store's recovery open deterministically) and asserts the new message, failing first on main.
  • A mutation that restores the unconditional Recording in another Brain tab message fails the new case.
  • No change to lock acquisition mode or timing (ifAvailable stays).

Verification

Pinned offline Playwright image, real Chromium, keyless. Record the failing-first and mutation receipts in the PR.

Contract impact

None. The message is UI text, not a --json or MCP contract.

Triage 2026-11-03: folded the maintainer ruling (A: message only, exact copy fixed); dropped needs: repro because A is correct whether or not the window is reachable through the UI.

Triage 2026-11-03 (second pass): re-verified every citation at main d990c0ab3 and at epic/578-offline-transitions 5abcc42e3. They are unchanged, and #3327 is on main. Pointed the cross-tab criterion at the existing cross-page assertion (:617-618) instead of asking for a duplicate. Attached to #578: offline voice capture and its recovery are that epic's outcome, the definition of done asks for "clear recoverable states", and #1266 was its child. Milestone 0.45.0: a direct follow-up of #1266 (0.45.0), with a message-only ruling. priority: p2 kept.

Activity

  1. added
    type: fix
    area: ui-react
    priority: p2
    needs: decision
    needs: repro
    on Nov 2, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03: the open scoping question is now a decision in the body (A: message only, recommended; B: wait for this store's own maintenance; C: no change if the window is unreachable). needs: repro stays until a mounted-UI run reaches the window or shows it unreachable. Citations re-verified at 3d3516a02.

  3. added
    agent-ready
    and removed
    needs: decision
    needs: repro
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): A — message only. When this store itself holds the recording lock (its own recovery or listing), reject with exactly "Recordings are still being checked. Try again in a moment." No change to locking or timing; other holders keep Recording in another Brain tab. B and C are rejected.

    Removed needs: repro as well as needs: decision: the repro was wanted to establish whether the same-page window is reachable through the UI, which mattered for choosing C. Under A the change is correct whether or not the window is reachable, so the reproduction no longer gates the work. The acceptance criteria still require a real-browser case that holds this store's own maintenance lock and fails first on main. agent-ready.

  5. added this to the 0.45.0 milestone on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03 (second pass): citations re-verified at main d990c0ab3 and at epic/578-offline-transitions 5abcc42e3, all unchanged. The cross-tab criterion now points at the existing cross-page assertion (association-signout-runtime.test.ts:617-618) instead of asking for a duplicate. Attached as a sub-issue of #578, whose definition of done requires clear recoverable states for offline voice capture; #1266 was its child. Milestone 0.45.0. priority: p2 kept. Still agent-ready.

  7. self-assigned this
    on Nov 3, 2026
  8. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claimed (claim-3326-707650). Branch fix/3326-own-maintenance-lock-message from epic/578-offline-transitions (5abcc42e3); the PR targets that integration branch. Collision report: #3448 (epic/2542-dead-code) touches packages/ui-react/src/lib/recordings.ts by removing unused export keywords; other reports are closure-only via association-signout-runtime.test.ts. #3446 on the same epic does not touch these files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-reactpriority: p2type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions