Skip to content

Decouple pacman transaction lock from non-package migrations - #17237

Open
Sebo1411 wants to merge 2 commits into
omacom:quattrofrom
Sebo1411:perf/migrate-decouple-pacman
Open

Sebo1411 wants to merge 2 commits into
omacom:quattrofrom
Sebo1411:perf/migrate-decouple-pacman

Conversation

@Sebo1411

@Sebo1411 Sebo1411 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Context & Problem

bin/omarchy-migrate previously waited on /var/lib/pacman/db.lck unconditionally for up to 900 seconds at the start of every execution. If pacman remained busy or held a lock (e.g. during background checks or simultaneous downloads), the migration runner gave up and exited cleanly without running any migrations.

Across Omarchy's shipped migrations, more than 60% only touch dotfiles, user configurations, state paths, or systemd user units without touching pacman or installing packages. Blocking the entire runner on pacman forced desktop updates and configuration fixes to stall unnecessarily or be skipped completely.

Solution

  1. Deferred Pacman Lock Wait:
    Check whether a migration script actually invokes package management helpers (omarchy-pkg-* or pacman).
  2. Immediate Execution of Independent Migrations:
    Non-package migrations run immediately and without delay, even when /var/lib/pacman/db.lck is held.
  3. Graceful Package Migration Deferral:
    If a migration requires pacman and the lock does not clear within the timeout, skip only the package migration (leaving its state marker unwritten so it retries on next login) while allowing subsequent non-package migrations to proceed.
  4. Tests:
    Added regression coverage in test/shell.d/migrate-scope-test.sh verifying that a held pacman lock allows independent dotfile migrations to execute while package migrations are deferred.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; both numbered previous findings are fixed, and no new actionable issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both numbered previous findings are fixed, and no new actionable issue was found.

Summary

omarchy-migrate now waits for pacman only before migrations that may write packages. A timeout leaves that migration pending and stops the queue, preserving migration order.

  • Independent migrations run without waiting for pacman.

Reviews (7) · Last reviewed commit: "Wait for pacman before migrations that u..." · Reviewed by Greptile

Comment thread bin/omarchy-migrate Resolved
Comment thread bin/omarchy-migrate Resolved
Comment thread bin/omarchy-migrate Resolved
@Sebo1411
Sebo1411 force-pushed the perf/migrate-decouple-pacman branch from f990848 to 1444e23 Compare November 1, 2026 12:55
Comment thread bin/omarchy-migrate Resolved
@Sebo1411
Sebo1411 force-pushed the perf/migrate-decouple-pacman branch 2 times, most recently from a6e8f69 to cae2fc9 Compare November 1, 2026 13:02
Comment thread bin/omarchy-migrate Resolved
@Sebo1411
Sebo1411 force-pushed the perf/migrate-decouple-pacman branch from cae2fc9 to 4863657 Compare November 1, 2026 13:08
Comment thread bin/omarchy-migrate Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Classification is unresolved. GPT-6 in Codex (High) reviewed the diff, discussion, and migration guidance on quattro and classified this as an enhancement: the documented runner deliberately waits for pacman before running migrations, and this changes which migrations may run during a transaction. The separate classification by deepseek-v4p1-flash (Low) returned bug.

No class label was added, and no worker tests or implementation review followed because the queue requires classification agreement first. This is waiting for the maintainer to resolve the classification.

Previously, omarchy-migrate blocked on /var/lib/pacman/db.lck unconditionally
for up to 900 seconds before running any migration. If pacman remained busy,
all pending migrations were aborted, leaving completely unrelated dotfile
and desktop configuration updates unapplied.

Check whether a migration requires mutating package management before
waiting on the pacman transaction lock. Migrations that do not need
pacman run immediately without waiting, while read-only package checks
(omarchy-pkg-present/missing) are not treated as locks. Sourced scripts
are recursively inspected to detect nested package installations.
When a package migration encounters a locked database and times out,
execution halts immediately to preserve strict sequential migration
ordering.
@Sebo1411
Sebo1411 force-pushed the perf/migrate-decouple-pacman branch from a35b963 to f36fc58 Compare November 27, 2026 21:04
Comment thread bin/omarchy-migrate Resolved
Comment thread bin/omarchy-migrate Resolved
@omarchybot omarchybot added the enhancement New feature or request label Nov 27, 2026
The scan followed only omarchy-install- helpers, so a migration calling
omarchy-update-system-pkgs ran into a locked pacman database. It now also
follows omarchy-update-, omarchy-pkg- and omarchy-refresh- helpers, and
relies on the session's OMARCHY_PATH.
@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 (High) in Codex checked the current diff against the migration guide on quattro. The latest commit extends the lock check to package update helpers. The broader change still lets some migrations start during an active pacman transaction, which changes the documented behavior, so I classified 7e07449 as an enhancement. The separate classifier, deepseek-v4p1-flash (Low), classified the same revision as a bug.

The review stopped at classification and is waiting for the maintainer to resolve it.

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.

2 participants