Repository navigation
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:
📝 WalkthroughWalkthroughAdded a generic integration state-file cache that detects inode, size, and modification-time changes. The cache supports lazy reads, missing files, reloads, and invalidation. Jira and Linear clients now use the shared cache for site and workspace state. Added tests for external updates, file transitions, memoization, reloads, and invalidation. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/integration-state-file-cache.ts (1)
21-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCondense the block comment.
Keep only the non-obvious cache rationale. Move deployment examples to documentation if they are needed. As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 62c7bd8e-53b1-4113-8f04-76fa4056a6c9
📥 Commits
Reviewing files that changed from the base of the PR and between 0d29497 and febabd6a8b781ab0f94a8fe3e2add0c16e42abe3.
📒 Files selected for processing (6)
src/main/integration-state-file-cache.test.tssrc/main/integration-state-file-cache.tssrc/main/jira/client.test.tssrc/main/jira/client.tssrc/main/linear/client.test.tssrc/main/linear/client.ts
8d7be8a to
8450793
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c9080dbd-f9f1-4f9b-ab79-b33fa4c60377
📥 Commits
Reviewing files that changed from the base of the PR and between 8d7be8af981a3a64a2e6268d45bc86668c091ba7 and 845079386b107338685e03d178bc49aa5a6e9335.
📒 Files selected for processing (4)
src/main/integration-state-file-cache.test.tssrc/main/integration-state-file-cache.tssrc/main/jira/client.tssrc/main/linear/client.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/linear/client.ts
- src/main/jira/client.ts
…ocess rewrites them
Both clients memoized ~/.orca/{jira-sites,linear-workspaces}.json on first read and
never invalidated, so getStatus() kept answering from a snapshot taken at process
start. Every Orca process on a machine shares that directory — an installed app
beside a dev build, or `orca serve` beside the desktop app — which made a
connection performed in one process invisible to the others until they restarted.
Stamp the cache with the file's inode, size, and mtime and reload when the stamp
moves. Writes record their own stamp so the next read does not bounce straight
back to disk. Tokens already read through to disk on a cache miss, so only the
state files needed this.
The two clients had the same load-once shape, so the logic lands in one
createIntegrationStateFileCache() helper instead of being fixed twice.
8450793 to
bc8326a
Compare
…file-cache-invalidation
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
…file-cache-invalidation # Conflicts: # src/main/jira/client.ts # src/main/linear/client.ts
Adapt PR #13125 and reuse the existing precise file identity signature for cache invalidation. Co-authored-by: Minho Yi <[email protected]>
|
Superseded by #28594, which landed this same fix on 2026-10-14 (commit 5ae088a, co-authored here). Main has since taken it further: the stamp moved to the shared |
ELI5
Connect Jira or Linear in one Orca window, and any other Orca running on the same machine keeps saying "not connected" until you restart it. This makes the other one notice.
What Changed
Jira and Linear both memoized their state file —
~/.orca/jira-sites.jsonand~/.orca/linear-workspaces.json— on first read and never invalidated it:The cache now carries the file's inode, size, and mtime, and reloads when that stamp moves. Both clients share one
createIntegrationStateFileCache()helper instead of the fix being written twice.Why
That directory is shared by every Orca process on the machine — an installed app beside a dev build, or
orca servebeside the desktop app. A process that started before the file existed reports "not connected" for its whole life, including to any paired client reading its connection status.Writes call
invalidate()rather than caching the value they just wrote. Stamping our own write would record whatever is on disk at that instant, so a concurrent writer slipping in between would pin our value under their stamp — permanently stale, because the stamps then agree forever. Reloading costs one read after each write, and writes only happen on connect, disconnect, and site selection.Tokens already read through to disk on a cache miss, so only the state files needed this.
Linked Issue
No linked issue. This was found while working on #13126 (Jira on mobile), where a stale connection status was one of the candidate explanations for a paired client reporting "not connected". It turned out not to be the cause there, but the staleness is real and reproducible on its own, so it is split out here rather than folded into that PR.
Visual Proof
N/A— this only changes when an existing connection status is recomputed. No UI, layout, or interaction changes.Testing
Manually verified on macOS with two Orca processes sharing
~/.orca: connecting in one is picked up by the other without a restart.The bug was originally found the same way round — a desktop process that had started a day before
~/.orca/jira-sites.jsonfirst existed still reported no Jira connection, indefinitely.pnpm testreports failures in 16 files locally. Re-running those files serially leaves 15 passing, and the remaining one (config/scripts/check-root-directory-entries.test.mjs) fails identically on a clean tree with this branch stashed. No Jira, Linear, or integration-cache test fails in either run.10 new tests: 5 on the helper (memoize while unchanged, reload on change, reload when the file appears after an absent first read, reload on removal, and a write landing between the stamp and the read that must self-correct rather than pin), 3 on the Jira client, 2 on Linear. Each was confirmed to fail with the invalidation removed, and the interleaving test was confirmed to fail if
get()is reordered to stamp after reading — so they pin the behaviour rather than the implementation.AI Disclosure
Written with Claude Opus 5 (via Claude Code). Human Review & QA.
Review
Security. Credential handling is unchanged: tokens still load through
integration-credential-file, decrypt failures still surface viacredentialErrors, and nothing new is written, logged, or widened. The cache now notices a file another process wrote — the same directory and permissions the client already trusted.Cross-platform.
node:fsstatSynconly; no shell, no path assumptions beyond the existingjoin(homedir(), '.orca').stats.inois a real file index on macOS and Linux; on Windows it can be reported as0, in which case the stamp degrades to size + mtime, which still detects every write this guards against. Sub-secondmtimeMsis available on all three platforms, so a same-second rewrite is still caught.Remote SSH / backwards compatibility. Each host — native, WSL distro, SSH host, relay — runs its own main process against its own
~/.orca, so the fix applies per host and changes nothing between them. No RPC params, stream frames, or published content change, so there is no wire-compatibility surface and mixed client/host versions are unaffected.Mobile. No mobile code changes. Paired clients benefit indirectly because
jira.statusandlinear.statusstop answering from a stale snapshot.Performance. One
statSyncper state-file read, on a local path, in front of calls that are already network-bound. A full re-read still only happens when the file actually changed.Behaviour change worth noting. A process now observes a disconnect performed elsewhere instead of holding a stale connected view. That is the intended correction, but it does remove the accidental per-process isolation that existed before.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author