Skip to content

Repair Copy URL after install-time migration stamping - #8153

Closed
chessing234 wants to merge 8 commits into
omacom:quattrofrom
chessing234:fix/copy-url-repair-fresh-install
Closed

chessing234 wants to merge 8 commits into
omacom:quattrofrom
chessing234:fix/copy-url-repair-fresh-install

Conversation

@chessing234

@chessing234 chessing234 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Fresh installs stamp 1786643346.sh complete before a Chromium profile exists, so a later-synced ghost copy-url shortcut never gets repaired. Editing Preferences while Chromium is running also does not persist.

The repair lives in omarchy-cmd-repair-chromium-copy-url, called from first-run and login retry. The original migration and a follow-up call it with --prompt for unstamped upgrades and already-stamped machines. Browser and webapp launchers remain unchanged.

Repair waits for profiles to close, rewrites Preferences atomically, and preserves the protection metadata. A backup marker is removed only after the closed profile parses successfully and the ghost binding is absent; interrupted repairs retain their marker for a later retry. This prevents successful repairs from prompting again whenever the browser opens.

Validated with the repair command fixtures and Chromium extension integration shell tests. A synthetic profile reproduced repeated prompting before the fix and passed after it. No live Chromium session was tested on this macOS host.

Fixes #7983

A listening browser socket now keeps a profile protected even when its lock PID is unavailable. Missing or corrupt profiles retain recovery backups without blocking unrelated migrations. The repair probes the socket with a bounded connection attempt so an abandoned socket does not block it. Live-listener, abandoned-socket and unreadable-profile cases pass the fixtures. Profiles restored after first-run are repaired at the next login or an explicit repair command; per-launch hooks remain removed following the scope review.

Fresh installs mark 1786643346 complete before a Chromium profile exists, so a later-synced ghost shortcut never gets repaired. Run the same idempotent command from first-run, login, and browser launch, and rewrite Preferences only when no live Chromium pid holds the profile.

Fixes omacom#7983
Copilot AI balanced review requested due to automatic review settings August 25, 2026 03:59

Copilot AI left a comment

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.

Pull request overview

Moves Chromium Copy URL repair into a reusable command that runs outside migration stamping and safely updates closed profiles.

Changes:

  • Adds first-run, login, browser, webapp, and migration repair hooks.
  • Uses atomic preference replacement and clears Chromium integrity data.
  • Expands tests for stale locks, migration stamps, and repair persistence.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 8 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/omarchy-cmd-repair-chromium-copy-url Implements shared profile repair.
bin/omarchy-launch-browser Repairs before browser launch.
bin/omarchy-launch-webapp Repairs before webapp launch.
bin/omarchy-migrate-notify Retries repair at login.
bin/omarchy-provision-first-run Adds first-run repair step.
install/user/first-run/chromium-copy-url.sh Defines first-run repair hook.
migrations/1786643346.sh Delegates original migration.
migrations/1787601557.sh Retries previously stamped installs.
test/shell.d/chromium-copy-url-test.sh Checks fresh-install integration.
test/shell.d/copy-url-shortcut-migration-test.sh Expands repair behavior coverage.
test/shell.d/first-run-test.sh Checks first-run registration.
test/shell.d/launch-browser-test.sh Verifies pre-launch repair.
test/shell.d/systemd-test.sh Checks login retry integration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chessing234

Copy link
Copy Markdown
Contributor Author

@dhh @ryanrhughes ready for review

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at c5c9152 against quattro (b86d450), and reproduced on a disposable Omarchy worker running Chromium 152.

The bug is real, and this fixes the part #7983 describes. On the base, a stale Alt+Shift+L registration that turns up after the migration was stamped stays broken through login (omarchy-migrate-notify) and omarchy-launch-browser. On the base, migrations/1786643346.sh also exits 1 on a dangling SingletonLock when there is no terminal to ask in. At this head all three cases get repaired, and a lock held by a live pid defers without writing. ./test/cli and the five shell tests this touches pass on the worker.

One defect. The .bak that bin/omarchy-cmd-repair-chromium-copy-url leaves beside Preferences is never removed, and unverified_repairs_exist (line 153) treats it as a repair still waiting to be verified. So on any profile that was ever repaired (every one 1786643346 already fixed, plus every one this fixes), the new migrations/1787601557.sh waits for that profile to close. If the browser is open during omarchy update, it asks the user to close it even though nothing needs repairing. With no terminal it fails and stays pending. On the worker, with a repaired profile, the browser holding it and no terminal, the migration printed "A running browser would undo the Copy URL shortcut repair" and exited 1. The quiet callers also take that verification path on every call from then on. Removing the backup once the repaired file has been seen clean with the profile closed would end it.

Dropping protection is not what makes the repair hold. On the worker, a stale registration written into Preferences behind Chromium's back survived a browser start untouched. The base repair, which keeps protection.macs, held across two later browser starts, the same as this one does. Chromium does not appear to enforce those MACs on Linux, so the revert in #7983 probably came from somewhere else; sync is the candidate this did not test. Dropping the MACs looks harmless, since Chromium rewrote them on the next start, but nothing shows it fixes anything, and the comment at line 96 describes a mechanism the test did not bear out.

Scope. The login retry in omarchy-migrate-notify already covers a profile that arrives after install. The hooks in omarchy-launch-browser and omarchy-launch-webapp add a Python pass to every launch, permanently, for a one-time repair: about 18 ms per profile on the worker. The proportionate version is the shared command, the login retry and the rerun migration.

Conflicts. It no longer merges into quattro. bin/omarchy-launch-browser and bin/omarchy-launch-webapp were rewritten there for launch speed (#13423, #13530), and test/shell.d/copy-url-shortcut-migration-test.sh was deleted along with the other tests for shipped migrations (#12739). #6872 also rewrites profile_open for the stale-lock case (#6866). Beyond a live pid, it checks that the pid is the browser actually holding the profile, and it treats a lock written on another machine as open. This PR uses kill -0 alone. Which of the two carries the stale-lock fix is the maintainer's call.

Second opinion: none. The configured reviewer, Codex Medium, answered a ping but refused the review because its daily budget was spent. This is one model's reading (Claude Opus 5.5) plus the worker results.

Waiting on: @chessing234 to rebase onto quattro and fix the backup check. The scope question and the overlap with #6872 are for the maintainer.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; all numbered previous findings are addressed and no new blocking issues were found.

Summary

Moves Copy URL repair into a shared command called by first-run, login, and migrations.

  • Copy URL shortcuts move from ghost extensions to the pinned extension.
  • Open browser profiles stay protected without stale locks holding up repairs.
  • First-run and login retry repairs for profiles that arrive later.

chessing234 explicitly keeps browser-launch hooks out of scope. Profiles restored after login wait until the next login or an explicit repair command.

All three numbered previous findings are addressed. No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[First-run or login] -->|Quiet| C[Shared repair command]
  B[Migration] -->|Prompt allowed| C
  C --> D{Ghost binding or pending repair?}
  D -->|No| E[Finish]
  D -->|Yes| F{Affected browser open?}
  F -->|Yes| G[Defer or ask user to close it]
  F -->|No| H[Repair Preferences atomically]
  H --> I[Check closed profile]
  I -->|Clean| J[Remove pending marker]
  I -->|Not clean| K[Keep marker for retry]
Loading

Reviews (7) · Last reviewed commit: "Keep extracted Copy URL repair compatibl..." · Reviewed by Greptile

Comment thread bin/omarchy-provision-first-run Resolved
@omarchybot omarchybot removed the bug Something isn't working label Sep 30, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

New commits since the last review, so this was classified again at 213ccc0, and the two models that classify it separately disagree. Claude Opus 5.5 reads it as a bug fix: #7983 reports the Copy URL shortcut staying broken on installs where 1786643346.sh was stamped before a Chromium profile existed, and this repairs it. Codex Medium, asked from the pull request alone without that answer, calls it an enhancement; it does not give its reasons, but the new omarchy-cmd-repair-chromium-copy-url command, first-run step and login retry are what could read as new behaviour.

Until that is settled it carries no class label, and it was not re-reviewed or run on a worker at this head, so nothing here says whether the backup check, launch hooks and quattro conflicts from the previous review are resolved.

Waiting on: the maintainer, to say whether this is a fix.

Comment thread migrations/1786643346.sh Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Classified again at 0813b2b, after the merge of quattro, and the two models still disagree. Claude Opus 5.5 reads it as a bug fix: #7983 reports the Copy URL shortcut staying broken where 1786643346.sh was stamped before a Chromium profile existed, and this repairs it. Codex Medium, asked from the pull request alone, again calls it an enhancement. The new omarchy-cmd-repair-chromium-copy-url command, first-run step and login retry are the likely reason. Until that is settled it carries no class label and was not run on a worker at this head.

From reading this head, not running it: it merges cleanly into quattro again, the omarchy-launch-browser and omarchy-launch-webapp hooks are gone, and the verify mode removes the .bak once the closed profile is seen clean. That covers the backup, scope and conflict points from the first review.

One new defect, from the merge. On quattro, migrations/1792474908.sh sets profile_roots to the three BraveSoftware/Brave-Origin* directories and sources 1786643346.sh, which honours that array. At this head 1786643346.sh (line 7) runs omarchy-cmd-repair-chromium-copy-url as a separate process. The array cannot reach it there, and the command's own list (line 126) has no Brave Origin root. So 1792474908.sh repairs nothing, exits 0 when no other profile is pending, and is stamped complete. Brave Origin users keep a dead Alt+Shift+L, and the first-run and login callers never look at Brave Origin either. Adding the Brave Origin roots to the command's list would fix it. Greptile raised this on migrations/1786643346.sh:7. Codex Medium was asked to check it against the source and agreed, though its independence is not guaranteed. Its other finding, an untranslated dismiss string in bin/omarchy-migrate, is in quattro's code rather than this pull request, so it is not counted here.

Waiting on: the maintainer, to say whether this is a fix, and @chessing234 for the Brave Origin roots.

Comment thread test/shell.d/first-run-test.sh Resolved
Comment thread test/shell.d/copy-url-repair-test.sh Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Reclassified at 2001636253fd6ed7fb48eb2764e25921af265a42 after the latest commits. GPT-6 High in Codex classifies this as a bug fix because it repairs the existing Copy URL shortcut for profiles missed by install-time migration stamping, as reported in #7983. The separate classifier, deepseek-v4p1-flash (effort not reported), returns enhancement; it supplies no rationale. The classification remains unsettled, so no class label was added.

I read this revision’s diff, the previous feedback and #7983. No worker tests or full second-opinion code review ran at this head because the queue workflow stops on a classification disagreement. GitHub’s test job also failed in i18n-startup-test.sh; that result has not been diagnosed here. Earlier worker results apply to an older revision.

Waiting on the maintainer to settle whether this should proceed as a bug fix or an enhancement.

@omarchybot omarchybot added the bug Something isn't working label Nov 24, 2026
Include Brave Origin profile roots so extracting the migration cannot silently skip its callers. Give pending repairs their own backup suffix: shipped migrations left ordinary backups after success, and treating those as pending would prompt users with already repaired browsers and block later migrations.

Keep every repair behavior case in the existing Chromium extension suite and exercise the real login and first-run orchestrators. Restore quattro's intentional removal of the obsolete first-run test from 0fae8e6 instead of resurrecting assertions for retired setup behavior; the Copy URL wiring is covered by runtime assertions. Remove comments promising browser-launch retries that no longer exist.

🤖 Generated by GPT-6 High in Codex. Reviewed by Opus 5.5 High and muse-wonder via pi, thinking high.

Co-Authored-By: GPT-6 High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 24, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and pushed 2ebea4f17dbb22f2b7b171808bed61ecfd11658c. The shared repair now covers all three Brave Origin channels and distinguishes new pending repairs from the recovery backups left by shipped migrations. The existing repair cases are consolidated into the Chromium extension suite, with behavioral checks for the real first-run and login entry points.

On a disposable ISO-built Omarchy worker, the stamped-profile login case failed on base, passed with this change, and failed again when the login call was reverted. Real Chromium 158 showed the shortcut change from “Not set” to Alt+Shift+L, copied a web-page URL, and retained the working shortcut across two further browser restarts without rerunning repair. Sync was disabled; persistence in a signed-in syncing profile remains untested.

CLI and all 45 focused assertions passed. The full worker suite reported 4,894 passes and two failures: the OEM logo check in provision-owner-keyboard-test.sh and keepLoaded IPC in runtime-smoke-test.sh. Both fail unchanged on base too. CI is green and Greptile scored this head 5/5 with no new actionable findings.

GPT-6 High in Codex reviewed and tested this; Opus 5.5 High identified the legacy-backup prompting case, and Opus 5.5 High and muse-wonder via pi, thinking high, found the final code clean. Their agreement is not guaranteed to be independent. The automated readiness gate still holds this back on the repair approach and persistence concerns, so it carries verified and waits on the maintainer. The overlapping stale-lock changes in #6872 and #14457 will also need coordination.

Before: Chromium shows Copy URL as Not set for the restored ghost binding

After: Chromium shows Alt+Shift+L after the login repair; signed-in sync was not exercised

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy URL repair (migration 1786643346) is stamped complete on fresh installs, and its Preferences edit does not persist

3 participants