Context
After M6 migration PR #10997 (commit dc437318e, merged 2026-05-08), ai/services/github-workflow/toolService.mjs:11 retains a stale 3-dot relative-import path that resolves to repo-root, causing the github-workflow MCP server to crash on boot:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/Shared/github/neomjs/neo/ToolService.mjs' imported from /Users/Shared/github/neomjs/neo/ai/services/github-workflow/toolService.mjs
Root cause
Empirically verified via discipline-symmetric-application audit across all 4 SDK toolService.mjs files:
| File |
Import path |
Correct? |
memory-core/toolService.mjs |
'../../mcp/ToolService.mjs' |
✅ |
knowledge-base/toolService.mjs |
'../../mcp/ToolService.mjs' |
✅ |
neural-link/toolService.mjs |
'../../mcp/ToolService.mjs' |
✅ |
github-workflow/toolService.mjs |
'../../../ToolService.mjs' |
❌ |
PR #10997 moved the file from ai/mcp/server/github-workflow/services/toolService.mjs (3 levels deep) to ai/services/github-workflow/toolService.mjs (2 levels deep) but didn't update the relative-import depth from '../../../ToolService.mjs' to '../../mcp/ToolService.mjs'. The 3-dot path was correct from the OLD location (resolved to ai/mcp/ToolService.mjs); from the NEW location it resolves to repo root where no ToolService.mjs exists.
The Fix
One-line edit in ai/services/github-workflow/toolService.mjs:11:
-import ToolService from '../../../ToolService.mjs';
+import ToolService from '../../mcp/ToolService.mjs';
Boot-test verified: with the fix applied, node ai/mcp/server/github-workflow/mcp-server.mjs boots cleanly (background process stays alive past 3s probe; previous run crashed instantly with ERR_MODULE_NOT_FOUND).
Why CI didn't catch this
The 39 unit tests cited in PR #10997's body imported individual service files (IssueService, PullRequestService, etc.) — not the wiring-layer toolService.mjs that aggregates them for the MCP server entry point. Wiring bugs at module-resolution time are invisible to per-service unit tests.
Substrate-quality lesson worth keeping: wiring/aggregation files need their own boot smoke test (e.g., node ai/mcp/server/<server>/mcp-server.mjs with a 3-second-alive probe). Sibling pattern to feedback_symmetric_spec_cleanup and the discipline-symmetric-application heuristic from M4 Epic #11077 cycle 1→3.
Empirical Anchor: Self-Repair Skill Application
Surfaced today (2026-05-10) via the /self-repair skill's Phase 1 step 4 ("Native Terminal Execution: If an MCP connection fails... Boot the Neo MCP servers directly in a separate terminal process using the run_command tool to witness the crash or monitor logs."). Skill-prescribed diagnostic surfaced the bug in <30 seconds.
Operator @tobiu detected the github-workflow tools missing post-harness-restart; suggested /self-repair. Self-repair Phase 1 step 4 → empirical boot-test → grep on sister files → asymmetry surfaced → root cause identified.
Acceptance Criteria
Out of Scope
- Audit of other M6-migration PRs (memory-core, knowledge-base, neural-link) for similar wiring bugs — initial empirical sweep showed sister files are correct, but a fresh systematic boot-test per server is worth a separate ticket
- Refactoring the toolService.mjs aggregator pattern itself
Avoided Traps / Gold Standards Rejected
Decision Matrix
- Single-line relative-import fix (Selected): Mirrors the correct pattern in 3 sister files. Lowest-risk, lowest-blast-radius fix.
- Migrate
ToolService.mjs to a new flatter path: Rejected. Out of scope; would require updating 4 sister imports + sometimes-non-trivial dependents. The current shape is fine; only github-workflow's import was stale.
- Switch to bare-name import via package.json subpath imports: Rejected. Substrate-correct pattern is relative imports for internal modules; bare-name imports would require additional package.json plumbing without proportional benefit.
- Trap: Treating CI-passing as boot-correctness. Rejection: Per-service unit tests don't exercise the wiring-layer entry point that loads at MCP server boot.
- Trap: Only fixing the symptom without identifying the substrate-quality lesson. Rejection: Boot smoke tests for wiring files would have caught this at PR-review time. Should be added to test substrate (separate follow-up).
Related
- M6 migration PR #10997 (origin of bug)
- M6 epic #10993 (parent epic)
feedback_symmetric_spec_cleanup MEMORY.md entry (sibling pattern: symmetric audit at code-review time)
- Discipline-symmetric-application heuristic (#11077 cycle 1→3 retrospective)
- Self-repair skill Phase 1 step 4 (the diagnostic that surfaced this)
Origin Session ID: c2912891-b459-4a03-b2af-154d5e264df1
Retrieval Hint: "github-workflow MCP boot ERR_MODULE_NOT_FOUND", "toolService.mjs stale relative import", "M6 migration #10997 wiring-bug"
Context
After M6 migration PR #10997 (commit
dc437318e, merged 2026-05-08),ai/services/github-workflow/toolService.mjs:11retains a stale 3-dot relative-import path that resolves to repo-root, causing the github-workflow MCP server to crash on boot:Root cause
Empirically verified via discipline-symmetric-application audit across all 4 SDK toolService.mjs files:
memory-core/toolService.mjs'../../mcp/ToolService.mjs'knowledge-base/toolService.mjs'../../mcp/ToolService.mjs'neural-link/toolService.mjs'../../mcp/ToolService.mjs'github-workflow/toolService.mjs'../../../ToolService.mjs'PR #10997 moved the file from
ai/mcp/server/github-workflow/services/toolService.mjs(3 levels deep) toai/services/github-workflow/toolService.mjs(2 levels deep) but didn't update the relative-import depth from'../../../ToolService.mjs'to'../../mcp/ToolService.mjs'. The 3-dot path was correct from the OLD location (resolved toai/mcp/ToolService.mjs); from the NEW location it resolves to repo root where noToolService.mjsexists.The Fix
One-line edit in
ai/services/github-workflow/toolService.mjs:11:-import ToolService from '../../../ToolService.mjs'; +import ToolService from '../../mcp/ToolService.mjs';Boot-test verified: with the fix applied,
node ai/mcp/server/github-workflow/mcp-server.mjsboots cleanly (background process stays alive past 3s probe; previous run crashed instantly with ERR_MODULE_NOT_FOUND).Why CI didn't catch this
The 39 unit tests cited in PR #10997's body imported individual service files (IssueService, PullRequestService, etc.) — not the wiring-layer
toolService.mjsthat aggregates them for the MCP server entry point. Wiring bugs at module-resolution time are invisible to per-service unit tests.Substrate-quality lesson worth keeping: wiring/aggregation files need their own boot smoke test (e.g.,
node ai/mcp/server/<server>/mcp-server.mjswith a 3-second-alive probe). Sibling pattern tofeedback_symmetric_spec_cleanupand the discipline-symmetric-application heuristic from M4 Epic #11077 cycle 1→3.Empirical Anchor: Self-Repair Skill Application
Surfaced today (2026-05-10) via the
/self-repairskill's Phase 1 step 4 ("Native Terminal Execution: If an MCP connection fails... Boot the Neo MCP servers directly in a separate terminal process using the run_command tool to witness the crash or monitor logs."). Skill-prescribed diagnostic surfaced the bug in <30 seconds.Operator @tobiu detected the github-workflow tools missing post-harness-restart; suggested
/self-repair. Self-repair Phase 1 step 4 → empirical boot-test → grep on sister files → asymmetry surfaced → root cause identified.Acceptance Criteria
ai/services/github-workflow/toolService.mjs:11patched per the diff abovenode ai/mcp/server/github-workflow/mcp-server.mjssurvives 3s probe (no instant ERR_MODULE_NOT_FOUND crash)ai/services/github-workflow/post-fix (initial sweep showed all other 3-dot imports correctly resolve to repo-root viasrc/core/Base.mjs)Out of Scope
Avoided Traps / Gold Standards Rejected
Decision Matrix
ToolService.mjsto a new flatter path: Rejected. Out of scope; would require updating 4 sister imports + sometimes-non-trivial dependents. The current shape is fine; only github-workflow's import was stale.Related
feedback_symmetric_spec_cleanupMEMORY.md entry (sibling pattern: symmetric audit at code-review time)Origin Session ID: c2912891-b459-4a03-b2af-154d5e264df1 Retrieval Hint: "github-workflow MCP boot ERR_MODULE_NOT_FOUND", "toolService.mjs stale relative import", "M6 migration #10997 wiring-bug"