feat(doctor): v4 home-residue detection + --fix, diagnostics age filter - #2532
Conversation
13 src-proven ~/.genie residue entries join the legacy-v4 manifest (lstat-only, symlinks never followed, full-content backup-first); genie doctor gains a v4-residue check with opt-in --fix (json-safe via logSink; uncertain keeps reported, never touched); update diagnostics age-filter scheduler signals at 48h so stale incidents stop resurfacing. Wish v4-home-residue-doctor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N1FLEV2Qse3jbX5Wz1sjWE
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9eaa151c2
ℹ️ 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".
| mkdirSync(dirname(backupPath), { recursive: true }); | ||
| cpSync(relic.path, backupPath, { recursive: true }); | ||
| ctx.backupDirUsed = true; | ||
| rmSync(relic.path, { recursive: true, force: true }); |
There was a problem hiding this comment.
Avoid deleting through symlinked residue parents
When a manifest path has a symlinked parent, e.g. ~/.genie/logs -> /somewhere/else, the detector records logs/scheduler.log because lstatSync() only checks the leaf path after the parent symlink has already been traversed. The cleanup then calls rmSync(relic.path), which deletes the target file outside GENIE_HOME; this can happen automatically during install/update cleanup, not just doctor --fix. Resolve and validate each candidate against the real genie home, or reject any symlink in the ancestor chain, before removing it.
Useful? React with 👍 / 👎.
| for (const entry of readdirSync(path, { withFileTypes: true })) { | ||
| total += sizeOfPathTree(join(path, entry.name)); |
There was a problem hiding this comment.
Keep doctor from crashing on unreadable residue trees
If a detected residue directory such as ~/.genie/relay exists but contains an unreadable subdirectory or entry, readdirSync() throws while computing sizeBytes; because detectV4HomeResidue() does not catch this per relic, plain genie doctor can abort instead of reporting diagnostics, and install cleanup can fail before reaching the per-relic error handling. Treat size calculation as best-effort here, similar to safeSizeOf() in the doctor output path.
Useful? React with 👍 / 👎.
Wish: v4-home-residue-doctor
Extends the shipped v4 cleanup to
~/.geniedaemon-era residue and puts it in every user's hands viagenie doctor.v4 residuecheck (count/bytes split by genie-home vs claude buckets);--fixopt-in runs the backup-first cleanup;--fix --jsonis contract-safe (chatter → stderr via logSink; subprocess test parses stdout as JSON).summarizeJsonlSignalsage-filters at 48h — a June-22 disk-full no longer resurfaces as "Recent scheduler signals" on healthy machines (observed tonight).Review: FIX-FIRST (json contract) → fixed → all prescriptions verified. 164 tests/0 fail across the 4 suites; destructive surface independently re-proven (symlink attack, byte-identical live files, near-miss globs). check:fast green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01N1FLEV2Qse3jbX5Wz1sjWE