Affected surface
Model or provider routing
What did Anvil do?
It seems anvil does not parse the context size of codex::gpt-5.6-luna and other codex models, from the CHATGPT_MODELS_URL response. Anvil then falls back to a default value of 128000, sending the wrong size limit to the ACP client, and summarizing more often than necessary.
What should it have done?
Parse the model's max context and use it. It looks like the endpoint returns model data like:
{
"slug": "gpt-5.6-luna",
"context_window": 272000,
"max_context_window": 872000,
…
}
Those numbers look the same for all gpt-5.6-* models. They don't match the model's documented limit of 1050000 tokens, but the numbers do exist, and Anvil should use them.
Alternately, you could make the magic fallback number configurable.
Reproduction
- have a valid
~/.codex/auth.json (OIDC token)
- Run ACP server:
anvil --default-model=codex::gpt-5.6-luna
- send
/context
- see "Context window: N tokens used (model max unknown)" in the response
Session and environment
Linux, anvil 0.28.4, codex::gpt-5.6-luna.
Transcript, logs, or protocol messages
Model detection snippet:
2026-09-20T19:42:53.386669Z INFO anvil: Codex backend enabled in ChatGPT subscription mode (Responses API on chatgpt.com)
...
2026-09-20T19:42:53.593638Z INFO anvil_client::codex_client: using Codex models manifest client_version for ChatGPT model discovery client_version=0.153.0
2026-09-20T19:42:54.101853Z INFO anvil_client::codex_client: ChatGPT /models returned 5 slugs after filtering: ["gpt-5.5", "gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol", "gpt-6-astra"]
2026-09-20T19:42:54.101919Z INFO anvil: startup discovery: 5 model(s) found
/context:
Session context
- Working directory:
/home/infinoid/dev
- Mode:
LUTZ
- Permission mode:
auto
- Model:
codex::gpt-5.6-luna (5 known in catalog)
- Context window: 84384 tokens used (model max unknown)
- Conversation turns: 11 (~305 user / ~3908 agent / ~80171 tool exchanges)
/setup codex status:
Codex login status:
auth_mode: chatgpt
routing: ChatGPT subscription (Responses API on chatgpt.com)
api_key: n/a (ChatGPT-only account; subscription routing does not need one)
[snip account ids]
ACP usage report with incorrect size:
[2026-09-20T18:28:27.529Z] <<< AGENT → CLIENT [NOTIFICATION] session/update
{
"jsonrpc": "2.0",
"method": "session/update",
"params": {
"sessionId": "0444c834-399a-4835-abb3-86cfea7cd015",
"update": {
"sessionUpdate": "usage_update",
"used": 68350,
"size": 128000,
"cost": {
"amount": 0,
"currency": "USD"
}
}
}
}
Affected surface
Model or provider routing
What did Anvil do?
It seems anvil does not parse the context size of
codex::gpt-5.6-lunaand other codex models, from theCHATGPT_MODELS_URLresponse. Anvil then falls back to a default value of 128000, sending the wrong size limit to the ACP client, and summarizing more often than necessary.What should it have done?
Parse the model's max context and use it. It looks like the endpoint returns model data like:
{ "slug": "gpt-5.6-luna", "context_window": 272000, "max_context_window": 872000, … }Those numbers look the same for all
gpt-5.6-*models. They don't match the model's documented limit of 1050000 tokens, but the numbers do exist, and Anvil should use them.Alternately, you could make the magic fallback number configurable.
Reproduction
~/.codex/auth.json(OIDC token)anvil --default-model=codex::gpt-5.6-luna/contextSession and environment
Linux, anvil 0.28.4, codex::gpt-5.6-luna.
Transcript, logs, or protocol messages
Model detection snippet:
/context:/setup codex status:ACP usage report with incorrect
size: