fix(sdk/go): claude prompt via stdin; note endpoint /api/v1 prefix#746
Closed
AbirAbbas wants to merge 3 commits into
Closed
fix(sdk/go): claude prompt via stdin; note endpoint /api/v1 prefix#746AbirAbbas wants to merge 3 commits into
AbirAbbas wants to merge 3 commits into
Conversation
The claude provider appended the prompt as a trailing positional after
repeated --allowedTools flags; claude CLI 2.1.x treats --allowedTools
as variadic and swallows the positional, so every tool-passing call
exited 1 with 'Input must be provided'. The prompt now flows through
stdin (RunCLIWithStdin), which --print reads natively; codex/opencode/
gemini were inspected and are unaffected. Verified against the real
CLI via a gated integration test.
Note() posted to {base}/executions/note without the /api/v1 prefix,
404ing on the control plane (route registered under the /api/v1 group)
and silently dropping every progress note; existing tests masked it by
baking /api/v1 into the base URL, contrary to the SDK-wide bare-base
contract.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Performance
✓ No regressions detected |
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
Agent.Call was a synchronous POST /execute/{target} bounded by the
15s CallTimeout http.Client default, killing any caller whose child
reasoner worked longer. It now mirrors the Python SDK: submit via
/execute/async/{target}, then poll the execution record with
Python-parity pacing (0.25s doubling to 4s, jittered), CallTimeout
bounding each request rather than the overall wait, ctx-cancellable,
lineage headers on submit and polls so DAG parentage is unchanged.
The claude provider now uses --output-format stream-json --verbose:
per-event output keeps the CLI idle watchdog fed during long silent
turns (plain json emitted nothing until completion, so >120s turns
were SIGKILLed), and the terminal result event carries the same
fields including total_cost_usd. Real 2.1.191 capture committed as a
fixture; ctx cancellation now kills the whole CLI process group.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lt-runner fallback Adds tests closing the patch-coverage gap on PR #746's async-submit Agent.Call rewrite and the claudecode stdin/stream-json changes. agent_call_coverage_test.go (package agent) exercises the error/edge branches of Call's submit + poll loop that the happy-path tests miss: - nextCallPollInterval clamps (below floor / above ceiling) - submitAsyncExecution: build-request, transport, read-body, structured 4xx, and JSON-decode errors - awaitExecutionResult: ctx-already-cancelled, GET build error, ctx-cancel-during-poll, transport error, read-body error, poll HTTP-error status, poll decode error, succeeded-result decode error, and succeeded-null-result claudecode_defaultrunner_test.go covers the runCLI == nil fallback in ClaudeCodeProvider.Execute via a struct-literal provider (bypassing NewClaudeCodeProvider) driving the real default runner. Lifts sdk-go patch coverage from 61% to 98% (agent.go 98.29%, claudecode.go 100%), clearing the 80% min_patch gate. Tests only; no production code changed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Jul 10, 2026
…lt-runner fallback Adds tests closing the patch-coverage gap on PR #746's async-submit Agent.Call rewrite and the claudecode stdin/stream-json changes. agent_call_coverage_test.go (package agent) exercises the error/edge branches of Call's submit + poll loop that the happy-path tests miss: - nextCallPollInterval clamps (below floor / above ceiling) - submitAsyncExecution: build-request, transport, read-body, structured 4xx, and JSON-decode errors - awaitExecutionResult: ctx-already-cancelled, GET build error, ctx-cancel-during-poll, transport error, read-body error, poll HTTP-error status, poll decode error, succeeded-result decode error, and succeeded-null-result claudecode_defaultrunner_test.go covers the runCLI == nil fallback in ClaudeCodeProvider.Execute via a struct-literal provider (bypassing NewClaudeCodeProvider) driving the real default runner. Lifts sdk-go patch coverage from 61% to 98% (agent.go 98.29%, claudecode.go 100%), clearing the 80% min_patch gate. Tests only; no production code changed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 5b763d8)
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs found by live E2E testing of the SWE-AF Go port against a real control plane:
--allowedToolsflags; claude CLI 2.1.x treats--allowedToolsas variadic and consumes the positional, so every tool-passing call failed withInput must be provided either through stdin or as a prompt argument when using --print. The prompt now flows via stdin (RunCLIWithStdin), which--printreads natively. codex/opencode/gemini were audited: their arg constructions have no variadic-before-positional hazard. Verified against the real CLI via a build-tagged integration test (AGENTFIELD_CLAUDE_BIN-gated) — exit 0 with real structured output on the exact tools+stdin path.Note()404. Posted to{base}/executions/notewithout the/api/v1prefix (route is registered under the/api/v1group inroutes_core.go:150), silently dropping every agent progress note. Existing tests masked it by baking/api/v1into the base URL contrary to the SDK-wide bare-base contract; tests corrected to the real contract.Test plan
go mod tidyno diff;go build ./...;go vet ./...(incl.-tags integration)go test ./...— all packages green/api/v1/executions/notefrom a bare base🤖 Generated with Claude Code