Skip to content

fix(heal): harden healNatives against stale locations and opaque failures - #17

Merged
pacphi merged 1 commit into
mainfrom
harden-heal-natives
Jul 14, 2026
Merged

pacphi merged 1 commit into
mainfrom
harden-heal-natives

Conversation

@pacphi

@pacphi pacphi commented Jul 14, 2026

Copy link
Copy Markdown
Owner

What

Two hardening changes to healNatives() in src/lib/heal.mjs, prompted by a live ak sync incident during the ruflo 3.28.0 → 3.29.0 upgrade:

  1. Stale-location guard — each agentdb location is re-checked with fs.existsSync immediately before installing. The upgrade step earlier in the same sync can remove a location between enumeration and heal (agentic-flow/node_modules/agentdb no longer exists in the 3.29.0 tree), which previously produced a spurious sticky FAILED … (data-loss writes) against a phantom path.

  2. Diagnosable failures — FAILED details now include the last two lines of npm's stderr (capped at 200 chars, exit-code fallback), for both agentdb locations and the agentic-qe root. The bare FAILED made the original incident undiagnosable from sync output alone.

Verification

  • node --check + module import pass
  • node tests/statusline-segments.test.cjs — 20/20 pass
  • Live healNatives() run on the healed machine returns {"ok":true,"detail":"already native everywhere"} (idempotence preserved)

🤖 Generated with Claude Code

…ures

- Re-check each agentdb location with fs.existsSync immediately before
  installing: an upgrade earlier in the same sync can remove a location
  (agentic-flow/node_modules/agentdb vanished in the ruflo 3.29.0 tree),
  which previously surfaced as a spurious FAILED against a phantom path.
- Include the tail of npm's stderr (capped, with exit-code fallback) in
  FAILED details for both agentdb locations and agentic-qe, so a real
  native-install failure is diagnosable from the sync output alone.
@pacphi
pacphi merged commit 79ec182 into main Jul 14, 2026
9 checks passed
@pacphi
pacphi deleted the harden-heal-natives branch July 14, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant