Skip to content

Add history-aware prewarming for idle threads - #48812

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

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

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Add history-aware prewarming for idle threads

What changed

  • Add CodexThread::prewarm_with_history() to prepare a WebSocket response with existing conversation history and executed-tool metadata using generate: false. The next turn can reuse the prepared response when its prompt extends that history and request settings match.
  • Keep startup prewarming and prewarm() on the existing empty-input path, and skip preparation when the cached WebSocket is ready.
  • Label prewarm telemetry by input mode and WebSocket continuation metrics with after_prewarm.
  • Rename persistent_mode_enabled to persistent_execution_enabled without changing its behavior.

Testing

Extend WebSocket coverage to check history preservation during reconnect prewarming, reuse of the prepared response on the next turn, and omission of previous_response_id for a non-prefix prompt.

## What changed

- Add `CodexThread::prewarm_with_history()` to prepare a WebSocket response with existing conversation history and executed-tool metadata using `generate: false`. The next turn can reuse the prepared response when its prompt extends that history and request settings match.
- Keep startup prewarming and `prewarm()` on the existing empty-input path, and skip preparation when the cached WebSocket is ready.
- Label prewarm telemetry by input mode and WebSocket continuation metrics with `after_prewarm`.
- Rename `persistent_mode_enabled` to `persistent_execution_enabled` without changing its behavior.

## Testing

Extend WebSocket coverage to check history preservation during reconnect prewarming, reuse of the prepared response on the next turn, and omission of `previous_response_id` for a non-prefix prompt.

GitOrigin-RevId: c7731541b11b2e6668027a47f37f696213268c66
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/c7731541b11b2e6668027a47f37f696213268c66 branch from 56279fc to 3f4668d Compare September 27, 2026 23:21
@copyberry
copyberry Bot merged commit 3f4668d into main Sep 27, 2026
1 check failed
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/c7731541b11b2e6668027a47f37f696213268c66 branch September 27, 2026 23:21
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 27, 2026

This branch was successfully deployed

1 active deployment
issue-triage — 3f4668da Deployed Sep 27, 2026 by yimeng1468-cell via Translate non-English issue #15710
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