Skip to content

chore: apply truncation policy to unified_exec#19247

Merged
sayan-oai merged 2 commits intomainfrom
dev/sayan/clamp-unified-exec
Apr 24, 2026
Merged

chore: apply truncation policy to unified_exec#19247
sayan-oai merged 2 commits intomainfrom
dev/sayan/clamp-unified-exec

Conversation

@sayan-oai
Copy link
Copy Markdown
Collaborator

we were not respecting turn's truncation_policy to clamp output tokens for unified_exec and write_stdin.

this meant truncation was only being applied by ContextManager before the output was stored in-memory (so it was being truncated from model-visible context), but the full output was persisted to rollout on disk.

now we respect that truncation_policy and ContextManager-level truncation remains a backup.

Tests

added tests, tested locally.

@sayan-oai sayan-oai requested a review from a team as a code owner April 24, 2026 00:48
Comment thread codex-rs/core/tests/suite/unified_exec.rs Outdated
stdin_output.output.len()
);
assert!(
stdin_output.original_token_count.unwrap_or_default() > 50,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we know it's not global truncation?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to look at RawResponseItems, since those arent truncated by ContextManager. if its truncated by then, it must have happened at the unified_exec level, as intended.

Comment thread codex-rs/core/src/tools/handlers/unified_exec_tests.rs Outdated
@sayan-oai sayan-oai merged commit e083b6c into main Apr 24, 2026
25 checks passed
@sayan-oai sayan-oai deleted the dev/sayan/clamp-unified-exec branch April 24, 2026 07:17
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants