Skip to content

fix(studio): refresh thread IDs after subscribing - #2619

Merged
jbeda merged 1 commit into
mainfrom
fix/studio-thread-session-ids-mount-race
Oct 29, 2026
Merged

jbeda merged 1 commit into
mainfrom
fix/studio-thread-session-ids-mount-race

Conversation

@jbeda

@jbeda jbeda commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2376.

useThreadSessionIds() read its initial snapshot during render, then installed its event listeners in a passive effect without rereading storage. A thread registered between those steps could leave the ID set empty even though useThreadMap() already showed the thread—the split snapshot reported by the account-quarantine flake.

Refresh the IDs immediately after subscribing. This closes the missed-notification window without retries, sleeps, or timeout changes.

Add a deterministic regression that registers a thread from useLayoutEffect, before passive subscriptions attach, and checks both the initial recovery and subsequent notifications. Before the fix, the map assertion passed while the ID assertion failed with [].

Verification

  • Thread-map and account-quarantine test files: 20 consecutive runs passed (14 tests per run).
  • Full web suite: 201 files / 1,767 tests passed with --maxWorkers=4.
  • Web typecheck and Biome checks passed.
  • task test passed.
  • task lint and task test:race passed.
  • Offline demo passed, including tool execution, permission ask/approval, and final result.

The initial unrestricted web run, concurrent with the full Go suite, hit seven 5-second test timeouts. The bounded web rerun after Go finished passed without changing any timeout settings.

API compatibility

No wire, Go API, or stored-data schema changes; no API major or feature identifier changes. The hook now observes the current user-scoped state when its subscription attaches. No client upgrade is required.

Close the render-to-effect notification gap that can leave thread IDs stale after account quarantine. Add a deterministic layout-effect regression and verify subsequent notifications.

Fixes #2376

Co-authored-by: Mecatl <[email protected]>
@jbeda
jbeda enabled auto-merge (squash) October 29, 2026 23:32
@jbeda
jbeda merged commit 77584ed into main Oct 29, 2026
35 checks passed
@jbeda
jbeda deleted the fix/studio-thread-session-ids-mount-race branch October 29, 2026 23:33
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
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.

flake(studio): account quarantine test intermittently misses Bob thread IDs

1 participant