From e47f804030fe56829ee51c7ad7f1fcdfe58eb3b7 Mon Sep 17 00:00:00 2001 From: chaodufashi Date: Wed, 15 Apr 2026 01:11:28 +0000 Subject: [PATCH 1/2] fix(ci): handle non-JSON output in ACP handshake smoke test 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 --- .github/workflows/docker-smoke-test.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-smoke-test.yml b/.github/workflows/docker-smoke-test.yml index 3b131a7d..4f2edfca 100644 --- a/.github/workflows/docker-smoke-test.yml +++ b/.github/workflows/docker-smoke-test.yml @@ -41,14 +41,20 @@ jobs: run: | INIT='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"ci-test","version":"0.0.1"}}}' - RESPONSE=$(echo "$INIT" | timeout 30 docker run --rm -i \ + # Capture all output; agents may emit non-JSON lines (warnings, logs) + 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 | head -1) + ${{ matrix.variant.agent_args }} 2>/dev/null || true) + echo "Raw output:" + echo "$RAW" + + # Extract the first valid JSON-RPC response line + RESPONSE=$(echo "$RAW" | grep -m1 '^{' || true) echo "Response: $RESPONSE" - if ! echo "$RESPONSE" | jq -e '.result.agentInfo.name' > /dev/null 2>&1; then + if [ -z "$RESPONSE" ] || ! echo "$RESPONSE" | jq -e '.result.agentInfo.name' > /dev/null 2>&1; then echo "❌ ACP initialize failed — no agentInfo in response" exit 1 fi From 0d6b03753c79e36ea3050bf538dedcb4c10140ae Mon Sep 17 00:00:00 2001 From: chaodufashi Date: Wed, 15 Apr 2026 01:13:13 +0000 Subject: [PATCH 2/2] fix(ci): use fallback approach for ACP handshake in smoke test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/docker-smoke-test.yml | 19 +++++++++---------- Dockerfile.gemini | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-smoke-test.yml b/.github/workflows/docker-smoke-test.yml index 4f2edfca..4045c8b5 100644 --- a/.github/workflows/docker-smoke-test.yml +++ b/.github/workflows/docker-smoke-test.yml @@ -37,11 +37,10 @@ jobs: - name: Verify agent CLI exists run: docker run --rm --entrypoint which openab-test${{ matrix.variant.suffix }} ${{ matrix.variant.agent }} - - name: ACP initialize handshake + - 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"}}}' - # Capture all output; agents may emit non-JSON lines (warnings, logs) RAW=$(echo "$INIT" | timeout 30 docker run --rm -i \ --entrypoint ${{ matrix.variant.agent }} \ openab-test${{ matrix.variant.suffix }} \ @@ -50,14 +49,14 @@ jobs: echo "Raw output:" echo "$RAW" - # Extract the first valid JSON-RPC response line RESPONSE=$(echo "$RAW" | grep -m1 '^{' || true) - echo "Response: $RESPONSE" - if [ -z "$RESPONSE" ] || ! echo "$RESPONSE" | jq -e '.result.agentInfo.name' > /dev/null 2>&1; then - echo "❌ ACP initialize failed — no agentInfo in response" - exit 1 + 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)" fi - - AGENT_NAME=$(echo "$RESPONSE" | jq -r '.result.agentInfo.name') - echo "✅ ACP handshake ok — agent=$AGENT_NAME" diff --git a/Dockerfile.gemini b/Dockerfile.gemini index 863a7ba1..fea30ab9 100644 --- a/Dockerfile.gemini +++ b/Dockerfile.gemini @@ -32,3 +32,4 @@ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ CMD pgrep -x openab || exit 1 ENTRYPOINT ["openab"] CMD ["run", "/etc/openab/config.toml"] +