Repository navigation
refactor(app): session-route decomposition round 2 — engine reload, typed sessions (zero any), settings picker adoption - #2201
Merged
Conversation
UI-triggered engine reload, reload-coordinator registration, the post-org-onboarding reload latch, server reload-event polling (cursor per workspace), and desktop engine info move verbatim to shell/use-engine-reload.ts. Reload events flow through their existing OpenworkReloadEvent type instead of (item: any). shareWorkspaceState moved below the hook so routeEngineInfo exists before it is consumed; behavior unchanged (its outputs are only read later). The engineInfo() cast is pre-existing (dynamic desktop-bridge Proxy) and keeps a pointer to the queued typed-IPC work. session-route.tsx: 2,777 -> 2,676 lines. Tested: pnpm typecheck clean; bun test 58 pass; pnpm build clean; pnpm test:e2e 23/23 assertions ok.
…ero any sessionsByWorkspaceId was Record<string, any[]> in both routes even though openwork-server's listSessions has returned typed SDK Session[] all along. New RouteSession (Session + the defensive run-status fields the sidebar probes) in route-workspaces.ts; both routes' state/refs/lambdas now use it, getSessionStatus and toSessionGroups are properly typed, and the 4 'session as any' inserts plus 14 '(session: any)' lambdas are gone. session-route.tsx now contains zero 'as any' / ': any' (24 at the start of this effort, highest in the repo). Tested: pnpm typecheck clean; bun test 58 pass; pnpm build clean; pnpm test:e2e 23/23 assertions ok.
…iction bypass settings-route carried its own copy of the model picker state + lazy option loader, and it had drifted: the settings picker rendered the RAW option list with no org-restriction filtering, so models from providers blocked by desktop policy (dev #1505) were selectable from Settings while the session route filtered them. Adopting the shared hook closes that hole. Preserved settings-specific behavior: - providerAuthStore.refreshProviders() on picker open (small effect) - error toast on option-load failure via the hook's new optional onLoadError (the session route stays silent, unchanged default) Convergences (now session behavior): query is no longer cleared by the open event, and recently-added provider ids are captured for the 'Recently added' section, which settings previously ignored. settings-route.tsx: 2,473 -> 2,402 lines. Tested: pnpm typecheck clean; bun test 58 pass; pnpm build clean; pnpm test:e2e 23/23 assertions ok.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
2 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/app/src/react-app/shell/use-engine-reload.ts">
<violation number="1" location="apps/app/src/react-app/shell/use-engine-reload.ts:113">
P2: Reload-event cursor updates are not monotonic under overlapping polls. A late stale response can move the workspace cursor backward and trigger duplicate/stale reload-required events.</violation>
</file>
<file name="apps/app/src/react-app/shell/settings-route.tsx">
<violation number="1" location="apps/app/src/react-app/shell/settings-route.tsx:2386">
P3: Model picker close flow leaves recent-provider highlight state stale. Previously-added providers can stay marked as "Recently added" on later opens.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| typeof currentCursor === "number" ? { since: currentCursor } : undefined, | ||
| ); | ||
| if (cancelled) return; | ||
| reloadEventCursorByWorkspaceRef.current[workspaceId] = |
There was a problem hiding this comment.
P2: Reload-event cursor updates are not monotonic under overlapping polls. A late stale response can move the workspace cursor backward and trigger duplicate/stale reload-required events.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/shell/use-engine-reload.ts, line 113:
<comment>Reload-event cursor updates are not monotonic under overlapping polls. A late stale response can move the workspace cursor backward and trigger duplicate/stale reload-required events.</comment>
<file context>
@@ -0,0 +1,158 @@
+ typeof currentCursor === "number" ? { since: currentCursor } : undefined,
+ );
+ if (cancelled) return;
+ reloadEventCursorByWorkspaceRef.current[workspaceId] =
+ typeof response.cursor === "number"
+ ? response.cursor
</file context>
| onBehaviorChange={() => {}} | ||
| onOpenSettings={() => {}} | ||
| onClose={() => setModelPickerOpen(false)} | ||
| onClose={() => modelPicker.setOpen(false)} |
There was a problem hiding this comment.
P3: Model picker close flow leaves recent-provider highlight state stale. Previously-added providers can stay marked as "Recently added" on later opens.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/shell/settings-route.tsx, line 2386:
<comment>Model picker close flow leaves recent-provider highlight state stale. Previously-added providers can stay marked as "Recently added" on later opens.</comment>
<file context>
@@ -2449,11 +2379,11 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {
onBehaviorChange={() => {}}
onOpenSettings={() => {}}
- onClose={() => setModelPickerOpen(false)}
+ onClose={() => modelPicker.setOpen(false)}
/>
</>
</file context>
This was referenced Jun 12, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Continues #2200 (steps 7–9 of the session-route decomposition). Three commits, each independently gated and revertable.
8451b3bd4shell/use-engine-reload.ts): UI-triggered engine reload, reload-coordinator registration, post-org-onboarding reload latch, reload-event polling (per-workspace cursor), desktop engine info. Reload events now flow through their existingOpenworkReloadEventtype instead of(item: any).shareWorkspaceStaterelocated below the hook (its outputs are only consumed later; behavior unchanged).04ce94089sessionsByWorkspaceIdwasRecord<string, any[]>in both routes even thoughlistSessionshas returned typed SDKSession[]all along. NewRouteSession(SDK Session + the defensive run-status fields the sidebar probes). Kills 4session as anyinserts and 14(session: any)lambdas — session-route.tsx now contains zeroas any/: any(24 at survey time, highest in the repo).d62e5c8e8refreshProviders()on open + error toast via the hook's new optionalonLoadError.Running tally for the decomposition:
session-route.tsx3,328 → 2,677 ·settings-route.tsx2,595 → 2,402 · third latent bug fixed by deduplication (after the settings remote-clobber fix in #2200 and the macOS reload-trigger fix in #2199).Tests (ran after every commit)
No video: behavior-preserving refactor (the one intentional change is the restriction-filter fix described above, UI-visible only when org policies block providers). Reviewer repro: commands above; for the policy fix, set a desktop policy blocking a provider and open Settings → model picker.