Skip to content

fix(invoke): default Accept to text/event-stream for non-MCP runtimes - #2193

Merged
aidandaly24 merged 1 commit into
aws:refactorfrom
Hweinstock:fix/invoke-default-headers
Sep 3, 2026
Merged

fix(invoke): default Accept to text/event-stream for non-MCP runtimes#2193
aidandaly24 merged 1 commit into
aws:refactorfrom
Hweinstock:fix/invoke-default-headers

Conversation

@Hweinstock

@Hweinstock Hweinstock commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Problem.

On the refactor branch, the CLI invoke path doesn't send the headers the TS runtime requires, so invoking a TS agent 415/406s unless the user manually passes --accept text/event-stream (and JSON content-type).

This is due to an explicit check in the TS requiring these headers, whereas the same is not true in python.

Solution

  • agentcore invoke / project invoke runtime default Content-Type: application/json and Accept: text/event-stream on the HTTP/A2A streaming path, chosen per protocol (MCP uses its own
    negotiation), and overridable by explicit flags.

Verification.

Reproduce the bug with the current version on refactor:

$ agentcore runtime invoke --id testTS_agent_typescript_strands-kGTWAh9ySn --payload '{ "prompt": "hello" }'
Error: Received error (406) from runtime. Please check your CloudWatch logs for more information.
[rebuild with latest changes]
$ agentcore runtime invoke --id testTS_agent_typescript_strands-kGTWAh9ySn --payload '{ "prompt": "hello" }'
data: "Hello"

data: "! How can I help you today?\n"

status=200 content-type=text/event-stream runtime-session-id=ba742184-ae2d-44df-b51d-16dee7b6a61d mcp-session-id=- mcp-protocol-version=- trace-id=- trace-parent=- trace-state=- baggage=- complete=true bytes=54

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

Small, well-scoped fix. Defaulting Accept to text/event-stream for non-MCP runtimes matches what the CLI already sends from its dev-mode invocation paths (invoke.ts, invoke-a2a.ts, invoke-agui.ts, web-ui/handlers/invocations.ts), so the deployed-runtime invoke path is now consistent with local dev. classifyRuntimeResponse still handles non-streaming JSON responses correctly, so runtimes that ignore the Accept header aren't broken.

Tests cover both branches (HTTP/A2A defaults, and explicit override), no excessive mocking, and no telemetry concerns for a bugfix of this shape. LGTM to merge.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.15%. Comparing base (dffe6e5) to head (cf2a82b).

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2193   +/-   ##
=========================================
  Coverage     97.15%   97.15%           
=========================================
  Files           542      542           
  Lines         37728    37728           
=========================================
  Hits          36653    36653           
  Misses         1075     1075           

☔ 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.

@Hweinstock
Hweinstock marked this pull request as ready for review September 3, 2026 19:54
@github-actions github-actions Bot added size/s PR size: S and removed size/s PR size: S labels Sep 3, 2026
@aidandaly24
aidandaly24 merged commit 3cb1f1a into aws:refactor Sep 3, 2026
25 of 30 checks passed
@Hweinstock
Hweinstock deleted the fix/invoke-default-headers branch September 3, 2026 20:38
This was referenced Sep 3, 2026
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.

4 participants