fix(ci): handle non-JSON output in docker smoke test ACP handshake#353
Conversation
Agents like gemini emit non-JSON lines (e.g. 'Ignore file not found')
to stdout before the JSON-RPC response. The previous 'head -1' approach
captured these lines instead of the actual response.
Changes:
- Replace 'head -1' with 'grep -m1 ^{' to extract first JSON line
- Add '|| true' to docker run to prevent timeout exit code from
killing the step before output is captured
- Log raw output for easier debugging of future failures
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
5754871 to
3d81b1f
Compare
Known limitation: kiro-cli ACP handshake in CIThe This is likely because To verify locally (requires Docker): echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"test","version":"0.0.1"}}}' | \
docker run --rm -i --entrypoint kiro-cli openab-test acp --trust-all-tools 2>&1If/when CI secrets are configured for these agents, the |
|
Verified locally with OrbStack + Docker. Here are the ACP handshake results for all 5 variants (no auth configured):
Two findings:
Only claude-agent-acp responds to |
|
Suggestion: instead of - name: Verify agent responds
run: |
INIT='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"ci-test","version":"0.0.1"}}}'
RAW=$(echo "$INIT" | timeout 30 docker run --rm -i \
--entrypoint ${{ matrix.variant.agent }} \
openab-test${{ matrix.variant.suffix }} \
${{ matrix.variant.agent_args }} 2>/dev/null || true)
RESPONSE=$(echo "$RAW" | grep -m1 '^{' || true)
if [ -n "$RESPONSE" ] && echo "$RESPONSE" | jq -e '.result.agentInfo.name' >/dev/null 2>&1; then
AGENT_NAME=$(echo "$RESPONSE" | jq -r '.result.agentInfo.name')
echo "✅ ACP handshake ok — agent=$AGENT_NAME"
else
echo "⚠️ ACP handshake returned no response — falling back to CLI check"
docker run --rm --entrypoint ${{ matrix.variant.agent }} \
openab-test${{ matrix.variant.suffix }} --help >/dev/null 2>&1
echo "✅ Agent CLI responds (ACP skipped — likely needs auth)"
fiThis way:
Also note: copilot also needs |
3d81b1f to
185f713
Compare
|
Adopted your fallback approach — much cleaner than
The only thing is this push won't trigger the smoke test since we reverted the Dockerfile.gemini touch. Need a Dockerfile change in the PR to trigger it, or a maintainer re-run. |
Adopt thepagent's suggestion: instead of continue-on-error + acp_optional,
use a fallback approach so every variant gets a real pass/fail.
- Replace 'head -1' with 'grep -m1 ^{' to skip non-JSON lines
(fixes gemini 'Ignore file not found' issue)
- If ACP handshake succeeds, report agent name
- If ACP handshake fails (no auth in CI), fall back to '--help' check
so the agent CLI is still verified
- Remove acp_optional flag and continue-on-error — all variants now
get a definitive pass/fail
Co-authored-by: thepagent <thepagent@users.noreply.github.com>
185f713 to
0d6b037
Compare
Problem
The ACP initialize handshake step in
docker-smoke-test.ymluseshead -1to capture the agent's response. Some agents emit non-JSON lines to stdout before the JSON-RPC response:Ignore file not found: /home/node/.geminiignorebefore the JSON responsehead -1captures these lines instead of the actual JSON-RPC response, causing the handshake check to always fail for these variants.This has been failing on every PR since the workflow was introduced.
Solution
head -1withgrep -m1 '^{'to extract the first line that looks like JSON|| trueto thedocker runcommand so timeout exit codes don't kill the step before output is capturedNote
This fixes the gemini variant. The kiro-cli variant may still fail if it requires API credentials to respond to ACP initialize — that would need a separate investigation.