@@ -15,7 +15,7 @@ import { lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync
1515import { join } from "node:path" ;
1616import type { OcxConfig } from "../types" ;
1717import { claudeCodeAlias , claudeCodeNativeAlias } from "./alias" ;
18- import { resolveAutoContext , stripOneMillionMarker , withOneMillionMarker } from "./context-windows" ;
18+ import { stripOneMillionMarker , withOneMillionMarker } from "./context-windows" ;
1919import { claudeConfigDir } from "./gateway-cache" ;
2020import { DEFAULT_SUBAGENT_MODELS , hasOwnProvider } from "../config" ;
2121import { effectiveBlockedSkillNames , resolveInboundModel } from "./inbound" ;
@@ -55,6 +55,15 @@ function pickerDefaultModel(configDir: string): string | null {
5555 }
5656}
5757
58+ /**
59+ * Generated subagents cannot rely on parent auto-context compaction before
60+ * routed requests reach the real model limit.
61+ */
62+ function withSubagentContextMarker ( selector : string , windows : Record < string , number > ) : string {
63+ const bare = stripOneMillionMarker ( selector ) ;
64+ return withOneMillionMarker ( bare , windows ) ?? bare ;
65+ }
66+
5867/** Roster entry -> alias + display parts. Entries are bare native slugs or "provider/id".
5968 * Codex-facing encoded ids (`provider/vendor-model`) decode to the native slash id first
6069 * so the alias joins the raw-native context-window map (context-windows.ts). */
@@ -72,7 +81,6 @@ function entryParts(entry: string, config: OcxConfig): { alias: string; id: stri
7281}
7382
7483export function buildClaudeAgentDefs ( config : OcxConfig , windows : Record < string , number > , configDir = claudeConfigDir ( ) ) : ClaudeAgentDef [ ] {
75- const auto = resolveAutoContext ( config . claudeCode ) ;
7684 const blockedSkills = effectiveBlockedSkillNames ( config . claudeCode ) ;
7785 const blockedSkillsFor = ( model : string ) : readonly string [ ] => {
7886 const unmarked = stripOneMillionMarker ( model ) ;
@@ -87,8 +95,7 @@ export function buildClaudeAgentDefs(config: OcxConfig, windows: Record<string,
8795 const coveredModels = new Set < string > ( ) ;
8896
8997 const push = ( name : string , alias : string , description : string ) => {
90- // Effective model value: [1m] marking follows the same predicate as env slots.
91- const model = withOneMillionMarker ( alias , windows , auto ) ?? alias ;
98+ const model = withSubagentContextMarker ( alias , windows ) ;
9299 const bare = alias . toLowerCase ( ) ;
93100 if ( coveredModels . has ( bare ) ) return ;
94101 coveredModels . add ( bare ) ;
@@ -120,7 +127,7 @@ export function buildClaudeAgentDefs(config: OcxConfig, windows: Record<string,
120127 // the next launch sync — documented limit. No resolvable default -> no self def.
121128 const selfModel = pickerDefaultModel ( configDir ) ?? ( config . claudeCode ?. model ?. trim ( ) || null ) ;
122129 if ( selfModel ) {
123- const marked = withOneMillionMarker ( selfModel , windows , auto ) ?? selfModel ;
130+ const marked = withSubagentContextMarker ( selfModel , windows ) ;
124131 defs . push ( {
125132 file : `${ OWNED_PREFIX } self.md` ,
126133 name : `${ OWNED_PREFIX } self` ,
0 commit comments