Repository navigation
fix(native-chat): make structured Codex launches race-resistant - #18251
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughStructured Codex launches now expose pending and unknown status through a subscription hook. Quick Launch and tab creation actions show a disabled loading state during startup. Launch reconciliation waits for session-tab adoption and supports cancellation. Tab closure cancels active launches and abandons their intents. Session-tab freshness decisions compare renderer and Merge Risk: 🟡 Moderate · up to This change improves Codex launch coordination and session-tab recovery, but unresolved risks remain around preserving runtime-owned tabs, publishing concurrent close state, localization, and regression coverage for recovery races. These should be addressed before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation and validation, but it omits several required template sections, including ELI5, Why, a valid Linked Issue, Visual Proof, checklist confirmations, Review, Notes, and Agent skill upstream boundary. Resolution Complete the required template sections. Add an ELI5 summary, explain why the approach solves the problem, provide a valid issue reference after "Fixes", attach before-and-after visual proof for the UI behavior, document manual testing and platforms, complete the AI Disclosure as applicable, and fill in Review, Agent skill upstream boundary, Notes, and Checklist items.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: e8d6b4d9-8ad1-4a65-b7ce-c2a314bd8005
📒 Files selected for processing (8)
src/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/TabBarCreateEntry.tsxsrc/renderer/src/components/tab-bar/TabBarCreateEntryRow.tsxsrc/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.tssrc/renderer/src/components/tab-group/useTabGroupTabCloseCommands.tssrc/renderer/src/lib/launch-agent-structured-chat-guard.test.tssrc/renderer/src/lib/structured-agent-session-launch.test.tssrc/renderer/src/lib/structured-agent-session-launch.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| const label = entry?.label ?? agent | ||
| const isStructuredCodexPending = | ||
| agent === 'codex' && structuredCodexLaunchStatus === 'pending' | ||
| const menuLabel = isStructuredCodexPending ? 'Starting Codex chat…' : label |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the pending-state label.
'Starting Codex chat…' bypasses translate in both UI surfaces. Non-English users will see this new status in English.
src/renderer/src/components/tab-bar/QuickLaunchButton.tsx#L204-L204: derive the pending label from a dedicated translation key.src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx#L383-L383: pass the same translated pending label tolabelOverride.
📍 Affects 2 files
src/renderer/src/components/tab-bar/QuickLaunchButton.tsx#L204-L204(this comment)src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx#L383-L383
| closeItem(AGENT_TAB.id) | ||
|
|
||
| await vi.waitFor(() => expect(order).toEqual(['agent-close', 'tab-close', 'local-remove'])) | ||
| expect(mocks.cancelStructuredCodexLaunch).toHaveBeenCalledWith('wt-1', 'session-1') |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- target file outline ---'
ast-grep outline src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts
printf '%s\n' '--- target file relevant lines ---'
cat -n src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts | sed -n '1,180p'Repository: stablyai/orca
Length of output: 8755
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- applicable repository conventions ---'
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions/repo-wide.md
printf '%s\n' '--- close command outline ---'
ast-grep outline src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.ts
printf '%s\n' '--- close command implementation ---'
rg -n -A80 -B20 'cancelStructuredCodexLaunch|closeStructuredAgentSession|callRuntimeRpc|closeUnifiedTab|closeItem' src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.tsRepository: stablyai/orca
Length of output: 11591
Record cancellation in the ordering assertion.
The test records closeStructuredAgentSession, session.tabs.close, and closeUnifiedTab, but not cancelStructuredCodexLaunch. A cancellation that runs after owner disposal can therefore pass. Make the cancellation mock record its position and assert that it runs first.
There was a problem hiding this comment.
ℹ️ No blocking issues — the launch coordinator itself is sound. Two localization rough edges inline.
Reviewed changes
structured-agent-session-launch.ts— new per-worktree launch coordinator withpending/unknown/idlestates,useStructuredCodexLaunchStatushook viauseSyncExternalStore, cancellation throughthrowIfLaunchCancelled/cancelStructuredCodexLaunch, and a two-partverifyPublishedSession(host publication + renderer adoption).QuickLaunchButton.tsx/TabBarCreateEntry.tsx/TabBarCreateEntryRow.tsx— pending spinner + "Starting Codex chat…" label and disabled state on both launch surfaces; newlabelOverrideprop.useTabGroupTabCloseCommands.ts— cancels an in-flight launch before closing its owner in both single- and bulk-close paths.- Tests — close-race cancellation, response loss, duplicate-click coalescing, unknown recovery, refusal release, and adoption-lag assertions.
The race handling is correct: refreshLocalStructuredSessionTabs applies the snapshot into unifiedTabsByWorktree synchronously before resolving (via applyWebSessionTabsStorePatch → useAppStore.setState), so the adoption check reads a committed store; entityId is set to the session's sessionId (terminal-surfaces.ts:71), matching intent.sessionId, so cancelStructuredCodexLaunch keying is right; and every new test pins an exact assertion (toHaveBeenCalledOnce, toHaveBeenCalledTimes(2)) rather than a truthiness check, so each would fail if the underlying behavior regressed. The only findings are localized UI strings.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| onSelect={() => runLaunch(agent)} | ||
| className="gap-2 rounded-[7px] px-2 py-1.5 text-[12px] leading-5 font-medium" | ||
| title={translate( | ||
| 'auto.components.tab.bar.QuickLaunchButton.ec2adf093e', |
There was a problem hiding this comment.
The title reuses key ec2adf093e for a second fallback. translate returns the catalog value when the key exists, so while pending the tooltip resolves to the catalog's Launch {{value0}} in a new terminal with a literal, uninterpolated {{value0}} — not Starting Codex chat…. Give the pending string its own key (or gate the whole translate call on isStructuredCodexPending).
| const label = entry?.label ?? agent | ||
| const isStructuredCodexPending = | ||
| agent === 'codex' && structuredCodexLaunchStatus === 'pending' | ||
| const menuLabel = isStructuredCodexPending ? 'Starting Codex chat…' : label |
There was a problem hiding this comment.
menuLabel hardcodes Starting Codex chat… in English instead of routing through translate(), so non-English users see an untranslated label. The surrounding strings all use translate(...); this one should too.
| option.kind === 'agent' && | ||
| option.option.agent === 'codex' && | ||
| structuredCodexLaunchStatus === 'pending' | ||
| ? 'Starting Codex chat…' |
There was a problem hiding this comment.
Same localization gap as the Quick Launch menu: Starting Codex chat… is hardcoded here rather than passed through translate(), so it never localizes.
Visual proofCaptured from the real Electron app via Playwright CDP on the Before: Codex entry ready to launchDuring: launch in progressThe Codex row now shows a spinner and After: one unified Codex chat tab |
|
Follow-up fix for the reported permanently-bricked workspace case. Before: the Codex host session could be created successfully, but renderer adoption was rejected after a host-side After: merged and base publications are treated as one freshness lineage. Version ordering still rejects genuinely stale frames, while a newer base inventory can reconcile after a merge. This lets an existing host session be adopted and keeps retries bounded/cancelable when a tab closes mid-flight. Validation: 29 focused tests pass, |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/lib/structured-agent-session-launch.test.ts (1)
74-76: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep publication and adoption fixtures independent.
publishedSnapshotmutatesmocks.rendererTabsbeforeverifyPublishedSessionruns. Every successful verification test uses this helper, so an adoption-check regression can pass. Keep the renderer tab list empty during publication, then add the tab separately in at least one test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 94df00d4-b54e-46dc-b998-25eca344a85d
📒 Files selected for processing (5)
src/renderer/src/lib/structured-agent-session-launch.test.tssrc/renderer/src/lib/structured-agent-session-launch.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync/publisher-identity-fences.tssrc/renderer/src/runtime/web-session-tabs-sync/tracking-decisions.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
ℹ️ No new issues introduced by this increment. The three localization threads from the prior review (hardcoded
Starting Codex chat…strings and the reused tooltip key) remain open and are not touched by these commits.
Reviewed changes
structured-agent-session-launch.ts—retrySameIntentnow throwsStructuredAgentSessionLaunchCancelledErrorwhen cancellation lands during the final verification retry, instead of parking the launch and toasting later.publisher-identity-fences.ts— addedsameSessionTabsPublicationLineageandisHeadlessMergeSessionTabsPublicationso a base publication and its:headless-merge:sibling are treated as one ordering lineage.tracking-decisions.ts— exempted same-lineage retired epochs from theOUTRANKEDfence and gated the stale-version check behindcomparePublicationVersions, so the mirror stops dropping a renderer base publication published after a host-side headless merge.web-session-tabs-sync.test.ts— added base/merge-lineage and delayed-frame coverage.structured-agent-session-launch.test.ts— added the close-races-final-verify test plus theabandonIntentand renderer-tabs mocks.launch-agent-structured-chat-guard.test.ts— seededunifiedTabsByWorktreefor the adoption requirement and the second-intent path.
The cancellation check is correct: the final-verify retry now re-checks state.cancelled before parking, and the focused test pins exact assertions (toHaveBeenCalledTimes(2), no toast.error, abandonIntent called once). The lineage logic is also sound for its intended single-pairing scope — the host keeps base and merge snapshotVersion values in one monotonic counter inside a host process (orca-runtime-sync-mobile-session-tabs.ts:167-169), so the merge→base comparison in comparePublicationVersions does not cross counters, and the pairing-revision teardown (global-session-subscription.ts:97) resets mirror freshness across re-pairs.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/renderer/src/lib/structured-agent-session-launch.test.ts (2)
133-143: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlign this test with the inventory-recovery path it names, or rename it.
The body no longer reaches inventory recovery.
cancelStructuredCodexLaunchruns before the launch promise resolves, sothrowIfLaunchCancelledrejects atstructured-agent-session-launch.tsLine 251 andrecoverStructuredSessionFromInventorynever runs. The test then duplicates the preceding "cancels a close-racing launch" test, and a regression in the cancellation check insiderecoverStructuredSessionFromInventorywould still pass here.To cover the named path, make the launch reject so the flow enters recovery, then cancel while
refreshLocalStructuredSessionTabsis pending.♻️ Proposed test that exercises inventory recovery
it('does not retry creation when close races inventory recovery', async () => { const worktreeId = 'wt-close-final-verify' const intent = launchIntent(worktreeId, 'session-close-final-verify') mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockResolvedValue(intent.sessionId) + mocks.launch.mockRejectedValue(new Error('response lost')) + let releaseRefresh: (value: RuntimeMobileSessionTabsResult[]) => void = () => {} + vi.mocked(refreshLocalStructuredSessionTabs).mockReturnValueOnce( + new Promise((resolve) => { + releaseRefresh = resolve + }) + ) startStructuredCodexLaunch(worktreeId) + await flushLaunchSettlement() expect(cancelStructuredCodexLaunch(worktreeId, intent.sessionId)).toBe(true) + releaseRefresh([publishedSnapshot(worktreeId, intent.sessionId)]) await flushLaunchSettlement() expect(mocks.launch).toHaveBeenCalledOnce() + expect(toast.error).not.toHaveBeenCalled() })This asserts that the cancellation check after the refresh await at
structured-agent-session-launch.tsLine 170 prevents a stale success.
232-234: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
publishedSnapshotmutates the store eagerly, which diverts a test off the path it means to cover.publishedSnapshotwritesmocks.rendererTabsin addition to returning a snapshot. When a test passes it as an argument tomockResolvedValueOnce, the renderer tab is adopted at mock-setup time, sowaitForStructuredSessionAdoptiontakes the already-adopted fast path atstructured-agent-session-launch.tsLine 115 and inventory recovery never runs.
src/renderer/src/lib/structured-agent-session-launch.test.ts#L232-L234: replace the eagermockResolvedValueOnce([publishedSnapshot(...)])withmockImplementationOnce(async () => [publishedSnapshot(...)])so the tab appears only after the first inventory listing returns empty, and the test actually entersrecoverStructuredSessionFromInventory.src/renderer/src/lib/structured-agent-session-launch.test.ts#L81-L83: separate the store mutation from the snapshot factory, for example an explicitadoptRendererTab(worktreeId, sessionId)helper, so no caller adopts a tab by evaluating an argument.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: a4bc5216-3111-4454-ba4d-947e8d14626d
📒 Files selected for processing (24)
src/main/runtime/orca-runtime-apply-mobile-session-tab-navigation.tssrc/main/runtime/orca-runtime-close-headless-mobile-terminal-tab.tssrc/main/runtime/orca-runtime-close-structured-agent-session-tab.tssrc/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.tssrc/main/runtime/orca-runtime-has-exact-persisted-terminal-surface-identity.tssrc/main/runtime/orca-runtime-hydrate-headless-mobile-session-tabs-from-workspace-session.tssrc/main/runtime/orca-runtime-move-headless-mobile-session-tab.tssrc/main/runtime/orca-runtime-persist-headless-session-tab-props.tssrc/main/runtime/orca-runtime-persist-terminal-surface-retirements.tssrc/main/runtime/orca-runtime-publish-pty-backed-mobile-session-terminal.tssrc/main/runtime/orca-runtime-reconcile-headless-mobile-session-browser-tabs.tssrc/main/runtime/orca-runtime-restore-live-paired-renderer-session-owned-mobile-terminals.tssrc/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.tssrc/main/runtime/orca-runtime-runtime-id.tssrc/main/runtime/orca-runtime-stop-requested-pty-ids.tssrc/main/runtime/orca-runtime-stored-mobile-snapshot-has-stale-preserved-tab.tssrc/main/runtime/orca-runtime-sync-mobile-session-tabs.tssrc/main/runtime/orca-runtime-sync-window-graph.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-06.spec.tssrc/main/runtime/orca-runtime-touch-mobile-session-tabs-for-worktree.tssrc/renderer/src/lib/structured-agent-session-launch.test.tssrc/renderer/src/lib/structured-agent-session-launch.tssrc/renderer/src/runtime/local-structured-session-tabs-sync.test.tssrc/renderer/src/runtime/local-structured-session-tabs-sync.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| tabs: nextTabs | ||
| } | ||
| this.mobileSessionTabsByWorktree.set(worktreeId, nextSnapshot) | ||
| this.storeMobileSessionSnapshot(worktreeId, nextSnapshot) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Rebase the close snapshot after the host await.
nextSnapshot can become stale while host.setSessionTabVisibility is pending. storeMobileSessionSnapshot then stamps that old tab list with a newer version and overwrites tabs added or updated in the meantime. The following emit still sends the unstamped version.
Read the current snapshot after the await, apply the tab removal to that snapshot, and emit the value returned by storeMobileSessionSnapshot. Add a regression for an intervening snapshot update.
| // The epoch identifies the publisher generation, not the merged content. | ||
| // Content changes are ordered by snapshotVersion, so encoding a merge hash | ||
| // here would make the identity oscillate and permanently fence later rows. | ||
| return normalizedPublicationEpoch |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Keep merge state separate from freshness lineage.
Removing :headless-merge: at Line 124 makes a renderer-based merged snapshot indistinguishable from a pure renderer snapshot. Existing preservation and offscreen-browser checks use that discriminator. Runtime-owned browser tabs can then be treated as renderer-owned and removed during reconciliation.
Keep a stable, non-content merge marker for renderer-based merged snapshots. Compare normalized base lineages for freshness decisions.
src/main/runtime/orca-runtime-stored-mobile-snapshot-has-stale-preserved-tab.ts#L124-L124: retain a stable merge discriminator for renderer-based merged snapshots without restoring content hashing.src/renderer/src/runtime/local-structured-session-tabs-sync.ts#L87-L87: compare normalized publication lineage instead of rawpublicationEpoch.src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts#L153-L194: add frames that alternate between a renderer epoch and its merged epoch, including delayed lower-version frames from the same lineage.
📍 Affects 3 files
src/main/runtime/orca-runtime-stored-mobile-snapshot-has-stale-preserved-tab.ts#L124-L124(this comment)src/renderer/src/runtime/local-structured-session-tabs-sync.ts#L87-L87src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts#L153-L194
There was a problem hiding this comment.
ℹ️ No new issues introduced by this increment. The three localization threads from the prior review (hardcoded
Starting Codex chat…inQuickLaunchButton.tsxandTabBarCreateEntry.tsx, plus the reused tooltip key) remain open and are not touched by these commits.
Reviewed changes
- Unified host snapshot versioning — added a single
storeMobileSessionSnapshotwrite funnel that stamps strictly increasing per-worktreesnapshotVersionvalues, routing every.set()call site through it. - De-hashed
publicationEpoch—getMergedMobileSessionPublicationEpochnow returns the base epoch only, so the epoch encodes publisher generation and content ordering lives entirely insnapshotVersion. - Local adoption gate — replaced the shared
decideWebSessionTabsSnapshotretirement fence inapplyLocalStructuredSessionTabSnapshotswith a local(publicationEpoch, snapshotVersion)gate. - Store-driven launch completion — the coordinator now completes from the host-emitted renderer projection via
useAppStore.subscribe(waitForStructuredSessionAdoption), with one bounded inventory recovery path (recoverStructuredSessionFromInventory) and same-intent unknown reconciliation. - Stream-end resubscription —
startLocalStructuredSessionTabsSyncnow reattaches onendwith a single refresh so a runtime-restart boundary cannot strand stale tabs. - Tests — focused regressions for host-frame completion, close races, repeated cycles, stale versions, and refusal handling, each with exact assertions.
The versioning funnel is sound: every emit site bumps snapshotVersion before storing, so storeMobileSessionSnapshot restamps only on the sync path (which emits from the stored map, not the raw frame), keeping the emitted version strictly monotonic and consistent with what the client freshness gate expects (graph-sync-mobile-snapshot-gating.test.ts pins this). The local gate is correct for the single-host in-order stream — epochs are never reused, so "any new epoch wins" cannot accept a stale cross-epoch frame. The waitForStructuredSessionAdoption subscription is correctly torn down on settle/cancel and the cancellation waiter set is drained before abandoning the intent.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues introduced by this increment. The three localization threads from the prior review (hardcoded
Starting Codex chat…inQuickLaunchButton.tsxandTabBarCreateEntry.tsx, plus the reused tooltip key) remain open and are not touched by this commit.
Reviewed changes
- Replay unknown launches by intent —
reconcileUnknownLaunchnow, after a 1s adoption wait and an inventory miss, re-issueslaunchStructuredCodexSession(state.intent)with the same intent (stablesessionIdandclientOperationId) before waiting for adoption, instead of only checking inventory. AddedinventoryContainsIntentas a shared helper and a focusedreplays the same intent after an absent unknown outcomeregression.
The re-launch is safe: the intent's clientOperationId is minted once at createStructuredCodexSessionLaunchIntent and reused verbatim, so the host's mutation-admission ledger dedupes the replay on operationId: envelope.clientOperationId (structured-agent-session-mutation-admission.ts:70) and either replays the prior outcome or runs it once — it cannot mint a second session for the same click. The retry remains bounded to one re-launch per reconcile, with recoverStructuredSessionFromInventory re-marking the state unknown on a second failure, and StructuredAgentSessionLaunchCancelledError / StructuredAgentSessionCreateRefusalError still short-circuit correctly.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Visual proof (Electron CDP, current PR worktree)Captured from a launched Scenario: New tab → Codex → pending Before: Codex ready in the New tab menuDuring: launch pending (duplicate activation disabled)After: first structured Codex Chat tabSession After closeChat tab gone; workspace returned to empty/inactive. After relaunch: new session, old id not restoredSecond session Not visually triggered: unknown-state same-intent replay (needs a lost host frame). Search-omnibox Codex row and in-chat message send were not exercised. |
Review status: land after fixesThe same-model review/fix loop is CLEAN, and the final readiness checklist is PASS/CLEAN. Fixes pushed to the PR branch:
Validation:
Current GitHub checks are running for commit 588c738. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx (1)
386-386: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winLocalize both visible pending Codex labels.
When Codex launch status is
pending,TabBarCreateEntry.tsxandQuickLaunchButton.tsxrenderStarting Codex chat…directly. Both components are mounted in current UI paths, so non-English users can see this English-only label. Add separatetranslate()calls for thelabelOverrideandmenuLabelvalues; translating the QuickLaunch tooltip does not localize its visible label.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 9b679d46-7323-4e17-b904-0b09f20d003c
📒 Files selected for processing (5)
src/renderer/src/components/tab-bar/TabBarCreateEntry.keyboard.test.tsxsrc/renderer/src/components/tab-bar/TabBarCreateEntry.tsxsrc/renderer/src/lib/launch-agent-structured-chat-guard.test.tssrc/renderer/src/runtime/local-structured-session-tabs-sync.test.tssrc/renderer/src/runtime/local-structured-session-tabs-sync.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Backed off structured-session resubscription — replaced the single refresh-and-reattach with an exponential-backoff retry loop (
scheduleSubscribeRetry) guarded by a reconnect timer and asubscriptionGenerationstaleness check, so a runtime-restart boundary can't strand stale tabs. - Fenced delayed local snapshots — added a per-worktree retired-epoch history plus
sameSessionTabsPublicationLineageso a delayed frame from a superseded publisher generation can't roll the local projection back. - Cleaned up publisher cursors — dropped
localStructuredSessionVersionByWorktree/ epoch-history entries for worktrees and folder workspaces that no longer exist. - Guarded duplicate Codex launches —
TabBarCreateEntrynow drops a second launch while a structured launch is alreadypending, covered by a keyboard regression test.
The three localization threads from the prior review remain open and are not touched by this increment.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| return | ||
| } | ||
| const reconnectDelay = Math.min(250 * 2 ** reconnectAttempt, 5000) | ||
| reconnectAttempt += 1 |
There was a problem hiding this comment.
reconnectAttempt only ever increments, so after a few reconnect cycles the resync delay sits at the 5s cap for the rest of the renderer session — a later, unrelated runtime restart then waits ~5s before refreshing its tabs. Reset it when a subscribeCurrent succeeds (e.g. alongside activeHandle = handle at line 250) so each failure episode re-arms backoff from scratch.
Final review status: land after fixesThe review/fix loop is clean. One meaningful in-scope reliability issue was found and fixed in commit Validation completed:
Final readiness: PASS/CLEAN with no proven P0/P1/P2 findings. GitHub checks are still running for |
There was a problem hiding this comment.
ℹ️ No new issues in this increment — the resubscription fix is correct. Approval remains blocked by four open Pullfrog threads that this commit does not address: three localization gaps (the hardcoded
Starting Codex chat…inQuickLaunchButton.tsxandTabBarCreateEntry.tsx, and the reused tooltip keyec2adf093e) plus thereconnectAttemptbackoff-reset nitpick inlocal-structured-session-tabs-sync.ts.
Reviewed changes
- Error-response resubscription —
startLocalStructuredSessionTabsSyncnow fences the current subscription generation and schedules a retry when the streaming RPC delivers an!response.okresponse, instead of silently dropping it and leaving the stream dead. - Exported sync entrypoint —
startLocalStructuredSessionTabsSyncis now exported so the regression test can drive the sync lifecycle directly. - Focused regression — a new test pins the 250 ms first retry, single-retry-per-error behavior, unsubscribe ordering, and suppression of late errors from a fenced generation.
The fix is correct for the race it targets: the callback captures generation, so the top-of-callback stale check (generation !== subscriptionGeneration) drops both late errors and events from a superseded generation; the !response.ok branch increments the generation before scheduling, so a handle that resolves after the error is unsubscribed at the post-await guard rather than leaking; and scheduleSubscribeRetry's reconnectTimer !== null guard prevents overlapping retries when the subscribe promise also rejects.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…lyai#18251) * fix(native-chat): cancel close-racing structured launches * fix(native-chat): make structured launches observable and recoverable * fix(native-chat): reconcile merged session tab publications * refactor(native-chat): unify host snapshot versioning * refactor(native-chat): complete launches from host snapshots * fix(native-chat): replay unknown launches by intent * fix(native-chat): guard duplicate launches and bound sync recovery * test(native-chat): type owner fixture * test(native-chat): type owner fixture * fix(native-chat): back off structured session resubscribe * fix(native-chat): fence delayed local session snapshots * fix(native-chat): retry initial session sync safely * fix(native-chat): refresh before sync retry * test(native-chat): cover folder sync cursor cleanup * fix(native-chat): retry failed structured session subscriptions --------- Co-authored-by: Merge Sim <sim@local>

















What changed
Codex native-chat launch now has one coordinated lifecycle from click to host publication to renderer adoption. The host owns one monotonically versioned snapshot per worktree; publisher identity is separate from snapshot content, so creating and closing chats cannot permanently poison the next launch. The renderer completes from the live host frame and uses inventory only as bounded recovery when a frame or response is lost.
Before / after (user-facing)
Before
After
Implementation
publicationEpoch; it now represents publisher generation only.(publicationEpoch, snapshotVersion)gate.Validation
pnpm tc:webpassed.pnpm tc:nodepassed.pnpm run check:code-quality:changedpassed.git diff --checkpassed.taniwha @ brennanb2025/fix-codex-native-chat-raceinstance; the rendered workspace showed the existing Terminal and Codex Chat tabs with zero console errors. Full click-through was not claimed because this profile did not expose the structured-chat creation menu.