Skip to content

fix(guardian): don't throw away transcript when over budget#16956

Merged
owenlin0 merged 3 commits intomainfrom
owen/fix_truncation_logic
Apr 7, 2026
Merged

fix(guardian): don't throw away transcript when over budget#16956
owenlin0 merged 3 commits intomainfrom
owen/fix_truncation_logic

Conversation

@owenlin0
Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 commented Apr 6, 2026

Description

This PR changes guardian transcript compaction so oversized conversations no longer collapse into a nearly empty placeholder.

Before this change, if the retained user history alone exceeded the message budget, guardian would replace the entire transcript with <transcript omitted to preserve budget for planned action>!

That meant approvals, especially network approvals, could lose the recent tool call and tool result that explained what guardian was actually reviewing. Now we keep a compact but usable transcript instead of dropping it all.

Before

The following is the Codex agent history whose request action you are assessing...
>>> TRANSCRIPT START
<transcript omitted to preserve budget for planned action>
>>> TRANSCRIPT END

Conversation transcript omitted due to size.

The Codex agent has requested the following action:
>>> APPROVAL REQUEST START
Retry reason:
Sandbox blocked outbound network access.

Assess the exact planned action below. Use read-only tool checks when local state matters.
Planned action JSON:
{
  "tool": "network_access",
  "target": "https://example.com:443",
  "host": "example.com",
  "protocol": "https",
  "port": 443
}
>>> APPROVAL REQUEST END

After

The following is the Codex agent history whose request action you are assessing...
>>> TRANSCRIPT START
[1] user: Please investigate why uploads to example.com are failing and retry if needed.
[8] user: If the request looks correct, go ahead and try again with network access.
[9] tool shell call: {"command":["curl","-X","POST","https://example.com/upload"],"cwd":"/repo"}
[10] tool shell result: sandbox blocked outbound network access
>>> TRANSCRIPT END

Some conversation entries were omitted.

The Codex agent has requested the following action:
>>> APPROVAL REQUEST START
Retry reason:
Sandbox blocked outbound network access.

Assess the exact planned action below. Use read-only tool checks when local state matters.
Planned action JSON:
{
  "tool": "network_access",
  "target": "https://example.com:443",
  "host": "example.com",
  "protocol": "https",
  "port": 443
}
>>> APPROVAL REQUEST END

@owenlin0 owenlin0 changed the title fix(guardian): truncation logic wip fix(guardian): improve truncation logic Apr 6, 2026
@owenlin0 owenlin0 changed the title fix(guardian): improve truncation logic fix(guardian): don't throw away transcript when over budget Apr 6, 2026
@owenlin0 owenlin0 marked this pull request as ready for review April 6, 2026 22:54
@owenlin0 owenlin0 force-pushed the owen/fix_truncation_logic branch from b0788e8 to 897a87d Compare April 6, 2026 23:01
@owenlin0 owenlin0 force-pushed the owen/fix_truncation_logic branch from 428c497 to 74f0e91 Compare April 7, 2026 16:51
@owenlin0 owenlin0 merged commit 0b9e42f into main Apr 7, 2026
21 of 22 checks passed
@owenlin0 owenlin0 deleted the owen/fix_truncation_logic branch April 7, 2026 17:19
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 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