Repository navigation
Evidence of legacy dot-lock writers (AGT-4024): a new src/taskState/legacyLockWriter.ts probe remembers the dot-lock tok - #967
Merged
Conversation
…T-4024)
- New src/taskState/legacyLockWriter.ts. createLegacyWriterProbe is created
once this process holds the SQLite mutex. It remembers the owner of the
dot-lock it saw at EEXIST. It records evidence only when that lock later
disappears (ENOENT, or openSync 'wx' succeeds) or carries a different
token, and we did not reclaim it ourselves in between.
- Only a live writer that takes no mutex can do that, which means a
<=0.24.4 CLI. A crashed dual-lock writer's leftover never moves on its
own, so it is never reported.
- Evidence goes to <store>.legacy-writer.json through atomicWriteFileSync:
firstSeenAt, lastSeenAt, and the released owner's pid and namespace.
- It warns once per process. Every step is best effort and can never fail
a lock acquisition or a store write.
- store.ts wires the four probe calls and exports getStorePath. It goes from
1172 to 1171 lines. Locking, reclaim, staleness and buildLockPayload are
unchanged.
- openswarm doctor gains a warn-only 'task-state lock' line (checkName
task-state-lock). It names lastSeenAt when evidence exists, and otherwise
says 'no dot-lock-only writer observed (absence is not proof)'. A check
that cannot run reports ok with the reason and never fails doctor.
- Tests:
- a real child process holding the dot-lock without the mutex records
evidence (red when the probe calls are reverted);
- a crashed writer's leftover (dead pid, or older than LOCK_ABANDON_MS)
records none (red without reclaimedByUs);
- an evidence-write failure does not fail upsertTaskState;
- doctor's warn and ok cases.
Assumptions:
- The detection relies on the SQLite mutex excluding current writers. On a
filesystem that does not honour fcntl locks (NFS, some virtiofs mounts),
two current writers could be recorded; the doctor line and the module
header say so.
- An operator removing the lock file by hand while a writer waits would be
recorded too.
- The dual-lock release is 0.25.0 (#871 contains 5625efb). The remaining
step, the CLI-floor decision and the dot-lock removal, is the operator's.
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.
Milestone of an auto-claude run.
Check:
(test -d node_modules || npm ci --prefer-offline --no-audit --no-fund) && npm run lint && npm run typecheck && grep -rqF 'records a dot-lock-only writer seen while holding the mutex' src && grep -rqF 'does not report a crashed dual-lock writer as a legacy writer' src && grep -rqF 'reports dot-lock-only writer evidence as a warning' src && test "$(wc -l < src/taskState/store.ts)" -le 1172 && npx vitest run src/taskState src/cli/doctorPlan: .claude/auto-plan.md (local to the run).