Skip to content

Keep foreign-host lock owners and waiters (T152) - #90

Merged
erickb336 merged 1 commit into
mainfrom
codex/t152-foreign-host-lock
Oct 9, 2026
Merged

erickb336 merged 1 commit into
mainfrom
codex/t152-foreign-host-lock

Conversation

@erickb336

@erickb336 erickb336 commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #61
Sage task T152

What changes

The state tool retains a lock owned by another machine, even when its boot time is close and its PID looks dead or reused locally. It checks the host before any boot or process rule. Local stale-lock rules stay the same. Cleanup also retains foreign waiters.

The source change is in packages/sage-core/state.mjs. The build regenerates both provider copies. The existing Claude skill already describes foreign locks correctly and needs no change.

Validation

Final commit: 38d8a0e1747290a24952f5853ac05ed55f288619.

  • npm run build: built 212 files.
  • npm run check: all checks pass.
  • Focused lock regression tests: tests 12; pass 12; fail 0; skipped 0.
  • npm test: tests 708; pass 708; fail 0; cancelled 0; skipped 0.
  • git diff --check: exit 0.

Every test used fake ps, pgrep and kill first on PATH, caffeinate -i, and env -u NODE_TEST_CONTEXT. Injected PID evidence and process-call spies prevent real process inspection or signals. Tests use no tight timing bounds.

A detached origin/main checkout at 5431a74 received only the exact final test file. The two T152 groups fail with ERR_ASSERTION: main permits a write through a foreign owner's lock, and main deletes a foreign waiter. The branch retains both records byte for byte. Local dead, reused and live PID controls preserve the existing behavior. Baseline test bytes remain unchanged.

An initial proof used invalid fixture branch names. That output was discarded as regression evidence. The final proof uses valid task branches. The repository checker also exposed identifier propagation in its clock scan; only new fixture names changed. Existing tests and the checker remain unchanged.

Review and limits

Independent code/security and QA reviews are clean on the exact final commit. Code review checked 26 foreign-host cases and 2,704 local baseline comparisons, plus both new integration groups. QA passed 185 assertions across 20 controlled lock scenarios and both new integration groups.

This verifies the lock through controlled owner and waiter fixtures. A live shared folder across two machines was not tested. It adds no automatic foreign-lock recovery and does not change the existing filesystem lock protocol.

GitHub CI

CI run 37865030362 passed on the exact reviewed commit 38d8a0e1747290a24952f5853ac05ed55f288619.

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.

T152: Lock never pid-checks a holder on another host

1 participant