0xPlaygrounds / 0xPlaygrounds/rig

feat(openai): preserve Responses items for stateless replay

Open
#2,269 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
8.6k
Forks
959
Avg merge
4h 32m
Merged PRs (30d)
117

Description

- [x] I searched existing issues and pull requests

## Motivation

Stateless Responses clients need to send prior output items back to OpenAI
without losing fields.

OpenAI says the window returned by `/responses/compact` may contain regular
items plus an opaque compaction item and should be passed to the next request
as-is:

https://developers.openai.com/api/docs/guides/compaction#standalone-compact-endpoint

OpenAI also says to preserve `ResponseOutputMessage.phase` on follow-up
requests because dropping it can degrade performance:

https://developers.openai.com/api/reference/resources/responses/methods/create

## Current behavior

Verified on Rig `main` at `6f67b9db`:

- `InputItem` rejects `"type": "compaction"`;
- `Output::Message` drops the documented `phase` field;
- the raw streaming final does not expose `response.output`; and
- the raw OpenAI methods do not accept a caller-built Responses request.

## Proposal

Could Rig provide a provider-native path for caller-built Responses requests
and complete terminal `response.output`, preserving items such as `compaction`
and documented fields such as `phase`?

The exact API is up to the maintainers. Rig would not need to perform
compaction or manage conversation state.

PR #2234 covers server-managed compaction and response-ID chaining. This request
is for clients that manage and resend state themselves.

Calling OpenAI directly works, but duplicates Rig's authentication, errors,
telemetry, and SSE handling.

Contributor guide

Open the contributing guide

Research direction

Examine the OpenAI provider implementation in the codebase, focusing on the InputItem and Output::Message structs. Look for the raw streaming final handling and the methods that construct OpenAI requests. The goal is to modify these to accept and preserve compaction items and the phase field, ensuring the terminal response.output is fully exposed. Testing will involve verifying that a caller-built Responses request can be sent through Rig's existing authentication and SSE pipeline.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.