Skip to content

test(mcp): cover a silent drop between the MCP server and its probe - #20

Open
jbachorik wants to merge 1 commit into
mainfrom
test/o19-silent-drop
Open

jbachorik wants to merge 1 commit into
mainfrom
test/o19-silent-drop

Conversation

@jbachorik

@jbachorik jbachorik commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What & why

A target stopped with SIGSTOP keeps its TCP connection open but stops answering. That is the silent-drop case only the BTrace v2 heartbeat (btraceio/btrace#998) catches; a closed socket is already covered by McpLostConnectionE2ETest.

New McpSilentDropE2ETest (skipped on Windows): deploy a probe, SIGSTOP the target, assert the MCP session ends as a lost connection, not an exit; SIGCONT, then assert the probe is still firing, list_probes lists it as detached, and stop_detached_probe stops it.

No production code changes: the MCP server already turns the client's ExitCommand(-1) into a lost connection; it just never received one for a silent drop.

How verified

Command Result
BTRACE_JAR=<btrace feat/o19 build> ./gradlew e2eTest --tests '*SilentDrop*' 1/1 passed in 9.6 s
same against a BTrace build without the heartbeat fails: "the session did not notice the silent target"
BTRACE_JAR=<btrace feat/o19 build> ./gradlew e2eTest McpServerE2ETest 13/13, McpLostConnectionE2ETest 2/2, McpSilentDropE2ETest 1/1
./gradlew check BUILD SUCCESSFUL

Coverage notes

Covers a peer that is alive but not reading (SIGSTOP). A real network drop is not staged (needs root).

Not verified / known limitations

Draft until btraceio/btrace#998 merges. The PR's mcp-e2e run builds BTrace's default branch, which has no heartbeat yet, so this test fails there. A workflow_dispatch run with btrace-ref: feat/o19-heartbeat checks it against the heartbeat branch.

Breaking changes / migration

None.

Links

Depends on btraceio/btrace#998.

🤖 Generated with Claude Code

A target stopped with SIGSTOP keeps its TCP connection open but stops
answering, which is the case only the BTrace v2 heartbeat catches (a closed
socket is already covered by McpLostConnectionE2ETest). The test deploys a
probe, stops the target, asserts the session ends as a lost connection and
not an exit, then resumes the target and asserts the probe is still firing,
list_probes lists it as detached and stop_detached_probe stops it. Skipped
on Windows.

Verified: against a BTrace build with the heartbeat (btraceio/btrace
feat/o19-heartbeat) 1/1 passed in 9.6 s; against one without it, fails with
"the session did not notice the silent target"; full e2eTest with the
heartbeat build: McpServerE2ETest 13/13, McpLostConnectionE2ETest 2/2,
McpSilentDropE2ETest 1/1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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