Summary
When the MCP stdio server is launched by an agent/runtime and the parent process exits unexpectedly, the child codebase-memory-mcp process can keep running. That orphaned process may continue holding memory and contribute to out-of-memory conditions over time.
Expected behavior
The stdio MCP server should terminate when its launching parent process dies, matching the lifecycle of the agent/runtime that owns the stdio session.
Actual behavior
If the parent process dies without cleanly closing stdio, the server can remain alive as an orphaned process.
Proposed fix
Add a POSIX parent-process watchdog for the stdio MCP server and cover it with a regression script that kills the parent wrapper and verifies the child exits. Windows should remain explicitly skipped until a Windows-specific parent-death mechanism is added.
Validation plan
scripts/test.sh
scripts/lint.sh --ci
scripts/build.sh CC=cc CXX=c++
make -f Makefile.cbm security
Summary
When the MCP stdio server is launched by an agent/runtime and the parent process exits unexpectedly, the child
codebase-memory-mcpprocess can keep running. That orphaned process may continue holding memory and contribute to out-of-memory conditions over time.Expected behavior
The stdio MCP server should terminate when its launching parent process dies, matching the lifecycle of the agent/runtime that owns the stdio session.
Actual behavior
If the parent process dies without cleanly closing stdio, the server can remain alive as an orphaned process.
Proposed fix
Add a POSIX parent-process watchdog for the stdio MCP server and cover it with a regression script that kills the parent wrapper and verifies the child exits. Windows should remain explicitly skipped until a Windows-specific parent-death mechanism is added.
Validation plan
scripts/test.shscripts/lint.sh --ciscripts/build.sh CC=cc CXX=c++make -f Makefile.cbm security