Skip to content

fix(desktop): harden browser and runtime hygiene - #7152

Open
waleedlatif1 wants to merge 2 commits into
stagingfrom
codex/investigate-macos-services-menu
Open

fix(desktop): harden browser and runtime hygiene#7152
waleedlatif1 wants to merge 2 commits into
stagingfrom
codex/investigate-macos-services-menu

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • harden desktop browser, terminal, navigation, updater, and account-data lifecycle boundaries
  • add readable recovery states, canonical permission toasts, bounded persistence, and packaged release validation

Type of Change

  • Bug fix

Testing

Validated with the full monorepo test and type-check suites, lint, 36 audits, source Electron E2E, and fresh packaged Electron fuse and launch smoke tests.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 27, 2026 04:44
@gitguardian

gitguardian Bot commented Aug 27, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 27, 2026 6:08am

Request Review

@waleedlatif1
waleedlatif1 force-pushed the codex/investigate-macos-services-menu branch from cc99802 to 05649b1 Compare August 27, 2026 04:46
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This follow-up hardens desktop server switching by separating teardown readiness, durable configuration persistence, and recovery-marker finalization.

  • Keeps deployment recovery armed when replacement settings cannot be persisted.
  • Prevents deployment finalization from weakening a concurrent account teardown.
  • Relaunches after a committed origin change so runtime identity can be reconstructed.

Confidence Score: 4/5

The PR is not yet safe to merge because an overlapping failed account teardown can cancel the required relaunch after the new server origin has already been committed.

The server picker closes and reports success after committing the new origin, but the application quit handler can prevent the requested relaunch when concurrent account teardown fails, leaving the live process on its old partition and runtime identity.

Files Needing Attention: apps/desktop/src/main/server-window.ts and apps/desktop/src/main/index.ts

Important Files Changed

Filename Overview
apps/desktop/src/main/server-window.ts The revised commit/finalization order fixes early marker removal, but assumes a requested relaunch cannot be canceled after origin persistence.
apps/desktop/src/main/index.ts The lifecycle composition correctly blocks quitting on unsafe account teardown, which exposes the server-window success-path mismatch.
apps/desktop/src/main/account-data-generation.ts Teardown-kind escalation preserves the stronger account recovery marker and causes deployment finalization to fail safely.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Clear deployment-scoped state] --> B{Deployment teardown still completable?}
  B -->|No| C[Return failure]
  B -->|Yes| D[Persist scoped clears and new origin]
  D --> E{Persistence succeeded?}
  E -->|No| C
  E -->|Yes| F[Finalize deployment recovery]
  F --> G[Request relaunch]
  G --> H{Concurrent account teardown clean?}
  H -->|Yes| I[Quit and relaunch]
  H -->|No| J[Quit cancelled after origin commit]
Loading

Reviews (3): Last reviewed commit: "fix(desktop): close review edge cases" | Re-trigger Greptile

Comment thread apps/desktop/src/main/server-window.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 83 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/desktop/src/main/index.ts
Comment thread apps/desktop/src/main/updater.ts
Comment thread .github/workflows/desktop-release.yml
Comment thread apps/desktop/src/main/navigation.ts
Comment thread apps/desktop/src/main/input-activity.test.ts Outdated
Comment thread apps/desktop/src/main/browser-sites/directory.test.ts
Comment thread apps/desktop/src/main/observability.ts
Comment thread apps/desktop/src/main/browser-agent/session.ts
Comment thread apps/desktop/src/main/input-activity.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.test.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment on lines +247 to 260
if (!deps.completeDeploymentScopedStateChange()) {
logger.error('Server changed while account-data recovery remained active')
}
} catch (error) {
// The origin is already durably committed, so returning without a
// relaunch would mix the old process partition with the new origin.
// Keep the marker for startup recovery and finish the committed move.
logger.error('Server changed but deployment-scoped recovery remains pending', {
error: getErrorMessage(error),
})
}
logger.info('Server origin changed; relaunching', { from: current, to: origin })
close()
deps.relaunch()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Relaunch Can Be Cancelled

If account sign-out starts after the deployment readiness check and its teardown fails, completeDeploymentScopedStateChange() returns false but setOrigin() still closes the picker, requests a relaunch, and reports success. The before-quit handler then cancels that relaunch, leaving the running process on its old partition while the persisted configuration names the new server.

Knowledge Base Used:

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