Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

responses: a request's max_output_tokens is named in metadata.ignored_fields (#481)

Rudy Mizrahi Celeklia8323dab1686
diff --git a/docs/support-matrix-notes.md b/docs/support-matrix-notes.md
index 45958916..dbeefa4d 100644
--- a/docs/support-matrix-notes.md
+++ b/docs/support-matrix-notes.md
@@ -6,6 +6,14 @@ The tables in [support-matrix.md](support-matrix.md) were produced by `scripts/s
The run started on v0.13.5 and finished on v0.13.13. Every release between them came out of a finding below and was deployed on the instance behind a live-turn gate before the next column: 0.13.5 (local blob store lists by prefix), 0.13.6 (read caches, the word "refused" is not a key refusal), 0.13.7 (a Codex history kept whole under the same account, finished turns release their process handle), 0.13.8 (a Google key can be saved, qwen drops gpt-5.3-codex, a task reopened by URL keeps its model, the broker resends a Google request without the refused field, a self-hosted sandbox reaches the broker on loopback), 0.13.9 (opencode's base carries /v1), 0.13.10 (the relay's base carries its API version), 0.13.11 (the claude CLI strips it), 0.13.12 (a checkpoint that cannot be restored aborts the turn), 0.13.13 (owner trust normalises an Azure base like the broker).
+## `max_output_tokens` is reported, not applied (2026-10-18, #470)
+
+A request's `max_output_tokens` is accepted and named in `metadata.ignored_fields`; no base receives
+it. That is a decision, not a gap (GOVERNANCE, "A declined field is not a pending one"): a UHP turn
+is many model calls, and a cap on each call's output changes what an agent can do, since it can cut
+a tool call off in the middle of its arguments. A turn's budgets here are `max_step` and
+`timeout_seconds`.
+
## hermes and Codex on Azure name the model that served them (2026-10-15)
The open item from 0.33.0-rc.15: hermes switching into gpt-5.5 on Azure finished with no served
diff --git a/gateway/app.py b/gateway/app.py
index f35caf67..2d25992a 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -9290,6 +9290,20 @@ class CreateResponseBody(BaseModel):
reasoning: dict | None = None # {"effort": level}: how much the model thinks this turn (the Responses API's field)
+# Request fields the gateway accepts and does not act on, so a request that carries one is told so in
+# `metadata.ignored_fields` (tasks.md 1.1: ignoring MUST be observable). `tools` and `include` are
+# reserved (tasks.md 1.4). `max_output_tokens` reaches no base: it is kept for the idempotency hash
+# only, and no runner build passes an output-token bound to a harness (#470). A field leaves this
+# list in the change that makes a base apply it.
+_UNAPPLIED_REQUEST_FIELDS = ("tools", "include", "max_output_tokens")
+
+
+def _ignored_request_fields(body: "CreateResponseBody") -> list[str]:
+ """The fields of this request the gateway will not act on, in a stable order; `None` means the
+ client did not send the field, so it is not named."""
+ return [f for f in _UNAPPLIED_REQUEST_FIELDS if getattr(body, f, None) is not None]
+
+
_IDEM_TERMINAL = {"completed", "failed", "incomplete", "cancelled", "error"}
@@ -9579,7 +9593,7 @@ async def create_response(body: CreateResponseBody, request: Request):
# remember this turn's response id on the trace + session so a loaded session can resume
_session_trace.setdefault(sid, {}).update(last_response_id=resp_id)
# Reserved fields, named on the response rather than dropped in silence (tasks.md 1.4).
- _ignored = [f for f in ("tools", "include") if getattr(body, f, None) is not None]
+ _ignored = _ignored_request_fields(body)
tr = _RespTranslator(resp_id, model_req or body.model or backend, body.previous_response_id, body.store, created_at, sid=sid, ignored=_ignored)
tr.environment = str((environment or {}).get("id") or "")
if effort: # what the turn asked of the model's thinking; "applied" arrives with the result
diff --git a/gateway/tests/test_ignored_fields.py b/gateway/tests/test_ignored_fields.py
index 81beb726..7e295511 100644
--- a/gateway/tests/test_ignored_fields.py
+++ b/gateway/tests/test_ignored_fields.py
@@ -57,10 +57,41 @@ def test_the_response_still_validates_against_the_spec():
def test_the_selection_matches_what_the_request_carried():
- """Mirrors the expression in the /v1/responses path: a field is ignored when it is present,
- and `None` means the client did not send it."""
+ """The selection the /v1/responses path uses: a field is ignored when it is present, and `None`
+ means the client did not send it."""
+ from app import _ignored_request_fields
+
class Body:
tools = [{"type": "function", "name": "x"}]
include = None
- assert [f for f in ("tools", "include") if getattr(Body, f, None) is not None] == ["tools"]
+ assert _ignored_request_fields(Body) == ["tools"]
+
+
+def test_max_output_tokens_is_named_because_no_base_applies_it():
+ """#470: `max_output_tokens` is accepted and stored, but no runner build passes an output-token
+ bound to a harness, so a request carrying it completed unbounded with nothing said. Until a base
+ applies it, the response names it."""
+ from app import CreateResponseBody, _ignored_request_fields
+ assert _ignored_request_fields(CreateResponseBody(input="hi", max_output_tokens=64)) == ["max_output_tokens"]
+ # a zero is still a value the client sent
+ assert _ignored_request_fields(CreateResponseBody(input="hi", max_output_tokens=0)) == ["max_output_tokens"]
+
+
+def test_the_request_path_names_what_was_sent_and_nothing_else():
+ from app import CreateResponseBody, _ignored_request_fields
+ assert _ignored_request_fields(CreateResponseBody(input="hi")) == []
+ both = CreateResponseBody(input="hi", tools=[{"type": "function", "name": "x"}], include=["a"],
+ max_output_tokens=16)
+ assert _ignored_request_fields(both) == ["tools", "include", "max_output_tokens"]
+ meta = _translator(ignored=_ignored_request_fields(both))._response_obj("completed")["metadata"]
+ assert meta["ignored_fields"] == ["tools", "include", "max_output_tokens"]
+
+
+def test_the_request_path_reads_the_shared_selection():
+ """The /v1/responses path computes `ignored` through `_ignored_request_fields`, so a field added
+ to or removed from the list is what a response actually reports."""
+ import inspect
+ import app
+ src = inspect.getsource(app.create_response)
+ assert "_ignored = _ignored_request_fields(body)" in src