fix(invoke): default Accept to text/event-stream for non-MCP runtimes - #2193
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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 invokeruntime default Content-Type: application/json and Accept: text/event-stream on the HTTP/A2A streaming path, chosen per protocol (MCP uses its ownnegotiation), and overridable by explicit flags.
Verification.
Reproduce the bug with the current version on refactor: