Skip to content

fix: address Codex review findings for sync and deep link - #178

Merged
github-actions[bot] merged 1 commit into
developfrom
fix/codex-review-findings
Mar 29, 2026
Merged

fix: address Codex review findings for sync and deep link#178
github-actions[bot] merged 1 commit into
developfrom
fix/codex-review-findings

Conversation

@tomymaritano

@tomymaritano tomymaritano commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes 3 issues flagged by Codex bot review on PR #177.

Changes

1. Preserve recovery key on passphrase change

The POST /sync/keys upsert was overwriting wrappedCekRecovery with null when not provided (e.g., during passphrase change). Now only overwrites if explicitly sent.

2. Parse deep link on cold start (Windows/Linux)

When the app isn't running and user clicks a readied:// magic link, the OS launches a new instance with the URL in process.argv. Previously only second-instance parsed this. Now startup args are checked too.

3. Guard sync with encryption readiness

syncNow() now checks encryptionService.isReady() before attempting encrypt/decrypt. Fresh installs without passphrase setup get a clear error instead of crashing.

Test plan

  • pnpm typecheck passes (17/17)
  • pnpm test passes (42/42)
  • Manual: change passphrase → verify recovery key still works
  • Manual: close app → click magic link on Windows → app launches and authenticates
  • Manual: fresh install without passphrase → sync attempt shows clear error

🤖 Generated with Claude Code

Summary by CodeRabbit

Bug Fixes

  • Deep link authentication tokens passed as command-line arguments are now properly recognized and processed on application startup
  • Sync operations are prevented from proceeding when the encryption service is not initialized, ensuring system stability
  • Recovery-wrapped keys are now properly preserved during sync operations instead of being inadvertently cleared

1. Preserve recovery-wrapped CEK on passphrase change — only overwrite
   wrappedCekRecovery in the upsert when explicitly provided, so
   passphrase changes don't silently erase recovery data.

2. Parse deep-link URL from process.argv on cold start (Windows/Linux) —
   when the app isn't running and the user clicks a readied:// link,
   the token is now captured from startup args and queued as
   pendingAuthToken for delivery once the window loads.

3. Guard syncNow() with encryption readiness check — if CEK is not
   loaded (fresh install, no passphrase set), sync returns a clear error
   instead of crashing with 'Encryption service not initialized'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Mar 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
readide Ready Ready Preview, Comment Mar 29, 2026 9:01pm

Request Review

@coderabbitai

coderabbitai Bot commented Mar 29, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Three targeted enhancements across the desktop and API layers: the main process now parses deep link arguments during cold start for authentication token extraction, the sync service validates encryption readiness before initiating sync cycles, and the API conditionally updates wrapped CEK recovery data only when explicitly provided rather than overwriting with null.

Changes

Cohort / File(s) Summary
Desktop Deep Link Handling
apps/desktop/src/main/index.ts
Added CLI argument inspection on cold start to extract readied:// deep links and parse authentication tokens from auth/verify endpoints. Invalid URLs are silently caught and ignored.
Desktop Sync Preconditions
apps/desktop/src/main/services/syncService.ts
Added early-return check in SyncService.syncNow() to abort sync when encryption service is not ready, returning failure with no state changes or events.
API CEK Recovery Logic
packages/api/src/routes/sync.ts
Modified /keys POST upsert to conditionally update wrappedCekRecovery—only overwrites when explicitly provided in request, otherwise preserves existing value instead of clearing it.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary changes across all three files: addressing recovery key preservation, deep link parsing on cold start, and encryption readiness guards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/codex-review-findings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec5afd4a47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 2762 to +2765
// Another instance already has the lock — quit this one.
// The deep link URL was passed to the existing instance via second-instance event.
app.quit();
} else {
// Check startup args for deep link URL (cold start on Windows/Linux).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Register deep-link handlers in the lock-holder branch

The new startup deep-link parsing and second-instance listener are now nested under if (!gotTheLock), which is the short-lived secondary process that immediately calls app.quit(). This means the primary instance (gotTheLock === true) no longer subscribes to second-instance, so links opened while the app is already running are not handled, and cold-start argv handling also runs in the wrong process. This should stay in the primary-instance path (the else branch) so the surviving process receives and processes deep links.

Useful? React with 👍 / 👎.

@github-actions
github-actions Bot merged commit 3b01d4b into develop Mar 29, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant