fix(omo-codex): bypass per-rule truncation for plugin-bundled rules
The 12000-char per-rule cap exists to guard against absurd user-authored AGENTS.md files. For PLUGIN_BUNDLED rules the plugin author already controls the body size, and silent mid-section truncation breaks the contract that bundled discipline lands in full. The current bundled Hephaestus baseline is 16k chars: everything from `# AGENTS.md` onward (Output, Success Criteria, Stop Rules, Task Tracking) was being dropped from every Codex session without warning. Skip truncateRule when the source is plugin-bundled; the maxResultChars budget (40000 default) via truncateBudget still caps total injection. Locks the behavior with two regression tests in bundled-rules.test.ts: bundled body > maxRuleChars lands intact, project body > maxRuleChars still truncates with the standard notice.
This commit is contained in:
@@ -20,7 +20,14 @@ function truncateRules(rules: ReadonlyArray<LoadedRule>, options: FormatOptions)
|
||||
const perRuleTruncated = rules.map((rule) => ({
|
||||
path: rule.path,
|
||||
relativePath: rule.relativePath,
|
||||
body: truncateRule(rule.body, { maxChars: options.maxRuleChars, relativePath: rule.relativePath }).body,
|
||||
// Plugin-bundled rules ship as-is. The per-rule cap exists to guard against absurd
|
||||
// user-authored AGENTS.md files; bundled rules are author-controlled and silent
|
||||
// mid-section truncation would break the contract that the rule landed in full.
|
||||
// The overall maxResultChars budget still applies via truncateBudget below.
|
||||
body:
|
||||
rule.source === "plugin-bundled"
|
||||
? rule.body
|
||||
: truncateRule(rule.body, { maxChars: options.maxRuleChars, relativePath: rule.relativePath }).body,
|
||||
}));
|
||||
const budgetedRules = truncateBudget({
|
||||
rules: perRuleTruncated.map((rule) => ({ body: rule.body, relativePath: rule.relativePath })),
|
||||
|
||||
Reference in New Issue
Block a user