Files
magpie/internal
yetone 848269fcff gateway: a reply limit filled in stays within the window; OpenRouter's "maximum context length" refusal is read (H1_B1_K1 on X)
Codex through an OpenRouter DeepSeek model (window 1048576, catalog output
943718) failed every long turn. Checked against the code, the report's
four claims hold: the catalog gives that output; magpie translates the
Responses turn to Chat Completions; Codex names no max_output_tokens and
the translation fills in askedOutput (fillsOutput); and replyLeft, which
asks again for what the window has left, read only DeepSeek/vLLM/Anthropic
wording, not OpenRouter's "(N of text input, M of tool input, K in the
output)".

- replyLeft reads OpenRouter's message (every "N of <kind> input" is
  the prompt).
- The filled-in limit (translated turns, and withOwnOutput for DeepSeek's
  own API) is lowered to window minus the prompt estimated from its size,
  when that leaves at least 8192; otherwise as before. Anthropic's fill is
  unchanged: its refusal wording was already read.

Run (mote, at this head): gofmt clean; go vet darwin, linux nogui, windows
for internal/gateway; go test ./internal/gateway ok. New tests
TestReplyLeftOpenRouter and TestOpenRouterReplyFitsTheWindow use the
report's literal message. Broken by hand: with the regex changed both
fail (replyLeft 0, HTTP 400 with the report's text); with roomedOutput
returning n unchanged the second test fails (asked [943718]).
Not tried: a real OpenRouter account; the full suite (started after tag).
2026-11-12 09:36:33 +08:00
..
…
…
…
…
…
2026-11-11 08:14:28 +08:00
…
…
…
…
…