Skip to content

PostCompact uses the 200K fallback for GPT-5.6 models #125

Description

@andms9412-debug

Problem Situation

On current main (bb8764c, Codex marketplace v4.16.3), the OMO rules PostCompact budget treats all current GPT-5.6 variants as unknown models. codex debug models reports a 372,000-token context window for gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna, but the hook applies its 200,000-token fallback and over-truncates recovery context.

Reproduction Logs

From a fresh worktree, add the regression cases in the embedded patch and run:

$ ../../node_modules/.bin/vitest --run --no-file-parallelism test/post-compact-budget.test.ts
Test Files  1 failed (1)
Tests  3 failed | 6 passed (9)
AssertionError: expected 500 to be 12000
- Expected: 12000
+ Received: 500

The same failure occurred for gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna.

Root Cause

MODEL_CONTEXT_BUDGETS in plugins/omo/components/rules/src/post-compact-budget.ts and the bundled dist/cli.js contains GPT-5.5, GPT-5.4-mini, and codex-auto-review, but no GPT-5.6 slugs. Exact/suffix lookup therefore falls through to FALLBACK_CONTEXT_WINDOW_TOKENS = 200_000.

Verified Fix

Add the three catalog slugs with their 372,000-token context window and cover each variant with the existing budget regression test. Unknown models keep the conservative 200,000-token fallback.

diff --git a/plugins/omo/components/rules/dist/cli.js b/plugins/omo/components/rules/dist/cli.js
index beeddaf..3b0137e 100755
--- a/plugins/omo/components/rules/dist/cli.js
+++ b/plugins/omo/components/rules/dist/cli.js
@@ -3854,6 +3854,9 @@ var POST_COMPACT_MIN_RESERVED_TOKENS = 8000;
 var POST_COMPACT_MIN_GUIDE_CHARS = 500;
 var FALLBACK_CONTEXT_WINDOW_TOKENS = 200000;
 var MODEL_CONTEXT_BUDGETS = [
+  { slug: "gpt-5.6-sol", contextWindowTokens: 372000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
+  { slug: "gpt-5.6-terra", contextWindowTokens: 372000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
+  { slug: "gpt-5.6-luna", contextWindowTokens: 372000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
   { slug: "gpt-5.5", contextWindowTokens: 272000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
   { slug: "gpt-5.4-mini", contextWindowTokens: 272000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
   {
diff --git a/plugins/omo/components/rules/src/post-compact-budget.ts b/plugins/omo/components/rules/src/post-compact-budget.ts
index d4b53c2..b18b0ea 100644
--- a/plugins/omo/components/rules/src/post-compact-budget.ts
+++ b/plugins/omo/components/rules/src/post-compact-budget.ts
@@ -1,5 +1,5 @@
-import { hasContextPressureMarker } from "./context-pressure.js";
 import type { PiRulesConfig } from "@oh-my-opencode/rules-engine/engine";
+import { hasContextPressureMarker } from "./context-pressure.js";
 import { readTranscriptSearchText } from "./transcript-search.js";
 
 export interface PostCompactBudgetContext {
@@ -21,6 +21,9 @@ const POST_COMPACT_MIN_RESERVED_TOKENS = 8_000;
 const POST_COMPACT_MIN_GUIDE_CHARS = 500;
 const FALLBACK_CONTEXT_WINDOW_TOKENS = 200_000;
 const MODEL_CONTEXT_BUDGETS: readonly ModelContextBudget[] = [
+	{ slug: "gpt-5.6-sol", contextWindowTokens: 372_000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
+	{ slug: "gpt-5.6-terra", contextWindowTokens: 372_000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
+	{ slug: "gpt-5.6-luna", contextWindowTokens: 372_000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
 	{ slug: "gpt-5.5", contextWindowTokens: 272_000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
 	{ slug: "gpt-5.4-mini", contextWindowTokens: 272_000, effectivePercent: DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT },
 	{
diff --git a/plugins/omo/components/rules/test/post-compact-budget.test.ts b/plugins/omo/components/rules/test/post-compact-budget.test.ts
index 3a955b2..a4f0afc 100644
--- a/plugins/omo/components/rules/test/post-compact-budget.test.ts
+++ b/plugins/omo/components/rules/test/post-compact-budget.test.ts
@@ -1,10 +1,9 @@
 import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
 import { tmpdir } from "node:os";
 import path from "node:path";
+import type { PiRulesConfig } from "@oh-my-opencode/rules-engine/engine";
 import { afterEach, describe, expect, it } from "vitest";
-
 import { withPostCompactBudget } from "../src/post-compact-budget.js";
-import type { PiRulesConfig } from "@oh-my-opencode/rules-engine/engine";
 
 const tempDirectories: string[] = [];
 const CONFIG: PiRulesConfig = {
@@ -64,6 +63,22 @@ describe("post-compact context budget", () => {
 		expect(budget.maxResultChars).toBe(CONFIG.postCompactMaxResultChars);
 	});
 
+	it.each([
+		"gpt-5.6-sol",
+		"gpt-5.6-terra",
+		"gpt-5.6-luna",
+	])("#given current %s model with room after compaction #when resolving post-compact budget #then keeps configured cap", (model) => {
+		// given
+		const transcriptPath = writeCompactedTranscript("A".repeat(570_000));
+
+		// when
+		const budget = withPostCompactBudget(CONFIG, { model, transcriptPath });
+
+		// then
+		expect(budget.maxRuleChars).toBe(CONFIG.postCompactMaxRuleChars);
+		expect(budget.maxResultChars).toBe(CONFIG.postCompactMaxResultChars);
+	});
+
 	it("#given pure GPT-5.4 model near the fallback context window #when resolving post-compact budget #then treats it as non-preset metadata", () => {
 		// given
 		const transcriptPath = writeCompactedTranscript("A".repeat(600_000));

Verification

  • GREEN: the focused Vitest file passes all 9 tests.
  • Formatting: Biome passes for both changed TypeScript files.
  • Bundle syntax: node --check dist/cli.js passes.
  • Real hook lifecycle: with the same roughly 253K-token compacted transcript, the bundled CLI emitted 30,144 context characters for gpt-5.6-sol, versus 644 for both unknown-model and GPT-5.5. The unknown-model fallback remains conservative.
  • The generated distribution mirror's full typecheck cannot resolve its existing local dev dependency import @oh-my-opencode/rules-engine/engine; focused tests and direct bundled-CLI QA were used instead.

This fix was debugged, implemented, and verified with LazyCodex.
Tag: lazycodex-generated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions