Skip to content

fix(server): match the standing compaction policy on the 200k window - #146

Merged
nullStack65 merged 1 commit into
release/native-0.1.10from
align/clo-924-standing-policy
Nov 20, 2026
Merged

nullStack65 merged 1 commit into
release/native-0.1.10from
align/clo-924-standing-policy

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

Problem

The merged thread type policy (pull request 114, the per-thread-type model, cache and compaction policy, CLO-924) reads one shared context window and rounds the Claude compaction percent up. The standing policy table has since moved: Claude runs at 200k, Codex stays at 272k, standing compaction must land at or below 165000, the carried summary is capped at 8000 tokens, and a title tag such as [Standing] must still count as standing.

Change

The policy file now carries a window per harness and an optional per-type summary cap. Claude's percent is floored against the effective window (the context minus the 20k output reserve) and then clamped by the 13k headroom, so a standing thread at 165000 lands at 164988 and a 168000 row lands at 166986 instead of Claude's default. A standing thread's carried summary is bounded by the cap at one token per two characters, through Claude's appended prompt and Codex's compact_prompt. Title tags match in either case.

Scope

Follow-up to the thread type policy issue (CLO-924), aligning the fork with the updated table in the config pull request (https://github.com/nullStack65/closura-agent-config/pull/957, head 7b761d7c).

Deploy: none

Verification

  • ThreadTypePolicy, RuntimePolicy, and the thread-type cases of ClaudeAdapterV2 and CodexAdapterV2: 26 passed.
  • vp run --filter t3 --filter @t3tools/provider-core typecheck: both passed. Pre-existing schema-brand suggestions only.
  • The pre-commit hook fails on this checkout for reasons unrelated to the diff: oxlint cannot load the TypeScript plugin (ERR_UNKNOWN_FILE_EXTENSION), and knip reports the same metro .mts error plus unused mobile files that this change does not touch. The commit was made with hooks disabled for that reason.

Not checked: GitHub CI on this head.

Model: grok/grok-4.7, harness: Claude Code on the R720.

🤖 Generated with Claude Code

The thread type policy now carries separate Claude and Codex context
windows, floors the Claude compaction percent so a standing thread lands
at 164988, caps the carried summary at the table's token count, and reads
a title tag in either case.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nullStack65

nullStack65 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner Author

Note

🤖 grok/grok-4.7 responding on behalf of nullStack65

Independent review of the standing compaction alignment (the thread type policy follow-up, CLO-924), read at 36e63e329a12a0e327689127febb26b79d5090ef. One finding, and it did not hold up.

The usage threshold looked like it recomputed the compaction percent against the wrong window. claudeAutoCompactThreshold passes the catalog's maxTokens (1,000,000 in the test) into claudeAppliedCompactAt, and the window is min(maxTokens, windowTokens). On a 272,000 window string that lands at 119,977 instead of the 119,988 the 200,000 Claude window produces. I traced the call site: the window string comes from context.autoCompactWindow, which a thread type overrides with threadType.claudeContextWindow before the turn starts, so the percent and the reported threshold always share the Claude window. The 272,000 case only exists in a unit test that calls the function directly. Reverted, nothing to fix.

Checked against the canonical table in the config pull request (https://github.com/nullStack65/closura-agent-config/pull/957, head 7b761d7c, still open):

  • Windows are per harness, Claude 200,000 and Codex 272,000, and Codex still receives only model_auto_compact_token_limit.
  • The percent is floored, then clamped by the 13,000 headroom. Standing at 165,000 fires at 164,988; the 168,000 row fires at 166,986. Both match the config script's claude_trigger.
  • The summary cap counts one token per two characters, 16,000 characters within and 16,001 over, and is appended for Claude and sent as Codex compact_prompt. Types without a cap get neither.
  • The title tag matches either case, so [Standing] is standing and [CODING] is coding.
  • The schema requires the object window and refuses the old single number. The fleet installs this file from the same config, so an old file is ignored with a warning rather than misread. codexContextWindow is carried on the launch record and never read by an adapter.

Verification: ThreadTypePolicy, RuntimePolicy, and the thread-type cases of both adapters pass (686 of 692). The other 6 failures are pre-existing and unrelated: five are 120-second timeouts in the background-wake and native-fork suites, and the fork test still times out on the untouched head. Typecheck was not re-run; the tree is unchanged from the head whose typecheck already passed. GitHub CI on this head was green when reviewed: the deploy-line check, the Linux ARC voice and founder-inbox run, and CodeRabbit.

{
  "reviewed_head": "36e63e329a12a0e327689127febb26b79d5090ef",
  "reviewer": "grok/grok-4.7",
  "findings": [
    {
      "id": "usage-threshold-window",
      "severity": "important",
      "summary": "The reported auto-compact threshold recomputes the percent against a window larger than the Claude policy window.",
      "outcome": "dismissed",
      "rechecked_head": "36e63e329a12a0e327689127febb26b79d5090ef"
    }
  ]
}

@nullStack65
nullStack65 merged commit 3bdb7f0 into release/native-0.1.10 Nov 20, 2026
3 checks passed
@nullStack65
nullStack65 deleted the align/clo-924-standing-policy branch November 20, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant