fix(doctor): recover stale managed daemon configuration - #670
Conversation
Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
PR Summary by QodoFix
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e6ac0617c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR updates lcm doctor so that when ensureDaemon() returns an exact authenticated stale-config refusal (and the running daemon version matches the installed LCM version), doctor performs a single authenticated restartDaemon() attempt using identical lifecycle options, then reports the outcome as a warning with fixApplied: true on success. It also documents the recovery behavior and adds a patch Changeset.
Changes:
- Add stale-config-specific doctor recovery: retry with
restartDaemon()only for matching-versionstale-configrefusals fromensureDaemon(). - Add regression-first doctor tests covering successful repair, non-stale refusals, and failed stale-config repair with exact remediation preserved.
- Document the recovery behavior and include a patch changeset.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/doctor/doctor.ts |
Adds targeted stale-config recovery logic that reuses the exact validated lifecycle options and reports repaired restarts as warn with fixApplied: true. |
test/doctor/doctor.test.ts |
Adds TDD regressions asserting the restart delegation is narrow (stale-config only), option-identical, and preserves exact remediation on failure. |
docs/daemon-restart-recovery.md |
Documents the new doctor-driven stale-config recovery behavior and its reporting semantics. |
.changeset/steady-doctors-repair.md |
Patch changeset for the user-facing doctor recovery behavior change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Code Review by Qodo
1.
|
Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
Signed-off-by: Bernardo Donadio <bcdonadio@bcdonadio.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/doctor/doctor.ts:1022
- The second
restartDaemon()call can throw (e.g. when the PID file points at an unverified/non-stoppable process). Because this happens inside the broadtry { … } catch { … }, a thrown restart during stale-config repair is currently converted into awarn(“daemon validation failed”) rather than a fail-closed daemon result with stale-config remediation. Consider catching restart throws locally and converting them into a disconnectedRestartDaemonResultso doctor reports a failure with the correct guidance.
&& !lifecycleResult.connected
&& lifecycleResult.refusalReason === "stale-config";
if (repairedStaleConfiguration) {
lifecycleResult = await restartDaemon(lifecycleOptions);
}
Summary
Fixes #669.
lcm doctordelegate only an exact authenticatedstale-configrefusal fromensureDaemonto the existing saferestartDaemonrepair pathfixApplied: true, backed by regression-first TDDTDD and verification
restartDaemonwas called 0 times; non-stale control passednpm run typecheckpassednpm run test:ci: 260 passed / 2 skipped files; 6,333 passed / 12 skipped tests; 100% statements (26,820/26,820), branches (19,380/19,380), functions (4,251/4,251), and lines (24,483/24,483)MoM review
Changeset
.changeset/steady-doctors-repair.md— patch