fix(invoke): default Accept to text/event-stream for non-MCP runtimes - #22
Closed
Hweinstock wants to merge 1 commit into
Closed
fix(invoke): default Accept to text/event-stream for non-MCP runtimes#22Hweinstock wants to merge 1 commit into
Hweinstock wants to merge 1 commit into
Conversation
Hweinstock
force-pushed
the
fix/invoke-default-headers
branch
from
September 3, 2026 19:33
4cf5429 to
c972c20
Compare
Hweinstock
force-pushed
the
fix/invoke-default-headers
branch
from
September 3, 2026 19:42
c972c20 to
cf2a82b
Compare
Owner
Author
|
Superseded by upstream aws#2193 (merged into refactor). Closing this fork draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the
refactorbranch the CLI invoke path sends noAcceptheader on the HTTP/A2A streaming path, so invoking a TypeScript runtime returns HTTP 406 unless the user manually passes--accept text/event-stream.Content-Typealready defaulted toapplication/json; the gap was the missing SSEAccept.Fix
In
normalizeRuntimeInvokeRequest(src/handlers/runtime/invoke/request.ts) — the single normalizer shared byruntime invoke,project invoke runtime, and the invoke TUI — defaultAccepttotext/event-streamfor non-MCP runtimes. MCP keeps its own negotiation (application/json, text/event-stream), and an explicit--accept/--content-typestill overrides for every protocol.Headers are provider-independent — the normalizer never inspects the model provider, so Bedrock and non-Bedrock TS agents get identical defaults.
Spec
Verification
Compiled binary (
bun run compile:linux-x64) against live TS runtimes in the dev account (us-east-1). Payload{"prompt":"hi"}in every case.1. Fixed binary, no
--accept/--content-typeflags → succeeds (spec step 1 & 4). Two distinct TS agents (container-built):A third managed (NODE_22 / S3) TS agent also returned
status=200 content-type=text/event-stream(the agent then emitted its own app-level error unrelated to headers).2. Baseline (pre-fix, built from
refactor) reproduces the bug, and--acceptis the workaround:3. Explicit override still reaches the wire (spec step 2) — fixed binary forced to a non-SSE Accept 406s instead of using the default:
4. MCP unaffected (spec step 3) — the MCP branch is byte-for-byte unchanged and its negotiation is covered by
normalizeRuntimeInvokeRequestunit tests (no MCP runtime exists in the dev account for a live check).Static checks:
bun test2827 pass / 0 fail ·tsc --noEmitclean ·oxlintclean ·prettier --checkclean ·secretlintclean.How to reproduce the fix
project invoke runtime --name <ts_agent>exercises the identicalnormalizeRuntimeInvokeRequestpath (runtime.tsx:118→invokeRuntimeTarget→ normalizer).