Skip to content

fix(dev): honor custom ports for MCP and A2A - #2620

Merged
notgitika merged 2 commits into
aws:refactorfrom
notgitika:fix/e2e-non-http-dev-ports
Oct 19, 2026
Merged

notgitika merged 2 commits into
aws:refactorfrom
notgitika:fix/e2e-non-http-dev-ports

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

  • export A2A_PORT from agentcore dev for A2A CodeZip runtimes
  • make the generated FastMCP template explicitly read FASTMCP_PORT
  • document and test the local custom-port contract for both protocols

Context

This follows up on #2619 and the failures in run
https://github.com/aws/agentcore-cli/actions/runs/39305293613.

The Python 3.14 pin from #2619 is active and fixed the Python 3.15 dependency
failures. The remaining deterministic failures came from the distinct ports
introduced for the template E2Es:

  • MCP still listened on FastMCP's default port 8000
  • A2A still listened on serve_a2a's default port 9000
  • agentcore dev waited on the requested 1808x ports and timed out

The TypeScript template failures in that run were a separate transient npm
publication-propagation error for
@aws-sdk/credential-provider-http@3.972.77; the tarball is now available.

Testing

  • bun test
  • bun run typecheck
  • bun run lint:check
  • bun run format:check
  • bun run build

@github-actions github-actions Bot added the size/s PR size: S label Oct 19, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress labels Oct 19, 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 Oct 19, 2026

@agentcore-devx-automation agentcore-devx-automation Bot 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.

AgentCore Harness Review

Verdict: Looks good

The core change is correct: commandForRuntime now mirrors the existing FASTMCP_PORT behavior for A2A, the template reads FASTMCP_PORT with a safe 8000 default, and the serve_a2a docs claim checks out — bedrock_agentcore.runtime.a2a.serve_a2a does fall back to int(os.environ.get("A2A_PORT", A2A_CONTRACT_PORT)) when port isn't passed. Test coverage via the parametrized MCP/A2A/AGUI case is a nice touch. The container runner correctly doesn't need the same treatment because the container always listens on the contract port internally and port‑remaps at the Docker boundary.

A couple of small consistency gaps you may want to clean up in this PR (not blocking — runtime behavior is still correct because the explicit assignment in codezip.ts wins over any user-provided value):

  • src/handlers/project/dev/environment.ts:5 — RESERVED_ENV_KEYS lists FASTMCP_PORT but not A2A_PORT. For symmetry, consider adding A2A_PORT so user .env.local entries are filtered the same way.
  • src/assets/templates/shared/env.local.template:3 — the comment mentions FASTMCP_PORT as CLI-owned but not A2A_PORT. Worth a one-word addition so A2A users understand the same rule applies.

No telemetry concerns (this is a wiring fix, not a new feature) and no excessive-mocking concerns in the added tests.

@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Oct 19, 2026
@github-actions github-actions Bot added size/s PR size: S and removed size/s PR size: S labels Oct 19, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Oct 19, 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 Oct 19, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.61%. Comparing base (9e9de05) to head (9f3d6af).

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2620   +/-   ##
=========================================
  Coverage     96.61%   96.61%           
=========================================
  Files           702      702           
  Lines         58344    58347    +3     
=========================================
+ Hits          56369    56373    +4     
+ Misses         1975     1974    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@notgitika
notgitika merged commit ea4fe99 into aws:refactor Oct 19, 2026
18 checks passed
@notgitika
notgitika deleted the fix/e2e-non-http-dev-ports branch October 19, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants