fix(cli): retry root bootstrap contention - #675
Conversation
Retry authenticated live-owner bootstrap contention across CLI commands within a bounded window while preserving fail-closed stale and ambiguous lock handling. Improve operator diagnostics, coverage, and recovery documentation. Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
PR Summary by QodoFix CLI root-bootstrap lock contention with bounded retries
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR addresses transient root-bootstrap lock contention by adding a single bounded retry policy at the CLI entry boundary, so normal commands (e.g. lcm search) tolerate short overlaps with an authenticated live bootstrap while preserving fail-closed behavior for unsafe/ambiguous lock states.
Changes:
- Generalize root-bootstrap contention retry to all non-custom-help CLI invocations (20 attempts, 50ms delay; ~950ms max).
- Remove redundant daemon-client bootstrap migration so daemon-backed commands migrate only once per invocation.
- Update diagnostics, documentation, and tests to cover retry success/exhaustion and non-retryable lock states; add a patch changeset.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
bin/lcm.ts |
Adds CLI-wide bounded retry helper and removes redundant daemon-client migration; updates top-level error rendering. |
src/runtime-paths.ts |
Improves live-owner contention message to be actionable and explicitly fail-closed (no manual deletion guidance). |
test/bin/lcm-run-cli.test.ts |
Verifies single-boundary retry behavior, exhaustion limits, and safe error rendering. |
test/runtime-paths.test.ts |
Tightens assertions for verified-live-owner contention vs ambiguous-owner fallback. |
test/coverage-cli-runtime-path-errors.test.ts |
Ensures unsafe/ambiguous/tampered/reclaim-race states remain untyped (non-retryable) errors. |
docs/daemon-restart-recovery.md |
Documents CLI-wide bounded retry behavior and reiterates fail-closed recovery guidance. |
docs/superpowers/specs/2026-08-12-root-bootstrap-contention-design.md |
Adds the design rationale and security constraints for the retry policy. |
docs/superpowers/plans/2026-08-12-root-bootstrap-contention.md |
Adds the implementation plan and verification checklist for the change. |
.changeset/steady-bootstrap-retries.md |
Adds patch release note for the user-visible CLI behavior change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR More tips ↗ | Customize Qodo ↗ | Qodo docs ↗ |
Match the changeset to the bounded retry policy, normalize the constructor assertion style, and teach future reviews to verify retry-window wording. Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
Summary
Retry transient, authenticated live-owner root-bootstrap lock contention across CLI commands so short overlaps no longer surface as immediate failures. Preserve the existing fail-closed handling for stale, ambiguous, tampered, or unsafe lock states and provide actionable diagnostics when bounded retries are exhausted.
Fixes #673.
Changes
BootstrapLockContentionErrorinstancesHow to validate
npm run lint.npm run typecheck.npm run build.npm run test:ciand confirm 100% lines, branches, functions, and statements for the complete collected scope.Risk / rollout
Notes
.changeset/steady-bootstrap-retries.md