LearnNewsExamplesServices
Frontmatter
title>-
fixMCP Infrastructure Stability — Stdout Pollution, Crash Recovery, & Triage
authortobiu
stateMerged
createdAtApr 13, 2026, 6:23 PM
updatedAtApr 13, 2026, 6:35 PM
closedAtApr 13, 2026, 6:35 PM
mergedAtApr 13, 2026, 6:35 PM
branchesdevagent/9977-infrastructure-stability
urlhttps://github.com/neomjs/neo/pull/9978
Merged
tobiu
tobiu commented on Apr 13, 2026, 6:23 PM

Resolves #9977.

Summary

This PR formalizes critical infrastructure stability patches discovered during a localized breakdown of the Memory Core and Neural Link MCP servers. The standard JSON-RPC stdio transport was corrupting due to raw console output, and missing class methods were causing hard crashes during tool dispatch.

Architectural Changes

1. The Infrastructure Triage Mandate (AGENTS_STARTUP.md)

Previously, agents were instructed to ignore healthcheck failures and proceed on a degraded Golden Path. This has been explicitly reversed. If core ecosystem servers fail, agents are now strictly mandated to immediately pivot into diagnostic and self-healing workflows. Executing roadmap tasks with a sick framework ecosystem is now forbidden.

2. Eliminating stdout JSON-RPC Corruption

The MCP standard transport relies on pure JSON over stdout.

  • Memory Core / SessionService: Replaced console.log with logger.info inside the asynchronous Map-Reduce summarization pipeline.
  • Neural Link / RecorderService: Imported the centralized logger.mjs and refactored all console.error and console.warn statements to route through the standard logger.

3. Neural Link Runtime Crash Recovery

  • ConnectionService.mjs: Implemented the missing getDefaultSessionId() method. The toolService.mjs dispatch layer implicitly expected this method to exist to support auto-targeting. Its absence caused soft crashes during any Neural Link tool execution where sessionId was omitted.
tobiu
tobiu commented on Apr 13, 2026, 6:25 PM

Input from Antigravity (Gemini 3.1 Pro):

✦ # PR Review Summary

Status: Approved

Thanks for putting this together! Great approach to solving the MCP stdio corruption and tool dispatch crashes. Institutionalizing the "Infrastructure Triage Mandate" is a crucial conceptual safety net for the autonomous Swarm.


📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 100 - Perfectly aligns with the standard MCP architecture by utilizing the centralized logger to prevent stdout JSON-RPC transport corruption.
  • [CONTENT_COMPLETENESS]: 90 - Basic JSDoc is present for getDefaultSessionId(). A @summary tag would be ideal per the 'Anchor & Echo' mandate, but it is acceptable for this hotfix.
  • [EXECUTION_QUALITY]: 100 - Logic is simple, deterministic, and resolves the crash gracefully.
  • [PRODUCTIVITY]: 100 - Fully achieves the goals of the linked ticket in a surgical manner.
  • [IMPACT]: 80 - High operational impact by preventing silent agent failures and ensuring Neural Link commands successfully dispatch to the active session.
  • [COMPLEXITY]: 20 - Very localized, minimal refactoring.
  • [EFFORT_PROFILE]: Quick Win - Extremely High ROI for base system stability with minimal code churn.

🕸️ Context & Graph Linking

  • Target Epic / Issue ID: Resolves #9977

🧠 Graph Ingestion Notes

  • [TOOLING_GAP]: We must institutionalize that Node.js MCP standard stdio transports automatically corrupt if any console.log bypasses the protocol boundaries. Centralized logger injection must be enforced for all future MCP services.
  • [RETROSPECTIVE]: Replacing the fallback behavior in AGENTS_STARTUP.md with the "Infrastructure Triage Mandate" represents a fundamental maturation stage. Agents will no longer hallucinate forward progress when their core backend constraints fail.

📋 Required Actions

To proceed with merging, please address the following:

  • (No mandatory adjustments required)

This PR is definitively approved. You can proceed to merge.