Skip to content

fix: honor --timeout on card resolution and document wait/polling flags - #94

Open
patil-prajwal wants to merge 4 commits into
a2aproject:mainfrom
patil-prajwal:fix-card-timeout-and-docs
Open

patil-prajwal wants to merge 4 commits into
a2aproject:mainfrom
patil-prajwal:fix-card-timeout-and-docs

Conversation

@patil-prajwal

@patil-prajwal patil-prajwal commented Oct 17, 2026 •

Copy link
Copy Markdown

Description

This PR resolves two related gaps in timeout and wait handling:

  1. Card Resolution Timeout & Error Classification:

    • compatCardResolver previously used a fixed package-level &http.Client{Timeout: 30 * time.Second}. This ignored --timeout settings greater than 30s (e.g. --timeout 60s) and bypassed cfg.httpTransport. It now uses an http.Client bounded by the context deadline and cfg.httpTransport.
    • clierr.CardResolution previously classified card resolution timeouts as A2ACLI_ERR_CARD_INVALID (exit 4) or A2ACLI_ERR_IO (exit 3). It now checks errors.Is(err, context.DeadlineExceeded) and correctly reports A2ACLI_ERR_TIMEOUT (exit 5).
    • Added unit and integration tests verifying timeout exit code 5 and deadline propagation on card resolution HTTP requests.
  2. Documentation of Waiting & Timeout Flags:

    • Added --wait, --poll-interval, and --timeout to the key flags table in skills/a2a-cli/SKILL.md and agent-plugin/skills/a2a-cli/SKILL.md.
    • Added task polling examples using --wait to skills/a2a-cli/SKILL.md, examples/04-messages-and-tasks/README.md, and root README.md.

Which area does this relate to?

  • CLI code
  • SPEC or COMPLIANCE file
  • Other doc files

Checklist

  • Review the Contributing guide.
  • Make your Pull Request title follow the Conventional Commits specification.
  • Ensure the code is formatted and the linter passes (gofmt -w . and golangci-lint run).
  • Tests pass (go test ./...).
  • Appropriate docs were updated.

Fixes #95

@ConnorMoss02

Copy link
Copy Markdown
Contributor

Tested this and the timeout now exits 5 instead of 3 for card get and task subscribe. One thing though: with the 30s client cap gone, a2a server --proxy has nothing bounding the card fetch, since its context has no --timeout. Against an upstream that takes 60s to serve its card, main gives up at 30s but this branch was still hanging at 45s. Maybe bound the proxy's newAgentClient call with cfg.timeout?

Small nit: the new timeout hint suggests --async, which card get doesn't have.

@patil-prajwal

Copy link
Copy Markdown
Author

Good catch on both!

  • Bounded newAgentClient in server --proxy with cfg.timeout and added TestServeProxy_Timeout.
  • Cleaned up the timeout hint in CardResolution to "increase --timeout" (removing the --async mention).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: agent card resolution ignores --timeout and fails to classify deadline exceeded error

2 participants