Fix mobile session snapshot freshness after main-side bumps#7409
Fix mobile session snapshot freshness after main-side bumps#7409Fartown wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThis change adds renderer mobile session snapshot freshness tracking in the Orca runtime. A per-worktree map records the latest accepted renderer snapshot state, helper functions gate incoming snapshots by publicationEpoch and snapshotVersion and normalize stored snapshotVersion values, and syncMobileSessionTabs now uses that logic before writing to mobileSessionTabsByWorktree. The freshness entry is removed when a worktree’s mobile session tabs are deleted. Tests cover fresh updates and stale updates within the same publicationEpoch. ChangesCompact metadata:
Sequence Diagram(s)sequenceDiagram
participant Renderer
participant syncMobileSessionTabs
participant acceptRendererMobileSessionSnapshot
participant withMonotonicMobileSessionSnapshotVersion
participant mobileSessionTabsByWorktree
Renderer->>syncMobileSessionTabs: snapshot (publicationEpoch, snapshotVersion)
syncMobileSessionTabs->>acceptRendererMobileSessionSnapshot: evaluate freshness
acceptRendererMobileSessionSnapshot-->>syncMobileSessionTabs: accepted or rejected
syncMobileSessionTabs->>withMonotonicMobileSessionSnapshotVersion: normalize snapshotVersion
withMonotonicMobileSessionSnapshotVersion-->>syncMobileSessionTabs: normalized snapshot
syncMobileSessionTabs->>mobileSessionTabsByWorktree: store snapshot
Related issues: None provided 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
7ba8960 to
425e15d
Compare
425e15d to
5c8e95b
Compare
Summary
Fixes #7400.
snapshotVersionthat main can bump for PTY/title/live updates.Screenshots
No visual change.
Testing
pnpm lintorigin/main(17d5eff) and also reproduced on cleanorigin/mainwithout this PR:src/renderer/src/components/settings/SourceControlActionRepoOverrideNote.tsx:35failstypescript(switch-exhaustiveness-check)because the switch is already exhaustive. Changed-file oxlint passed.pnpm typecheckpnpm testorigin/main@17d5eff; fails in unrelated macOS node-pty / relay subprocess timing tests outside this PR. Targeted [Bug]: Orca Mobile can show stale one-tab session when main bumps mobile snapshotVersion #7400 regression tests passed.pnpm buildPassed on the final branch after rebasing onto
origin/main@17d5eff:Also passed earlier for the complete runtime test file:
pnpm exec vitest run src/main/runtime/orca-runtime.test.ts --reporter dotCurrent full-suite notes on the final branch / latest
origin/main@17d5eff:AI Review Report
A read-only AI review checked the final diff in
src/main/runtime/orca-runtime.tsandsrc/main/runtime/orca-runtime.test.tsfor the #7400 failure mode, stale/same-version renderer snapshot handling, client-visible monotonic delivery versions, cross-platform compatibility, SSH/remote/local behavior, provider neutrality, performance, security, and PR scope.The review found no blocking issues. It confirmed that renderer-owned tab graph freshness is now separate from main-bumped delivery freshness, same-epoch stale and duplicate snapshots are rejected, accepted renderer snapshots remain delivery-monotonic for clients, and the added tests cover stale, duplicate, and fresh-after-main-bump cases. It also explicitly checked macOS/Linux/Windows concerns, shortcuts, labels, paths, shell behavior, and Electron-specific platform differences; this PR does not touch UI, shortcut, accelerator, path, shell, or platform-specific code. The review flagged an unrelated untracked architecture document, which is intentionally excluded from this PR.
Security Audit
This change only adds in-memory runtime bookkeeping for mobile session snapshot freshness. It does not add IPC methods, command execution, filesystem/path handling, network calls, dependencies, auth handling, secrets handling, or new user-controlled parsing. The extra
Mapis keyed by existing worktree identifiers and bounded by the existing worktree snapshot lifecycle; entries are deleted when snapshots are removed. Security risk is neutral.Notes
publicationEpoch,snapshotVersion, tab group, and tab payload shape remains intact.