Repository navigation
Description
What variant of Codex are you using?
Codex multi-agent/subagent configuration, observed with current Codex behavior and checked against the current open-source implementation.
What feature would you like to see?
Please allow an agent role to set its own model_context_window and model_auto_compact_token_limit instead of always inheriting those values from the parent session.
Example use case:
- Primary Astra orchestrator: native/default context window
- Luna worker: 1M requested context window
A role file can currently contain the Luna model, reasoning effort, and context settings. The model and reasoning effort are applied to the spawned child, but the context-window settings remain parent-derived.
Current implementation observation
In codex-rs/core/src/agent/role.rs, the typed role override layer applies fields such as model and reasoning effort, but does not include the context-window or auto-compaction settings. As a result, those values from the role config do not become effective child configuration.
Expected behavior
Agent roles should be able to request their own context window and auto-compaction threshold, subject to the selected model's normal catalog/runtime maximums.
This would allow context allocation to follow task shape and model cost. For example, an orchestrator can stay on its normal context window while a lower-cost implementation or debugging worker uses a larger window.
Related issues
- Add a per-thread context-window profile selector #40429 requests per-thread context profiles; this request specifically concerns spawned agent-role configuration.
- Windows 0.153.4: high usage with V2 workers, Code Mode truncation and effort-change cache misses (local telemetry) #43229 discusses context behavior in mixed-model worker trees; this request asks for a direct role-level setting.
Activity
danghung-dev commentedon Sep 23, 2026
+1 - This would be very useful for real multi-agent workflows.
My main use case is exactly the one described here: keep the orchestrator on its normal/native context window, while allowing a worker model such as Luna to use a much larger context only when the task actually benefits from it.
Without per-role overrides, context sizing is effectively coupled to the parent session, which makes it harder to optimize cost, latency, and task specialization across agents. It also means a role can select its own model and reasoning effort, but not the context policy that is often just as important for that model.
A practical setup would be:
This would make multi-agent configuration much more flexible and avoid having to globally increase the parent context just to give one worker a larger window.
ropepop commentedon Nov 17, 2026
Checked the 0.169.0 source:
AgentRoleOverridesand its construction still omit both context settings, even though the role file is parsed as configuration. This remains a separate gap from choosing model defaults for all children.A useful acceptance case would create two roles from one parent: a bounded worker requesting a 128,000-token window and compaction at 100,000, and an explorer requesting a larger supported window. Each role should receive its own effective limits, without changing the parent or the other role. Explicit role values should take precedence over any future child defaults from #49195, while staying within the selected model's supported limits.
Please also test either key supplied alone, and report unsupported or ineffective role settings clearly rather than accepting them silently. The separate request to change an already-running session's limits is #40429; new-role defaults and live session changes should have clear, separate scope.
These observations come from the versioned source; I have not run a fresh end-to-end reproduction.