Skip to content

fix(macos): retire stale app copies after update - #5345

Merged
ronishrohan merged 3 commits into
Untrivial-ai:mainfrom
Pulkit7070:codex/fix-3617-stale-copy-retirement
Sep 15, 2026
Merged

ronishrohan merged 3 commits into
Untrivial-ai:mainfrom
Pulkit7070:codex/fix-3617-stale-copy-retirement

Conversation

@Pulkit7070

@Pulkit7070 Pulkit7070 commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

What and why

Old AO bundles left in Downloads or Desktop can still be launched after the macOS relocation fix. This PR offers to move verified older copies to Trash so they cannot replace the maintained installation.

Closes #3617.

Changes

  • Check only ~/Downloads/Agent Orchestrator.app and ~/Desktop/Agent Orchestrator.app.
  • Require a real directory, the exact AO bundle identifier, and a valid version older than the running /Applications build.
  • Ignore symlinks, unrelated apps, unreadable versions, equal versions, and newer versions.
  • Ask for confirmation and use macOS Trash. The code never reads or removes ~/.ao, projects, sessions, databases, or caches.

How to test

  1. Put an older AO bundle in Downloads or Desktop and launch a newer packaged build from /Applications.
  2. Confirm the dialog lists the exact older version and path.
  3. Choose "Not now" and verify nothing moves.
  4. Repeat and choose "Move old copies to Trash"; verify only the listed app bundle moves.

Validation

  • cd frontend && npm test (314 files, 4,576 passed, 7 skipped)
  • cd frontend && npm run typecheck
  • cd frontend && npm run package

Risk

Cleanup is intentionally limited to two exact paths. Copies with missing or invalid metadata are left untouched.

Old AO bundles can still be launched after the relocation fix. Offer to move verified older copies from Downloads or Desktop to Trash so they cannot replace the maintained installation.

Closes Untrivial-ai#3617
@Pulkit7070
Pulkit7070 force-pushed the codex/fix-3617-stale-copy-retirement branch from 38f13c3 to 54aa292 Compare September 13, 2026 14:54
@i-trytoohard i-trytoohard added bug Something isn't working comp/desktop Electron main process and React renderer. labels Sep 14, 2026
@i-trytoohard i-trytoohard added this to the Release & platform milestone Sep 14, 2026
Comment thread frontend/src/main/stale-app-copies.ts Outdated
A copy can change while the confirmation dialog is open. Preserve its device and inode, then re-read its identity, bundle ID, and version before moving the path to Trash.
Comment thread frontend/src/main/stale-app-copies.ts Outdated
Comment thread frontend/src/main/stale-app-copies.ts Outdated
Move each candidate to a private sibling path before validating it, then
trash and validate that staged path. A replacement renamed into the
original path after validation can no longer be what gets deleted, closing
the residual TOCTOU gap between revalidation and trashing. On validation
failure or a rejected trash the staged bundle is restored to its path.

Compare canonical semver values during revalidation so a bundle whose
plist version differs only textually (v0.10.3, padded, or +build) is not
silently skipped after being listed.

@ronishrohan ronishrohan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the latest head a428e76. The focused suite passes (26/26), CI is green, and the macOS manual race reproduction now preserves the replacement bundle with no staging residue.

@ronishrohan
ronishrohan merged commit ef5b69a into Untrivial-ai:main Sep 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working comp/desktop Electron main process and React renderer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: an old copy of the app silently overwrites the updated one in /Applications, pinning users to their install version

3 participants