Skip to content

ThreadForkParams

Base classes

Name Children Inherits
CodexBaseModel
codexed.models.base
Base model for all Codex API models.

⋔ Inheritance diagram

graph TD
  3872044706["v2_protocol.ThreadForkParams"]
  3116041069["base.CodexBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3116041069 --> 3872044706
  3879467795 --> 3116041069
  2751680898 --> 3879467795

🛈 DocStrings

Bases: CodexBaseModel

There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.

If using a non-empty path, the thread_id param will be ignored. Empty string path values are treated as absent.

Prefer using thread_id whenever possible.

Source code in src/codexed/models/v2_protocol.py
class ThreadForkParams(CodexBaseModel):
    """There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.

    If using a non-empty path, the thread_id param will be ignored. Empty string path values are treated as absent.

    Prefer using thread_id whenever possible.
    """

    approval_policy: AskForApproval | None = None
    approvals_reviewer: ApprovalsReviewer | None = None
    """
    Override where approval requests are routed for review on this thread and subsequent turns.
    """
    attach_to_source: bool | None = None
    """
    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 a paginated source and local storage; incompatible with ephemeral and deferGoalContinuation. Omitted or false creates an ordinary fork.
    """
    base_instructions: str | None = None
    before_turn_id: str | None = None
    """
    Optional turn id to fork before, excluding that turn and all later turns. Cannot be combined with `last_turn_id`.
    """
    config: dict[str, Any] | None = None
    cwd: str | None = None
    defer_goal_continuation: bool | None = None
    """
    When true, carry the source thread's current goal into the fork without starting its initial automatic continuation. The next explicit turn owns the goal lifecycle, and normal automatic continuation resumes after it.
    """
    developer_instructions: str | None = None
    ephemeral: bool | None = None
    exclude_turns: bool | None = None
    """
    When true, return only thread metadata and live fork state without populating `thread.turns`. This is useful when the client plans to call `thread/turns/list` immediately after forking. Full-history hydration is deprecated for paginated threads; use this with `thread/turns/list` and `thread/items/list` instead.
    """
    experimental_disable_prediction_mcp: bool | None = None
    """
    Disable MCP servers in prediction mode when the inherited window uses incremental tools on Responses Lite. Requires `experimentalPredictionMode: true`.
    """
    experimental_prediction_mode: bool | None = None
    """
    Start from the loaded parent's effective config, tools, environments, and persisted history to maximize prompt-cache reuse. Requires a loaded, persisted parent and `ephemeral: true`. Enables `features.reasoning_effort_override` on the fork. Only `config.thread_unload_delay_secs` may override the inherited config. Cannot be combined with `path`, `lastTurnId`, or `beforeTurnId`.
    """
    last_turn_id: str | None = None
    """
    Optional last turn id to fork through, inclusive.

    When specified, turns after `last_turn_id` are omitted from the fork. The referenced turn cannot be in progress.
    """
    model: str | None = None
    """
    Configuration overrides for the forked thread, if any.
    """
    model_provider: str | None = None
    path: str | None = None
    """
    [UNSTABLE] Specify the rollout path to fork from. If specified, the thread_id param will be ignored.
    """
    permissions: str | None = None
    """
    Named profile id for the forked thread. Cannot be combined with `sandbox`.
    """
    runtime_workspace_roots: list[AbsolutePathBuf] | None = None
    """
    Replace the thread's runtime workspace roots. Paths must be absolute.
    """
    sandbox: SandboxMode | None = None
    service_tier: str | None = None
    thread_id: str
    thread_source: ThreadSource | None = None
    """
    Optional client-supplied analytics source classification for this forked thread.
    """

approvals_reviewer class-attribute instance-attribute

approvals_reviewer: ApprovalsReviewer | None = None

Override where approval requests are routed for review on this thread and subsequent turns.

attach_to_source class-attribute instance-attribute

attach_to_source: bool | None = None

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 a paginated source and local storage; incompatible with ephemeral and deferGoalContinuation. Omitted or false creates an ordinary fork.

before_turn_id class-attribute instance-attribute

before_turn_id: str | None = None

Optional turn id to fork before, excluding that turn and all later turns. Cannot be combined with last_turn_id.

defer_goal_continuation class-attribute instance-attribute

defer_goal_continuation: bool | None = None

When true, carry the source thread's current goal into the fork without starting its initial automatic continuation. The next explicit turn owns the goal lifecycle, and normal automatic continuation resumes after it.

exclude_turns class-attribute instance-attribute

exclude_turns: bool | None = None

When true, return only thread metadata and live fork state without populating thread.turns. This is useful when the client plans to call thread/turns/list immediately after forking. Full-history hydration is deprecated for paginated threads; use this with thread/turns/list and thread/items/list instead.

experimental_disable_prediction_mcp class-attribute instance-attribute

experimental_disable_prediction_mcp: bool | None = None

Disable MCP servers in prediction mode when the inherited window uses incremental tools on Responses Lite. Requires experimentalPredictionMode: true.

experimental_prediction_mode class-attribute instance-attribute

experimental_prediction_mode: bool | None = None

Start from the loaded parent's effective config, tools, environments, and persisted history to maximize prompt-cache reuse. Requires a loaded, persisted parent and ephemeral: true. Enables features.reasoning_effort_override on the fork. Only config.thread_unload_delay_secs may override the inherited config. Cannot be combined with path, lastTurnId, or beforeTurnId.

last_turn_id class-attribute instance-attribute

last_turn_id: str | None = None

Optional last turn id to fork through, inclusive.

When specified, turns after last_turn_id are omitted from the fork. The referenced turn cannot be in progress.

model class-attribute instance-attribute

model: str | None = None

Configuration overrides for the forked thread, if any.

path class-attribute instance-attribute

path: str | None = None

[UNSTABLE] Specify the rollout path to fork from. If specified, the thread_id param will be ignored.

permissions class-attribute instance-attribute

permissions: str | None = None

Named profile id for the forked thread. Cannot be combined with sandbox.

runtime_workspace_roots class-attribute instance-attribute

runtime_workspace_roots: list[AbsolutePathBuf] | None = None

Replace the thread's runtime workspace roots. Paths must be absolute.

thread_source class-attribute instance-attribute

thread_source: ThreadSource | None = None

Optional client-supplied analytics source classification for this forked thread.

:fa-brands-github: Show source on GitHub