fix(2113): recover incomplete use-m aliases and cleanup races - #2114
fix(2113): recover incomplete use-m aliases and cleanup races#2114konard wants to merge 5 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #2113
Working session summaryImplemented and finalized the fix.
This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (269.7K + 18.9M cached) input tokens, 23.7K output tokens, $22.660326 cost 🤖 Models used:
📎 Log file uploaded as Gist (3509KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
After update of github.com/link-foundation/use-m I got: Double check also if it is related to https://github.com/link-foundation/command-stream and if we need to fix it also. Maybe pinning to previous versions will work as a workaround, in any case if it is possible to fix, all issues must be reported to our dependencies repositories. |
|
🤖 AI Work Session Started Starting automated work session at 2026-07-28T20:37:07.518Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 🤖 Models used:
📎 Log file uploaded as Gist (6699KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Problem
fix --ci-cdfailed while loadingcommand-streamfrom a global use-m alias in three supplied production runs:src/$.mjsbut lacked its relative importsrc/terminal-capture.mjs;src/$.trace.mjsinstead;use-m@8.14.3added corrupt-alias self-healing, repair failed while removing the alias withENOTEMPTY.Hive Mind's shared retry classifier did not recognize the wrapped internal
ERR_MODULE_NOT_FOUND. Both use-m's new repair and Hive Mind's downstream cleanup also called recursivefsPromises.rm()with Node's defaultmaxRetries: 0, allowing the transient cleanup race to escape.Solution
ERR_MODULE_NOT_FOUNDonly when it is the cause of use-m's exactFailed to import module from ...wrapper;recursive,force, five retries, and a 100 ms retry delay, then call use-m again;ensureUseM()wrapping, so every current and futureuse(...)call site receives the recovery;HIVE_MIND_USE_M_DEBUGtrace instead of silently discarding them;Dependency ownership and pinning
An
npm pack command-stream@0.17.2 --dry-run --jsonaudit found all 466 published entries, includingsrc/$.mjs,src/$.trace.mjs, andsrc/terminal-capture.mjs; tagjs-v0.17.2agrees with the tarball. The varying absent file therefore identifies incomplete aliases, not a command-stream packaging defect. Pinning command-stream cannot prevent the same partial-install state.Pinning use-m to 8.14.2 would remove upstream self-healing while leaving the downstream zero-retry cleanup gap. The original install problem was reported in use-m #66 and fixed by use-m PR #67. The post-release cleanup race is separately reported with the production evidence, reproduction, and suggested fix in use-m #68.
Reproduction and verification
Regression-first evidence:
node tests/test-use-with-retry.mjs— 39/39 passed after the fix;node experiments/issue-2113/reproduce-missing-transitive.mjs— produces the real wrappedERR_MODULE_NOT_FOUND, removes the alias, and recovers on attempt 2;node experiments/issue-2113/reproduce-cleanup-race.mjs— zero-retry removal reproducesENOTEMPTY; retry-budget removal completes without leaving the alias behind.Final local gates:
npm test— all 354 selected test files passed;npm run lint;npm run format:check;bash scripts/check-mjs-syntax.sh;bash scripts/check-file-line-limits.sh;git diff --check.Preserved evidence
The issue #2113 case study contains all three complete supplied logs, package/release audit data, timeline, requirement map, root-cause analysis, alternatives, online/upstream research, and the preserved use-m #68 report body.
Fixes #2113