Skip to content

[codex] Wire OpenCode into thread item fork - #7

Closed
samdickson22 wants to merge 1 commit into
codex/thread-list-item-fork-apifrom
codex/opencode-thread-list-item-fork
Closed

samdickson22 wants to merge 1 commit into
codex/thread-list-item-fork-apifrom
codex/opencode-thread-list-item-fork

Conversation

@samdickson22

Copy link
Copy Markdown
Owner

Summary

  • Wire OpenCode native client.session.fork into the core threadListItem().fork({ fromMessageId }) seam from Add thread list item fork API seam assistant-ui/assistant-ui#4666.
  • Remove the OpenCode-only openCodeExtras.fork helper and OpenCodeThreadController.fork() so consumers use the shared assistant-ui lifecycle path.
  • Add focused adapter tests for OpenCode fork mapping and keep controller tests on the current typed model shape.

Stacking

Stacked on assistant-ui#4666 (codex/thread-list-item-fork-api). Review this PR as the OpenCode adapter integration only.

GitHub cannot open this as an upstream stacked PR until the base branch exists in assistant-ui/assistant-ui, so this fork PR preserves the small diff. After assistant-ui#4666 merges, this branch can be retargeted/opened against upstream main.

OpenCode Compatibility Note

This PR deliberately breaks the previous OpenCode-specific fork escape hatch. @assistant-ui/react-opencode consumers should migrate from useOpenCodeRuntimeExtras().fork(messageId) / OpenCodeThreadController.fork(messageId) to:

await aui.threadListItem().fork({ fromMessageId: messageId });

The OpenCode adapter still uses OpenCode native session.fork under the hood; the public entrypoint is now the core thread-list-item API.

Verification

  • pnpm --filter @assistant-ui/react-opencode exec vitest run src/openCodeThreadListAdapter.test.ts src/hooks.test.tsx src/OpenCodeThreadController.test.ts - 3 files, 18 tests passed
  • pnpm --filter @assistant-ui/react-opencode build - passed
  • pnpm --filter @assistant-ui/react-opencode exec tsc --noEmit - passed
  • pnpm exec oxlint <touched OpenCode files> - passed
  • pnpm exec oxfmt --check <touched OpenCode/API files> - passed
  • git diff --check - passed

Diff Shape

Against assistant-ui#4666: 9 files, +67/-21.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: affce3d8-5a5b-48fe-90a2-e59ae4ce50e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/opencode-thread-list-item-fork

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

OpenCode can now use the shared threadListItem().fork seam from the core PR, so its package no longer needs a separate public fork escape hatch on runtime extras or the thread controller.

Constraint: This PR is intentionally stacked on codex/thread-list-item-fork-api and depends on the core thread-list-item fork method.

Constraint: OpenCode breaking cleanup is allowed for this change so consumers migrate to the shared assistant-ui API.

Rejected: Keep OpenCodeThreadController.fork as a public helper | it keeps a second public fork path that bypasses assistant-ui lifecycle state

Confidence: high

Scope-risk: narrow

Tested: pnpm --filter @assistant-ui/react-opencode exec vitest run src/openCodeThreadListAdapter.test.ts src/hooks.test.tsx src/OpenCodeThreadController.test.ts

Tested: pnpm --filter @assistant-ui/react-opencode build; pnpm --filter @assistant-ui/react-opencode exec tsc --noEmit

Tested: pnpm exec oxlint touched OpenCode files; pnpm exec oxfmt --check touched OpenCode/API files; git diff --check
@samdickson22
samdickson22 force-pushed the codex/opencode-thread-list-item-fork branch from 91d5784 to 1e199db Compare July 14, 2026 20:57
@samdickson22

Copy link
Copy Markdown
Owner Author

Moved upstream to assistant-ui#4914 now that the stacked base branch is available there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant