openai / openai/codex

support per-thread `model_auto_compact_token_limit_scope` in Codex App

Open
#46,456 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app config context enhancement session
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

Powered by Codex & OWL Version 26.915.31029 Released Sep 18, 2026

What feature would you like to see?

support per-thread model_auto_compact_token_limit_scope in Codex App

I use Codex App for long-running multi-thread workflows where different threads have different responsibilities but collaborate on the same codebase.
A representative setup is:

  • Thread A — Research worker: long-running research, spawning many subagents and continuously persisting research evidence/results into the codebase.
  • Thread B — Supervisor: periodically monitors Thread A, resolves lightweight blockers, and escalates unresolved structural blockers.
  • Thread C — Escalation / MASTER: invoked for heavyweight blockers that Thread B cannot resolve, potentially using multiple agents to investigate, modify, validate, and unblock Thread A.
    All three threads share the same codebase as persistent state/SSOT, but their conversation-context lifecycles are different.
    For example, a research thread may benefit from:
model_auto_compact_token_limit_scope = "body_after_prefix"

because preserving a substantial amount of newly accumulated research context after the previous compaction can be useful.
A monitoring/supervisor thread may instead benefit from:

model_auto_compact_token_limit_scope = "total"

because much of its historical context consists of transient operational state that can be compacted more aggressively.
My current global configuration is:

model_context_window = 1000000
model_auto_compact_token_limit = 500000
model_auto_compact_token_limit_scope = "total"

With such a large context window and a codebase-backed SSOT, using total globally is currently a reasonable default. Therefore, per-thread scope is not a hard dependency for this workflow.
However, it would still be useful as a per-thread tuning capability when a specific long-running research thread demonstrates that repeated compaction is occurring too soon after a carried compacted prefix.
The important distinction is that model_auto_compact_token_limit_scope controls a different policy from merely selecting a larger or smaller context window:

total:
    carried prefix + new body >= threshold
    → compact
body_after_prefix:
    new body >= threshold
    → compact

Therefore, a per-thread context-window profile alone does not necessarily solve this use case unless the profile can also control the auto-compaction scope.
Related issue:

  • #40429 — per-thread context-window profile selector
    That proposal appears to provide the correct per-thread configuration layer, but it does not currently specify whether model_auto_compact_token_limit_scope can be overridden per thread.
    A useful extension would be:
Global / project default
        ↓
Thread-specific context override
        ├── model_auto_compact_token_limit
        └── model_auto_compact_token_limit_scope
              ├── total
              └── body_after_prefix

The selected values should stay with the thread/session and be editable (and configured through the prompts) in Codex App, without needing separate CLI --profile sessions.
This would allow long-running research, supervision, debugging, and escalation threads within the same project to use context-management policies appropriate to their actual information lifecycle, while keeping total as the conservative global default.

Additional information

With such a large context window and a codebase-backed SSOT, using total globally is currently a reasonable default. Therefore, per-thread scope is not a hard dependency for this workflow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start with related issue #40429 and the global configuration examples in this report, then trace the Codex App thread/session configuration path. Done means a thread can select, persist, and edit its own model_auto_compact_token_limit_scope without changing the global default.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.