Repository navigation
ci(smoke-test): send integer ACP protocolVersion and poll for handshake - #1614
Conversation
The non-codex smoke-test handshake sent protocolVersion "2025-03-26" (an MCP-style string). ACP v1 requires an integer, so opencode, claude, gemini, kimi, cursor, mimocode and pi all rejected initialize with Invalid params and fell back to a bare --help check. For mimocode that fallback is intermittently non-zero, which failed PR #1613 twice. - send protocolVersion 1 to every agent - poll docker logs for up to 30s instead of a fixed 5s sleep - accept any initialize result with protocolVersion (agentInfo is optional in ACP), still printing the agent name when present - run the workflow when the workflow file itself changes
This comment has been minimized.
This comment has been minimized.
… error, clean up attach - Select the initialize reply with id 1 per line (fromjson?), skipping notifications, logs, and malformed lines. - Require jsonrpc 2.0 and result.protocolVersion == 1; agentInfo stays optional. - A matched reply that is a JSON-RPC error or a different version now fails the leg instead of falling back to --help. The --help fallback applies only when no reply arrives within 30 s. - Track the background docker attach PID and clean up the container and attach client in an EXIT trap.
…stale comment - The selector now requires jsonrpc 2.0 and a result or error member, so an agent request or a JSON log line carrying id 1 no longer ends polling. - A JSON-RPC error with id null (parse error) is also treated as a reply and fails the leg. - Update the step comment: a rejected string version now fails the leg instead of falling through to --help.
|
Note LGTM ✅ - All four round 1 findings and both round 2 findings are fixed. CI on What This PR DoesThe docker smoke test sent How It Works
CI Evidence (Docker Smoke Test run 44968670715, head
|
| Result | Legs |
|---|---|
ACP handshake ok |
antigravity, claude, codex, copilot, cursor, devin, gemini, grok, kimi, mimocode, native-sandbox, opencode, pi |
No reply within 30 s, --help fallback |
kiro-cli, kiro-cli unified |
The agents that need auth (for example gemini and pi, which advertise authMethods) return a valid initialize result rather than an error. Making error fatal therefore does not turn any current leg red.
Findings
| # | Severity | Finding | Location |
|---|---|---|---|
| 1 | 🟢 | JSON-RPC error and wrong-version replies now fail the leg; --help is reserved for no reply (round 1 F1, fixed) |
.github/workflows/docker-smoke-test.yml:174-190 |
| 2 | 🟢 | The reply is matched by id and JSON-RPC response shape, not by the first { line (round 1 F2 and round 2 selector finding, fixed) |
.github/workflows/docker-smoke-test.yml:162-164 |
| 3 | 🟢 | The success check asserts protocolVersion == 1 with agentInfo optional (round 1 F3, fixed) |
.github/workflows/docker-smoke-test.yml:174 |
| 4 | 🟢 | The attach client and container are cleaned up in an EXIT trap (round 1 F4, fixed) |
.github/workflows/docker-smoke-test.yml:140-169 |
| 5 | 🟢 | The step comment now describes the new failure behavior (round 2 stale-comment finding, fixed) | .github/workflows/docker-smoke-test.yml:136-137 |
| 6 | 🟢 | CI shows the fix works: 13 of 15 legs moved from the --help fallback to a real handshake |
- |
Finding Details
🟢 F1: Errors no longer hide behind --help
Round 1 found that a JSON-RPC error reply was treated like no reply, so non-codex legs passed on --help. The new elif [ -n "$RESPONSE" ] branch prints the reply and exits 1. The --help fallback now prints no response within 30 s, which matches when it runs.
🟢 F2: Reply matching
Round 1 found that grep -m1 '^{' could stop on a notification or another id. Round 2 found that matching on id == 1 alone could still stop on an agent request or a JSON log line carrying id: 1. The selector now also requires jsonrpc == "2.0" and a result or error member. Fixture checks against a notification, a log object with id: 1, an agent request with id: 1, a malformed line, an id: 2 result, an id: null error, and a valid result selected only the last two. fromjson? is available in jq 1.7 on the Ubuntu 24.04 runners.
🟢 F3: Version assertion
jq == is type-strict, so protocolVersion values 2 and "1" are rejected. cursor and grok return valid results without agentInfo and still pass.
🟢 F4: Cleanup
ATTACH_PID=$! holds the docker attach PID (the last command in the background pipeline). cleanup removes the container, kills and waits for the attach client, and clears both variables, so the EXIT trap that runs again later does nothing. A stub-docker run of the step confirmed that an error reply exits 1, a valid reply passes, and no attach process is left running.
🟢 F5: Comment accuracy
The comment above INIT said a rejected string version falls through to --help. It now says that case fails the leg.
🟢 F6: Verified by CI
See CI Evidence above. The seven agents that rejected the string version before this PR (opencode, claude, gemini, kimi, cursor, mimocode, pi) all complete the handshake.
Addressing Reviewer Feedback
Round 1 findings
F1: a JSON-RPC
errorresponse falls back to--helpand passes.
✅ Addressed in c990f26: matched errors and wrong versions exit 1.
F2: polling stops at the first line starting with
{without checkingid: 1.
✅ Addressed in c990f26 and b827ab6: per-line id and response-shape matching.
F3: any truthy
protocolVersionpasses.
✅ Addressed in c990f26: asserts jsonrpc == "2.0" and protocolVersion == 1.
F4: the background
docker attachPID is never waited on or killed.
✅ Addressed in c990f26: EXIT trap with explicit cleanup.
Round 2 review
The step comment still describes falling through to
--help.
✅ Addressed in b827ab6.
The selector matches any object with
id: 1, not only a JSON-RPC response.
✅ Addressed in b827ab6: requires jsonrpc == "2.0" and result or error.
A JSON-RPC parse error with
id: nullwould slide into the--helppath.
✅ Addressed in b827ab6: an error with id: null is selected and fails the leg.
Thirty seconds of silence does not prove the agent needs auth; a crash or hang can also be silent and then pass on
--help.
ℹ️ Accepted as a follow-up: the PR's Review Contract lists the no-response fallback as a non-goal. Only the two kiro-cli legs are silent today, so this is tracked together with the kiro-cli investigation below.
If
docker run -dfails, the loop polls an empty container id for 30 s.
ℹ️ Accepted: GitHub Actions runs this step with bash -e, and a failing CID=$(docker run ...) assignment exits the step immediately, so the loop does not run.
jq | head -n1relies on|| truewithoutpipefail.
ℹ️ Accepted: correct today; anyone adding set -o pipefail to this step must keep the SIGPIPE case masked.
Security: no new injection, secret, container, or dependency surface; the matrix values are repo-controlled constants.
ℹ️ Noted: no action needed.
Follow-ups (non-blocking)
- kiro-cli does not answer
initializewithin 30 s. Both kiro-cli legs, including the default image, still use the--helpfallback and pay the full 30 s. Find out why (auth gate, output buffering, or startup arguments), then consider making no-reply fatal or checking that the container is still running before falling back. docker-smoke-test-unified.ymlkeeps the old probe. It already sendsprotocolVersion: 1and checks exact agent names, but still usessleep 5andgrep -m1 '^{'. A shared probe script under.github/scripts/with fixture tests would stop the two workflows from drifting.- Probe harness. A small stdio JSON-RPC client with real timeouts and distinct exit codes for ok, error, and no reply would replace the shell polling.
Baseline Check
- PR opened: 2026-11-21
- Head:
b827ab6fdcfdb536d0ebb8f3a5ea1eb1c5bd89b3 - Base:
main, merge-baseb5f0ea8349dc28a5fbcd09cb9f07269300945c94 - Diff: 1 file, +41/-12,
.github/workflows/docker-smoke-test.yml - Main already has: an integer
protocolVersionand a strict failure for codex only - Net-new value: an integer version for the other 14 legs, strict reply matching and version checks, fatal
errorreplies, polling instead of a fixed sleep, and cleanup of the attach client
What's Good (🟢)
- Fixes the cause (the request payload) instead of retrying the flaky fallback.
- Makes the check stricter for 13 agents while keeping a fallback only for silent agents.
- The Review Contract and Follow-ups are kept in sync with the code.
5. Three Reasons We Might Not Need This PR
- Silent agents still pass on
--help. For kiro-cli, the most-used image, the ACP check still gates nothing until the no-reply case is understood. - The version change alone fixes the flake. The stricter matching and cleanup protect against regressions no agent shows today.
- The unified workflow is not covered. Until the probe is shared, the two workflows check ACP differently.
What problem does this solve?
smoke-test (Dockerfile.mimocode, ...)failed twice on #1613 even though that PR does not touch the mimocode image (run 44957594380, run 44936871726).The root cause is in the smoke test itself. For every agent except codex, the
initializerequest sends"protocolVersion":"2025-03-26", which is an MCP-style string. ACP v1 requires an integer. In the last green run (44939206202), seven agents rejected the handshake withInvalid params ... expected number, received string: opencode, claude, gemini, kimi, cursor, mimocode, and pi. Each then fell back to<agent> --help. For mimocode, that fallback is intermittently non-zero, so the job flakes. For the other six, the ACP check silently degrades to a--helpcheck.Discord Discussion URL: N/A (maintainer-requested fix from the #1613 review thread)
Review Contract
Goal
Make the docker smoke test send a spec-valid ACP
initializerequest, so that agents that speak ACP pass the handshake instead of falling back to--help. This also removes the mimocode flake.Non-goals
Removing the
--helpfallback for agents that never answer. Agents that return nothing within the timeout keep the existing fallback. A reply that rejectsinitializeis no longer hidden behind it.Accepted Residual Risks
An agent that previously passed only through
--helpmight now return a result withoutprotocolVersion. It would still fall back to--help, which is the same as today. The polling loop can add up to 30 s per job when an agent never answers (today: a fixed 5 s).Acceptance Criteria
smoke-testmatrix leg passes on this PR.ACP handshake okinstead offalling back to CLI check.expected number, received string.Follow-ups
Find out why kiro-cli does not answer
initializewithin 30 s, then consider making the no-response case fatal. Share the probe withdocker-smoke-test-unified.yml, which still usessleep 5andgrep -m1.At a Glance
Prior Art & Industry Research
Not applicable. This is a CI test fix. The ACP schema defines
protocolVersionas an integer (ProtocolVersion, currently1): https://agentclientprotocol.com/protocol/initializationProposed Solution
In
.github/workflows/docker-smoke-test.yml:protocolVersion: 1to every agent; drop the codex-only branch.docker logsonce per second for up to 30 s instead of a fixedsleep 5. Kiro returned no response within 5 s in the last green run.jq -R 'fromjson? | select(...)'): only a JSON-RPC 2.0 response withresultorerrorandid: 1counts (or anerrorwithid: null), so notifications, agent requests, logs, and malformed lines are skipped.jsonrpc == "2.0"andresult.protocolVersion == 1.agentInfois optional in ACP (cursor and grok omit it); the agent name is printed when present.erroror a different version. The--helpfallback applies only when no reply arrives within 30 s.docker attachPID and remove the container and attach client in anEXITtrap.pathsfilter, so changes to the smoke test run the smoke test.Why this approach?
It fixes the request instead of retrying a flaky fallback, and it strengthens the check for seven agents that are silently skipping ACP today.
Alternatives Considered
mimo --helpor bump the mimocode pin: this hides the symptom and leaves the other six agents on the weaker check.initializeoffline. This is left as a follow-up once results are visible.Validation
bash -non the extracted step script with matrix placeholders substituted.jqmatching and assertion checked against sample output: notifications, malformed lines, andid: 2are skipped;protocolVersion2,"1", and a JSON-RPCerrorare rejected.docker: anerrorreply exits 1, a valid reply passes, and no attach process is left running.