Files
codex/codex-rs
felixxia-oai 51ebf5b184 Truncate Guardian instructions after rendering the policy (#39985)
## Why

Legacy classifier prompts without a `{{ tenant_policy_config }}` placeholder
append the security policy during rendering. Truncating the prompt before and
after that step can unnecessarily truncate the final classifier instructions
twice.

## What changed

Keep configured classifier instructions intact until the policy has been
rendered, then apply `max_classifier_instruction_tokens` once to the complete
prompt.

## Testing

Add an extension test that verifies the bounded developer message sent for a
legacy prompt with an appended policy.

GitOrigin-RevId: 3d776a159340f4dffb6e3c2d7a10b33392fa2240
2026-08-21 17:54:23 +00:00
..