mirror of
https://github.com/openai/codex.git
synced 2026-11-28 07:32:19 +00:00
Preserve tool output truncation budgets across resume and fork (#44248)
## Why Replaying tool outputs under a different model can expand or shrink the history shown to the model if truncation uses the new model's budget. ## What changed Save the originating history truncation budget on function and custom tool outputs and reuse it during replay, preserving existing tool-specific overrides. Include the existing 20% serialization allowance once, before converting byte budgets to tokens. Rename the metadata field to `history_truncation_token_limit` while retaining `fallback_token_limit_override` as its serialized name for compatibility. ## Testing Add regression coverage for resume and fork with different model budgets, including custom tool outputs. Extend unit coverage for existing overrides and byte-budget conversion. GitOrigin-RevId: a62c8fd3e43198e2252b150fba72f022939c1070
This commit is contained in:
1 parent
b64de2f3ad
commit
aa88a0333c
15 files changed
+287
-47
No files matched your search
@@ -50,10 +50,14 @@ pub struct CodexHarnessMetadata {
|
||||
#[serde(default)]
|
||||
pub client_authored: bool,
|
||||
|
||||
/// Overrides history's fallback truncation budget, including on resume.
|
||||
/// Measured in tokens, with any tool-specific allowance already included.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub fallback_token_limit_override: Option<usize>,
|
||||
/// The originating history budget, including any tool-specific allowance.
|
||||
/// Measured in tokens and reused when replaying persisted history.
|
||||
#[serde(
|
||||
default,
|
||||
rename = "fallback_token_limit_override",
|
||||
skip_serializing_if = "Option::is_none"
|
||||
)]
|
||||
pub history_truncation_token_limit: Option<usize>,
|
||||
|
||||
/// Whether a response configuration update was created by the Codex harness itself.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
|
||||
Reference in new issue
Block a user