mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
Add experimental attached thread forks (#56351)
## What changed - Add `attachToSource` to `thread/fork` to persist a fork attached to its source without emitting `thread/started`. Attached forks require local storage and cannot use `ephemeral` or `deferGoalContinuation`. - Hide attached threads from ordinary listings and add `attachedToThreadId` to `thread/list` for explicit discovery, including empty threads. Keep this relationship separate from spawned-agent parent and ancestor filters. - Persist attachment metadata in rollouts and SQLite so it survives restarts and database recovery. Reject source deletion until its attached threads are deleted. ## Testing Add coverage for legacy and paginated history, restart and missing or corrupt database recovery, filtered listings and pagination, resume, conflicting options, and deletion safeguards across store instances. GitOrigin-RevId: 589f3174fc36f6054e75d65818360695645a5913
This commit is contained in:
@@ -623,6 +623,12 @@ pub struct ThreadForkParams {
|
||||
pub developer_instructions: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub ephemeral: bool,
|
||||
/// Persist the fork as an attached thread of its resolved source, hidden from ordinary
|
||||
/// lists. The source cannot be deleted while attached threads exist. Requires local storage;
|
||||
/// incompatible with ephemeral and deferGoalContinuation. Omitted or false creates an ordinary fork.
|
||||
#[experimental("thread/fork.attachToSource")]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub attach_to_source: bool,
|
||||
/// Optional client-supplied analytics source classification for this forked thread.
|
||||
#[ts(optional = nullable)]
|
||||
pub thread_source: Option<ThreadSource>,
|
||||
@@ -1483,6 +1489,12 @@ pub struct ThreadListParams {
|
||||
#[experimental("thread/list.ancestorThreadId")]
|
||||
#[ts(optional = nullable)]
|
||||
pub ancestor_thread_id: Option<String>,
|
||||
/// Return only persistent threads attached to this thread, including empty threads.
|
||||
/// Mutually exclusive with parentThreadId and ancestorThreadId.
|
||||
/// Omitting this filter keeps attached threads hidden from ordinary listings.
|
||||
#[experimental("thread/list.attachedToThreadId")]
|
||||
#[ts(optional = nullable)]
|
||||
pub attached_to_thread_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user