Skip to content

fix(server,client-runtime,web,mobile): settle startup handoff races, editor deltas, PR fallback, and reactive palette thread actions - #910

Merged
trancong12102 merged 5 commits into
mainfrom
fix/followup-batch-1
Dec 3, 2026
Merged

trancong12102 merged 5 commits into
mainfrom
fix/followup-batch-1

Conversation

@trancong12102

@trancong12102 trancong12102 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up batch Group 1 (5 root-cause fixes across server orchestration, contracts, client-runtime, web, and mobile):

  1. Startup handoff settle vs. run.updated stream race (93a23546987)

    • ThreadHandoff.start_ previously settled pending/departing moves from a shell snapshot and only then subscribed to live domain events at the current tail, missing terminal run.updated events that arrived while startup settles were still running.
    • Added optional bounded?: boolean (default true) to Orchestrator.streamStoredEventsFrom, captured the atomic snapshotSequence alongside threads from projections.getShellSnapshot(), signalled snapshotReady before settling (awaited when ServerActivation is absent in tests), and streamed unbounded stored run.updated events after snapshotSequence.
    • Regression test in apps/server/src/peer/handoff/ThreadHandoff.test.ts (timed out before fix; 14/14 pass).
  2. PR link folder fallback requires tracked folders (14438539bbd)

    • packages/client-runtime/src/changeRequestLinks.ts previously lent any project without repositoryIdentity as a fallback, sending plain/scratch folder PR links to an unloadable side panel instead of the browser.
    • Added trackedFolders to ChangeRequestProject and required (candidate.trackedFolders?.length ?? 0) > 0 for the folder fallback, matching PullRequestService.ts; forwarded "trackedFolders" in apps/mobile/src/lib/pullRequestNavigation.ts.
    • Regression tests in packages/client-runtime/src/changeRequestLinks.test.ts (13/13), apps/mobile/src/features/pull-requests/pullRequestNavigation.test.ts (7/7), and apps/web/src/lib/openPullRequestLink.browser.test.tsx (10/10).
  3. Startup editor discovery warm-up & opt-in editorsUpdated delta (a30627afaa1)

    • apps/server/src/server.ts now warms ExternalLauncher.resolveAvailableEditors() (and resolveFileManagerRevealKind() when "file-manager" is present) on startup into its existing SWR cache via ServerActivation.forkParked.
    • Added ServerConfigEditorsUpdatedPayload, ServerConfigStreamEditorsUpdatedEvent (type: "editorsUpdated"), and optional editorUpdates?: boolean on WsSubscribeServerConfigRpc (wire-compatible in both directions with older mobile/server builds).
    • apps/server/src/ws.ts (withLateConfigDiscovery) emits editorsUpdated instead of a second full snapshot when opted in while updating its accumulated snapshot state; packages/client-runtime, apps/web, and apps/mobile handle editorsUpdated with reuseUnchanged and opt in consistently.
    • Tests in packages/client-runtime/src/state/serverConfigProjection.test.ts (6/6), packages/client-runtime/src/rpc/session.test.ts (26/26), and apps/server/src/ws.test.ts (45/45).
  4. Remove dead relay-only early HTTP shell load (d80927a6275)

    • Removed unused EarlyShellLoad / useEarlyLoad / awaitEarlyLoad pre-socket HTTP preload plumbing from packages/client-runtime/src/state/shell.ts while keeping loadOverHttp for older or non-pipelined servers.
    • Cleaned up the 6 relay-only preload tests in packages/client-runtime/src/state/shell-sync.test.ts (28/28 remaining sync/fallback/pipelining tests pass).
  5. Reactive command palette thread actions (08a03bffee9)

    • useCommandPaletteThreadActions previously called imperative readMenu() during render without subscribing, leaving actions empty/stale for older settled threads before their family read landed or when shell/config/permissions changed.
    • Extracted pure canTurnThreadShellIntoProject in apps/web/src/hooks/useThreadActions.ts, added optional reactive ThreadActionMenuSnapshot to useThreadActionMenu.readMenu(snapshot?) (keeping 0-arg readMenu() zero-subscription for ChatHeader), subscribed useCommandPaletteThreadActions to useQuietThreadShell, useProject, useServerConfig, operate/triage scopes, and canMoveThreadsAtom (mounted only when the palette is open), and passed paletteRouteTarget.threadRef immediately in CommandPalette.tsx.
    • Regression test in apps/web/src/components/ChatView.browser.test.tsx verifying both useCommandPaletteThreadActions and the open <CommandPalette> update when getThreadFamily lands.

Council review

Two independent read-only Council Round 1 reviews on 08a03bffee9:

  • Gemini 4 Neon (XHigh) (council-verifier): CLEAN (0 blocking findings). Verified [T-3] snapshot/sequence transaction atomicity and unbounded replay, [T-4] parity with PullRequestService.ts and sibling issueLinks.ts, [T-6] bidirectional wire compatibility, Stream.mapAccum serialization, and subscription sharing across web & mobile, [T-7] intact loadOverHttp fallback, [T-16] zero closed-palette subscriptions and React Compiler purity, plus both rejected triage items. Noted 4 non-blocking nits (Orchestrator.ts exactOptionalPropertyTypes default, extra wire-input assertion in session.test.ts, harmless resumable branch in loadOverHttp, and remote settingsUpdated snoozePresets refresh).
  • Claude Opus 5.5 (High) (opus-council, fully independent): CLEAN (0 blocking findings). Independently verified all 5 commits, tests, wire compatibility, React Compiler purity, and sibling surfaces (ThreadSettlement, RemoteDelegation). Noted 3 non-blocking follow-up nits: remoteOpenTargetsResolved and directEndpointsResolved in withLateConfigDiscovery still send a second snapshot (directEndpoints is also read from snapshots by supervisor.ts:368), EnvironmentSupervisor.openingSession can eventually be made required once test fakes provide it, and a stale null stored repositoryIdentity now opens in the browser instead of the panel.

Rejected / already-resolved triage items

  • AntigravitySkills.ts ELOOP symlink loop: already fixed on main in 408fc78f92c (AntigravitySkills.ts:111-125 + regression test in AntigravitySkills.test.ts:424-438).
  • Release verification after #883: verified green in v0.32.0 (84d21845b14, Actions run 46561057231, includes #883 and #901; all 10 platform/release jobs succeeded).

Verification

vp run check:changed origin/main --concurrency 2 --timeout 1800:

  • format: pass (0.2s)
  • lint: pass (1.6s, 0 errors)
  • knip: pass (2.8s)
  • graphql (apps/server): pass (0.4s)
  • typecheck (39 packages): pass (8.2s)
  • test (25 files, 458 tests): pass (56.1s)
  • react compiler (9 files, web + mobile): pass (7.9s)
  • GitHub CI: 20/20 checks SUCCESS/SKIPPED

Done with Gemini 4 Neon (XHigh) in Antigravity, reviewed by Gemini 4 Neon (XHigh) and Claude Opus 5.5 (High).

…ot sequence

ThreadHandoff.start_ previously settled pending/departing moves from a shell snapshot and only then subscribed to live domain events from the current tail, missing terminal run.updated events that landed during the startup settle loop. Capture the snapshot's atomic snapshotSequence and stream unbounded stored run.updated events after it.
…r fallback

A plain or scratch folder project without repositoryIdentity or trackedFolders no longer lends itself as a PR fallback project, so PR links fall back to the browser instead of opening an unloadable panel.
…eam editorsUpdated deltas

Warm ExternalLauncher editor discovery on server startup and send late editor discovery as an opt-in editorsUpdated stream delta instead of a second full ServerConfig snapshot, keeping older clients wire-compatible.
Remove unused useEarlyLoad/awaitEarlyLoad pre-socket HTTP preload plumbing that only served the removed relay path, keeping the HTTP shell fallback for older or non-pipelined servers.
…d permissions

Subscribe useCommandPaletteThreadActions to the thread shell, project, server config capabilities, operate/triage scopes, and move availability instead of calling imperative readMenu() at render time, and pass the route thread ref immediately so older settled threads populate palette actions as soon as their family read lands.
@trancong12102
trancong12102 merged commit de8c7e7 into main Dec 3, 2026
20 checks passed
@trancong12102
trancong12102 deleted the fix/followup-batch-1 branch December 3, 2026 14:49
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.

1 participant