Skip to content

fix(a2a): honor PORT when serving locally - #593

Merged
jariy17 merged 5 commits into
mainfrom
fix/a2a-dev-port
Jul 24, 2026
Merged

fix(a2a): honor PORT when serving locally#593
jariy17 merged 5 commits into
mainfrom
fix/a2a-dev-port

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

  • Resolve serve_a2a's port from the explicit argument, then PORT, then the existing 9000 default.
  • Preserve explicit port= precedence for backwards compatibility.
  • Document the environment fallback and cover default, environment, and explicit-port behavior.

This is stacked on #591 because the current main branch does not yet contain the A2A SDK v1 serve_a2a implementation. It enables the CLI to assign distinct ports to multiple local CodeZip A2A runtimes.

Testing

  • pytest tests/bedrock_agentcore/runtime/test_a2a.py -q (28 passed)
  • ruff check and ruff format --check on changed Python files
  • Full suite: 2,795 passed, 10 skipped, 4 xpassed; the sole sandbox-blocked localhost integration test passed separately with socket access

@notgitika
notgitika changed the base branch from fix/a2a-sdk-v1 to main July 23, 2026 20:42
@notgitika
notgitika requested a review from a team July 23, 2026 20:42

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty good, just some edge cases to solve for

Comment thread src/bedrock_agentcore/runtime/a2a.py Outdated
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

⚠️ Breaking Change Warning

Found 1 potential breaking change(s) in this PR:

�[1msrc/bedrock_agentcore/runtime/a2a.py�[0m:338: serve_a2a(�[34mport�[39m): �[33mParameter default was changed�[39m: 9000 -> None


Note: This is an automated static analysis check. Some flagged changes may be intentional.
Please confirm each item is expected and, if so, add a migration note to CHANGELOG.md.

@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 24, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 24, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 24, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 24, 2026
@notgitika
notgitika requested a review from jariy17 July 24, 2026 19:16
# Conflicts:
#	pyproject.toml
#	src/bedrock_agentcore/runtime/a2a.py
#	tests/bedrock_agentcore/runtime/test_a2a.py
#	tests/integration/runtime/test_a2a_integration.py
#	uv.lock
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 24, 2026
@jariy17
jariy17 merged commit 331f441 into main Jul 24, 2026
38 of 40 checks passed
jariy17 added a commit that referenced this pull request Aug 4, 2026
serve_a2a() resolved its port from the generic PORT environment variable
(#593), but the AgentCore Runtime A2A service contract fixes the container
port at 9000 (HTTP is 8080, MCP is 8000). PORT is a widespread convention
and is commonly already set to another protocol's port -- notably in an
image shared across an HTTP and an A2A runtime, where PORT=8080 is correct
for HTTP and fatal for A2A.

When PORT was set to anything other than 9000, the A2A server bound there
instead. Nothing listened on 9000, the runtime frontend's proxied
connection was never answered, and every invocation failed with HTTP 424
(RuntimeClientError) after a client-side read timeout. The container
started cleanly and logged no error, since the process was healthy and
merely listening on the wrong port.

Read the protocol-scoped A2A_PORT instead, which cannot collide with
another protocol's port, and warn when the resolved port is not 9000 --
that configuration cannot work in a deployed runtime, so the previous
silence was the expensive part of this failure.

Precedence is unchanged for explicit callers: port= argument, then
A2A_PORT, then 9000.

Co-authored-by: jariy17 <tjariy+jariy17@users.noreply.github.com>
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.

2 participants