Skip to content

[NO-JIRA] Bound MCP server startup and kill the process group on a failed start (R14) - #23

Merged
johnnymo87 merged 2 commits into
patched/v1.60.2from
r14-mcp-startup-timeout
Nov 22, 2026
Merged

johnnymo87 merged 2 commits into
patched/v1.60.2from
r14-mcp-startup-timeout

Conversation

@johnnymo87

Copy link
Copy Markdown
Owner

Description

Port of patch 14 (fork #7) onto v1.60.2, for bead workstation-6w7i.26.4.4 (R14).

On v1.60.2 an MCP server that never finishes initialize hangs session/new, session/load, extensions/add and every lease that starts it. Nothing bounds the start. honkd's mcp/ops.rs needs extensions/add to return.

  • McpClient::connect bounds serve_with_lifecycle with GOOSE_EXTENSION_STARTUP_TIMEOUT. The default is 25s. 0 means the default, not "no bound": a slow first npx -y/uvx install is the reason to raise it. The per-extension timeout still applies only to requests.
  • If a stdio start fails or is abandoned, a drop guard kills the child's process group. Stderr is collected with a 2s grace. Before this, a grandchild that held the stderr pipe kept spawn() waiting for EOF forever.
  • ProcessExit now includes its source error in its message, so the timeout shows up in the error.
  • The fork code is in agents/mcp_startup_timeout.rs. Upstream files get only registration lines and notices.
  • The original patch's parallel-load part is dropped, because upstream does it now (Lease a session's selection and start each extension on first use aaif-goose/goose#12775, lease.rs join_all).

Known gaps, unchanged from 1.54:

  • On the Docker path the group leader is the docker exec client, so a hung server inside the container is not killed.
  • A server that initializes and then hangs on tools/list is bounded only by the 300s request timeout.

Tests: 7 exact tests, added to patched-test.yml. They failed before the change and pass after it. The process-group test fails if the kill is removed. cargo clippy -p goose -p goose-agent --all-targets -D warnings is clean.

References

johnnymo87 added a commit that referenced this pull request Nov 22, 2026
…ill the process group on a failed start

A hung MCP server's initialize was awaited unbounded, so session/new,
session/load, extensions/add and any extension lease hung with it. Startup
is now bounded (default 25s, 0 = default). On a failed stdio start the
child's process group is killed and stderr is collected with a 2s grace,
since a grandchild holding the pipe kept spawn() waiting for EOF forever.
ProcessExit's message now includes its source error.

Port of patch 14 (fork #7) onto v1.60.2, in the fork-only module
agents/mcp_startup_timeout.rs. Its parallel-load part is upstream (aaif-goose#12775).

X-Shepherd-Wake: #23
@johnnymo87
johnnymo87 force-pushed the r14-mcp-startup-timeout branch from ef64529 to de7bb4b Compare November 22, 2026 06:17
johnnymo87 added a commit that referenced this pull request Nov 22, 2026
…s cleaned up too; gate unix-only test helpers

X-Shepherd-Wake: #23
…ill the process group on a failed start

A hung MCP server's initialize was awaited unbounded, so session/new,
session/load, extensions/add and any extension lease hung with it. Startup
is now bounded (default 25s, 0 = default). On a failed stdio start the
child's process group is killed and stderr is collected with a 2s grace,
since a grandchild holding the pipe kept spawn() waiting for EOF forever.
ProcessExit's message now includes its source error.

Port of patch 14 (fork #7) onto v1.60.2, in the fork-only module
agents/mcp_startup_timeout.rs. Its parallel-load part is upstream (aaif-goose#12775).

X-Shepherd-Wake: #23
…s cleaned up too; gate unix-only test helpers

X-Shepherd-Wake: #23
@johnnymo87
johnnymo87 force-pushed the r14-mcp-startup-timeout branch from de7bb4b to 84bc347 Compare November 22, 2026 06:45
@johnnymo87
johnnymo87 merged commit d73dc1f into patched/v1.60.2 Nov 22, 2026
12 checks passed
johnnymo87 added a commit that referenced this pull request Nov 22, 2026
…ill the process group on a failed start

A hung MCP server's initialize was awaited unbounded, so session/new,
session/load, extensions/add and any extension lease hung with it. Startup
is now bounded (default 25s, 0 = default). On a failed stdio start the
child's process group is killed and stderr is collected with a 2s grace,
since a grandchild holding the pipe kept spawn() waiting for EOF forever.
ProcessExit's message now includes its source error.

Port of patch 14 (fork #7) onto v1.60.2, in the fork-only module
agents/mcp_startup_timeout.rs. Its parallel-load part is upstream (aaif-goose#12775).

X-Shepherd-Wake: #23
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