Skip to content

Preserve incoming prompts when pre-turn compaction fails - #44487

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/ab7ccb259836c084173e0e81dbbd4c610e95a6c8
Sep 10, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/ab7ccb259836c084173e0e81dbbd4c610e95a6c8

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Preserve incoming prompts when pre-turn compaction fails

Why

Pre-turn compaction runs before incoming input is recorded, so failures could leave an accepted prompt out of conversation history. Reporting the error before prompt hooks finish also lets clients steer follow-up input into a turn still preserving its prompt.

What changed

Record input and run prompt hooks on every pre-turn compaction failure. Defer local and remote compaction error events to run_turn, after prompt preservation completes, while retaining the remote error prefix.

Testing

Extend the remote compaction output-validation test to trigger automatic compaction and assert that the prompt is emitted before the error, saved exactly once, and followed by no additional model request. Retain the assertion that usage is recorded for invalid compaction output.

## Why

Pre-turn compaction runs before incoming input is recorded, so failures could leave an accepted prompt out of conversation history. Reporting the error before prompt hooks finish also lets clients steer follow-up input into a turn still preserving its prompt.

## What changed

Record input and run prompt hooks on every pre-turn compaction failure. Defer local and remote compaction error events to `run_turn`, after prompt preservation completes, while retaining the remote error prefix.

## Testing

Extend the remote compaction output-validation test to trigger automatic compaction and assert that the prompt is emitted before the error, saved exactly once, and followed by no additional model request. Retain the assertion that usage is recorded for invalid compaction output.

GitOrigin-RevId: ab7ccb259836c084173e0e81dbbd4c610e95a6c8
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/ab7ccb259836c084173e0e81dbbd4c610e95a6c8 branch from 5b302a1 to ee93abb Compare September 10, 2026 10:08
@copyberry
copyberry Bot merged commit ee93abb into main Sep 10, 2026
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/ab7ccb259836c084173e0e81dbbd4c610e95a6c8 branch September 10, 2026 10:08
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 10, 2026

This branch was previously deployed

1 inactive deployment
issue-triage — ee93abb6 Deployed Sep 10, 2026 by michkot via Identify potential duplicates (open issues fallback) #44306
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.

3 participants