Skip to content

[FEATURE]: Implement V2 session.fork API #34430

Closed

Description

@opencode-agent

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Implement V2 session forking from a specific message or timeline boundary.

Current notes from #34359:

  • SessionV2.create supports parentID, but that is only one ingredient.
  • The TUI expects full fork-at-message behavior, not just creating a child session.

Expected scope:

  • Define the fork input contract, including parent session and fork boundary/message.
  • Decide which session state/history/context is copied into the fork.
  • Preserve/derive metadata needed by the TUI to show parent/child relationships.
  • Handle invalid boundaries, missing messages, and file/revert state explicitly.
  • Add protocol/server/client exposure and tests.

This issue is split out from the broader TUI client migration umbrella #34359.

Activity

  1. opencode-agent commented on Jun 29, 2026

    @opencode-agent
    ContributorAuthor

    Likely implementation PR: #34343 (feat(core): implement v2 session forking). Keep this issue open until that PR lands or any remaining fork-at-boundary behavior is split out.

  2. opencode-agent commented on Jul 2, 2026

    @opencode-agent
    ContributorAuthor

    Tracker update from V2 TODO LIST audit (2026-07-02):

    Direct implementation PR is still open:

    Suggested tracker state: keep this issue open until #34343 lands and the generated client/server surface is verified.

  3. opencode-agent commented on Jul 3, 2026

    @opencode-agent
    ContributorAuthor

    Update: #34343 (feat(core): implement v2 session forking) is the active V2 session fork implementation PR. After it lands, verify fork-at-message semantics in the TUI/app flow and narrow/close this tracker accordingly.

  4. opencode-agent commented on Jul 10, 2026

    @opencode-agent
    ContributorAuthor

    Audit: this may be completed or stale after direct V2 commit 96717c1 (feat(tui): improve session fork handling), which added fork schema/client/session/TUI handling. The older PR #34343 also appears potentially stale. Leaving open for owner confirmation because the issue asks for the V2 session.fork API, not only TUI handling.

    Commit: 96717c1

  5. opencode-agent commented on Jul 30, 2026

    @opencode-agent
    ContributorAuthor

    Addressed by commit fc11ed3 (feat(session): define explicit fork boundaries), building on the earlier V2 fork implementation. The session fork API now requires an explicit before(messageID) or through boundary, validates missing and empty boundaries with typed errors, persists parent/boundary metadata and instruction state, projects forked history, and exposes the contract through Server, generated Promise/Effect clients, ACP, App, and TUI with focused tests and a database migration. Closing as resolved on the v2 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions