Skip to content

feat: add ZDR support to Rust implementation - #642

Merged
bolinfest merged 1 commit into
mainfrom
pr642
Apr 25, 2025
Merged

bolinfest merged 1 commit into
mainfrom
pr642

Conversation

@bolinfest

@bolinfest bolinfest commented Apr 25, 2025 •

Copy link
Copy Markdown
Collaborator

This adds support for the --disable-response-storage flag across our multiple Rust CLIs to support customers who have opted into Zero-Data Retention (ZDR). The analogous changes to the TypeScript CLI were:

For a client using ZDR, previous_response_id will never be available, so the input field of an API request must include the full transcript of the conversation thus far. As such, this PR changes the type of Prompt.input from Vec<ResponseInputItem> to Vec<ResponseItem>.

Practically speaking, ResponseItem was effectively a "superset" of ResponseInputItem already. The main difference for us is that ResponseItem includes the FunctionCall variant that we have to include as part of the conversation history in the ZDR case.

Another key change in this PR is modifying try_run_turn() so that it returns the Vec<ResponseItem> for the turn in addition to the Vec<ResponseInputItem> produced by try_run_turn(). This is because the caller of run_turn() needs to record the Vec<ResponseItem> when ZDR is enabled.

To that end, this PR introduces ZdrTranscript (and adds zdr_transcript: Option<ZdrTranscript> to struct State in codex.rs) to take responsibility for maintaining the conversation transcript in the ZDR case.

@bolinfest
bolinfest force-pushed the pr642 branch 5 times, most recently from 34c2daf to b05ea21 Compare April 25, 2025 18:07
@bolinfest
bolinfest marked this pull request as ready for review April 25, 2025 18:12
@bolinfest
bolinfest force-pushed the pr642 branch 2 times, most recently from 2e1904f to 285c335 Compare April 25, 2025 18:48
@bolinfest
bolinfest merged commit b323d10 into main Apr 25, 2025
@bolinfest
bolinfest deleted the pr642 branch April 25, 2025 19:08
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 2025
@bolinfest

Copy link
Copy Markdown
Collaborator Author

Whoops, I think I just broke things when --disable-response-storage is not set...

@bolinfest

Copy link
Copy Markdown
Collaborator Author

Fix is in #663.

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