Fix over-broad rebuild live-server interlock: lsof-scoped, warn-by-default (#1138) - #1138
Merged
Merged
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…efault (#1138) The OB12 interlock added in #1135 used pgrep -f 'opencode.*serve', which matched unrelated opencode processes (incl. the chat server) and refused the rebuild when nothing held THIS rebuild's DB. Neither the pre-S9 scripts nor the in-app path ever blocked on a live server. - Scope the check to processes actually holding $DBDIR/opencode*.db (+wal/shm) via lsof -t, excluding this script's own pid+parent (a & job shares the parent pgid, so no pgid filter). A real server runs in its own group. - Default = non-blocking WARNING (db_is_zeroed already guards a torn backup); --strict-live-check opts into the hard refuse; --allow-live-server silences. - Add --check-live-only hook for isolated testing. - AC10 in the harness: warn+pass by default, --strict refuses, unrelated named process does not trip, no-lsof passes. Gates: harness 12/12, bash -n 0, shellcheck 0. Local rebuild ran end-to-end.
jeonghun-jj-lee
force-pushed
the
jj/1138-fix-rebuild-interlock
branch
from
September 14, 2026 13:34
ea5e7cc to
c727e68
Compare
#1138) Commit 87f947a (pushed directly to main) edited the overlay-tracked file packages/core/src/database/migration/20260913221452_session-receipt-budget-reservation.ts without re-stamping its manifest hash, so materialize hard-failed with MANIFEST MISMATCH and build-binary went red on main (and on this rebased PR). Surgical single-key fix: aa0463b1… → a09f5e22… (the file's current content hash). NOT run via refresh_manifest, which is not exceptions-aware and would have hoisted 23 amicode-only legacy paths into files{} (ledger §7) — verified by reverting its over-broad output and editing the one key by hand. Verified: materialize now applies the overlay with 0 MANIFEST MISMATCH.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the over-broad running-server interlock (OB12) in the rebuild scripts that refused a rebuild when the chat server — or any unrelated
opencodeprocess — was running, even though nothing held this rebuild's DB.Why
The interlock is new in #1135 — the pre-S9 scripts and the in-app Rebuild path never blocked on a live server. It used
pgrep -f 'opencode.*serve', which matches any process whose args contain "opencode" then "serve" (including the Amicode server you're chatting through), so it false-refused. Reported live:Change (
scripts/rebuild_amicode.sh)lsof -tagainst the actual target DB files ($DBDIR/opencode*.db+-wal/-shm), excluding this script's own pid+parent (a&job shares the parent pgid, so no pgid filter — a real server runs in its own group). Nolsof→ silent pass.db_is_zeroed+ WAL-checkpoint + restore-only-if-zeroed already guard a torn backup.--strict-live-checkopts into the hard refuse;--allow-live-serversilences the warning.--check-live-onlyhook for isolated testing.dirty-files=0\n0double-print in the deploy-transparency line.Tests / gates (all command-run)
rebuild_amicode_check.sh— (a) holder → warn+exit 0; (b)--strict→ refuse; (c) unrelatedopencode…serve-named process holding no target DB → not tripped (regression guard for the exact false positive); (d) no lsof → pass. RED first (failed on current code), then GREEN.bash -n= 0 ·shellcheck(all 4 scripts) = 0 findings · fork-refs = 0.rebuild_amicode_locally.sh --yes(build→deploy→binary copy→done) andrebuild_amicode_remotely.sh --yeson a clean tree (full--mode mainsync→build→deploy→done); the dirty-tree refuse still fires correctly when the tree is dirty.Scope
Scripts only — the in-app path never had this interlock, so no
coordinator.ts/chat_bridge.tschange; the two surfaces stay consistent (neither hard-blocks on a live server).