fix(lock): scope reentrancy to logical owners - #64
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 3:48 AM ET / 07:48 UTC. ClawSweeper reviewWhat this changesThis PR adds an owner-scoped Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain Keep open for maintainer review: this is a substantial public lock-semantics change that appears to preserve the data-loss fix while restoring narrowly scoped nesting, but it needs maintainer acceptance of the new owner-token contract and stronger after-fix runtime evidence. Likely related people: steipete is the strongest routing candidate from the immediately preceding merged lock/store work (high confidence). Priority: P2 Review scores
Verification
How this fits togetherThe sidecar-lock subsystem coordinates access to a target file by creating and validating a separate lock file. Public file-lock and JSON-store callers feed lock options into it; successful acquisition returns a release handle, while other callers retry, time out, or use stale-lock recovery. flowchart LR
A[Application lock caller] --> B[File-lock API]
B --> C[Canonical target resolution]
C --> D{Existing in-process holder?}
D -->|Same logical owner| E[Reference-counted shared handle]
D -->|Different or no owner| F[Sidecar contention and retry]
F --> G[Exclusive sidecar lock]
E --> H[Release final sidecar reference]
G --> H
Decision needed
Why: The patch deliberately adds a new public behavioral contract after current main removed the unsound boolean; choosing the permanent reentrancy API and caller obligations requires maintainer intent beyond mechanical correctness. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land a single documented owner-scoped reentrancy contract only after maintainers confirm that explicit caller-supplied owner strings are the intended public API and the contributor provides redacted packaged-runtime evidence for the owner-isolation and final-release behavior across supported platforms. Do we have a high-confidence way to reproduce the issue? Unclear for the new behavior: the PR describes concrete packaged-runtime scenarios and adds focused tests, but the available PR body provides assertions rather than a redacted live transcript, artifact, or observable output for this branch. Is this the best way to solve the issue? Unclear: owner-scoped reference counting is a focused alternative to the removed process-scoped boolean and preserves the JSON-store safety boundary, but maintainers must first confirm that this new public API is preferable to leaving nesting unsupported. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6009ba6253a7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
reentrantOwnerto async and sync file-lock acquisition so only the same explicitly named logical holder can reuse an in-process canonical lockjsonStore, which remains ownerless and canonically queuedFollow-up to #63 and #60 after downstream consumer re-verification found the deliberate reentrant session-lock contract.
Compatibility and safety
The removed
allowReentrantboolean does not return. Callers that intentionally nest acquisition must pass the same operation-scoped owner string through one manager domain. The docs explicitly warn that a process-wide/shared constant is unsafe because it would recreate the unrelated-task admission bug fixed by #63.Async and sync acquisitions key held state by canonical target path. Matching defined owners increment one refcount and unlink only on the final idempotent release. Mismatched and missing owners are never admitted through that branch; a known live in-process holder is also not stale-reclaimed by its own manager.
Proof
withFileLockSyncparityjsonStorereproduction still persists count 3reentrantOwnerfor async and sync while rejectingallowReentrantwith TS2353Validation
pnpm check— 57 files, 622 passed, 7 skipped; package check includedpnpm test:security— 62 passedpnpm docs:sitepnpm native:testcould not run locally because this host has nocargobinary; native code is untouched, and hosted Rust CI is required before merge.