Skip to content

Commit 153f6e6

Browse files
cliffhallclaude
andcommitted
fix: time out the HTTP smoke's curl probes; close the stdio client in finally
Copilot round 10 on #4921. - client-smoke: both curl probes carry a two-second limit, so a listener that accepts and never answers cannot hang the recipe. - testing: the stdio recipe closes the client in finally, so a failed assertion does not leave the spawned server running. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent c8fac5c commit 153f6e6

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎.claude/skills/client-smoke/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ the URL. The transport is inferred from the path: `/mcp` is Streamable HTTP,
132132
(
133133
URL=http://localhost:3917/mcp
134134
# Refuse a port something already answers on: it would be tested instead of this build.
135-
curl -s -o /dev/null "$URL" && { echo "port 3917 is already in use" >&2; exit 1; }
135+
curl -s -m 2 -o /dev/null "$URL" && { echo "port 3917 is already in use" >&2; exit 1; }
136136
PORT=3917 node src/everything/dist/index.js streamableHttp >/dev/null 2>&1 &
137137
SERVER_PID=$!
138138
trap 'kill "$SERVER_PID" 2>/dev/null' EXIT # stops it however the subshell ends
139139
READY=
140140
for _ in $(seq 50); do # at most ten seconds
141141
kill -0 "$SERVER_PID" 2>/dev/null || { echo "server exited before listening" >&2; exit 1; }
142-
curl -s -o /dev/null "$URL" && { READY=1; break; }
142+
curl -s -m 2 -o /dev/null "$URL" && { READY=1; break; }
143143
sleep 0.2
144144
done
145145
[ -n "$READY" ] || { echo "server did not listen within ten seconds" >&2; exit 1; }

‎.claude/skills/testing/SKILL.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,17 @@ const transport = new StdioClientTransport({
133133
stderr: "pipe",
134134
});
135135
const client = new Client({ name: "test-client", version: "0.0.0" });
136-
await client.connect(transport);
137-
// … assert …
138-
await client.close(); // this is what stops the child process
136+
try {
137+
await client.connect(transport);
138+
// … assert …
139+
} finally {
140+
await client.close(); // this is what stops the child process
141+
}
139142
```
140143

144+
Closing in `finally` (or in `afterEach`, as the `filesystem` tests do) matters:
145+
a failed assertion that skips `close()` leaves the spawned server running.
146+
141147
`src/sequentialthinking/__tests__/input-schema.test.ts` is the reference.
142148
`stderr: "pipe"` keeps the server's startup banner off the console.
143149

0 commit comments

Comments
 (0)