Skip to content

feat(native): add OpenCode terminal agent - #5562

Merged
tlgimenes merged 9 commits into
feat/native-terminal-agentsfrom
feat/native-opencode-agent
Aug 3, 2026
Merged

feat(native): add OpenCode terminal agent#5562
tlgimenes merged 9 commits into
feat/native-terminal-agentsfrom
feat/native-opencode-agent

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #5557. Adds OpenCode as the third native-only xterm/PTY coding agent and hardens the shared native terminal experience for Claude Code, Codex, and OpenCode.

Dependency: review and merge #5557 first. This PR's review diff is feat/native-terminal-agents...feat/native-opencode-agent.

What changed

  • Detect OpenCode 1.18.10+ and verify bounded runtime readiness before exposing it in the native picker.
  • Launch a real OpenCode TUI with launch-scoped Studio instructions, lifecycle plugin, selected cms MCP, exact --session resume, provider-owned model selection, and provider-owned titles.
  • Keep OpenCode terminal-only: it is not added to hosted/headless harness IDs, AI SDK dispatch, provider keys, or cloud model catalogs.
  • Polish the native picker and startup flow with keyboard navigation, concise agent cards, a localized loading state, matching panel/terminal colors, and only xterm after launch—no Studio Ready/Interrupt toolbar.
  • Start Codex in YOLO mode by default, disable its Desktop-app promotion, and pre-trust only Studio's exact managed hooks/workspace configuration.
  • Avoid Claude/Codex folder-trust prompts without broadening trust to unrelated hooks or projects.
  • Make resume/recovery restart-safe: preserve the last confirmed provider checkpoint, record exact missing-session rejection before fresh fallback, retain replay/capability-query authority across remounts, and prevent stale hooks from restoring rejected sessions or overwriting manual titles.
  • Reap OpenCode processes and Codex preflight helpers across logout/account transitions and shutdown.

Hosted/native boundary

All CLI-agent renderer behavior is selected only by the native Tauri runtime. Hosted web continues to use structured Decopilot chat; it never exposes OpenCode or ships the terminal protocol in its production bundle.

Validation

Completed on the final rebased stack:

  • bun run test — 5,689 passed, 0 failed across 617 files.
  • Top native black-box contract — 109 passed, 0 failed, 889 assertions, covering all three providers, lifecycle, exact resume, missing-session recovery, process restart, and account fencing.
  • Hosted runtime boundary E2E — 7 passed, 0 failed.
  • cargo test --workspace and cargo clippy --workspace --all-targets -- -D warnings.
  • bun run check, bun run lint, bun run knip, bun run fmt:check, and cargo fmt --all -- --check.
  • Hosted and native production builds; the hosted bundle guard scanned 238 assets and found no desktop runtime.

Tauri DevTools acceptance exercised the final three-agent picker, keyboard wrapping, backgrounds, real Claude prompt/title/status/replay, and real Codex YOLO startup without trust/hook/Desktop notices. OpenCode's installed 1.18.10 binary was correctly marked try anyway because its existing pre-1.18 user database has an incomplete upstream migration; a fresh isolated 1.18.10 state enters the real TUI, while the product's fail-closed probe prevents a broken blank session.

Review feedback

All 23 existing review threads are resolved. The four hosted-selector findings became obsolete under the strict Decopilot-hosted / terminal-native split; the remaining findings have fixes and regression coverage in the final commits.

Migration notes

Native SQLite migrates from schema version 11 to 12 by adding rejected_provider_session_id. The migration clears legacy null-checkpoint barriers while preserving confirmed provider checkpoints. There is no hosted Postgres migration or hosted chat contract expansion.

Architecture and detailed validation evidence are in apps/native/docs/terminal-agents-plan.md.

@tlgimenes
tlgimenes force-pushed the feat/native-opencode-agent branch from 1c8e58c to f8900bd Compare August 1, 2026 15:24

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/sandbox/dispatch/schemas.ts Outdated
Comment thread apps/native/e2e/fixtures/interactive-agent.mjs
Comment thread apps/native/crates/local-api/src/terminal/lifecycle.rs Outdated
Comment thread apps/web/src/desktop/agent-terminal/terminal-panel.tsx Outdated
Comment thread apps/web/src/desktop/agent-terminal/terminal-controller.ts Outdated
Comment thread apps/native/e2e/fixtures/interactive-agent.mjs Outdated
Comment thread apps/web/src/components/chat/tier-trigger.tsx Outdated
Comment thread apps/web/src/desktop/agent-terminal/terminal-capability-replies.ts Outdated
Comment thread apps/native/crates/local-api/src/routes/agent_hooks.rs
Comment thread apps/native/e2e/terminal-agent-ws.e2e.test.ts Outdated
@tlgimenes
tlgimenes force-pushed the feat/native-opencode-agent branch from f8900bd to 292cd8f Compare August 1, 2026 15:51

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 50 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/web/src/components/chat/tier-trigger.tsx Outdated
Comment thread apps/web/src/desktop/agent-terminal/terminal-panel.tsx Outdated
Comment thread apps/web/src/desktop/agent-terminal/terminal-panel.tsx
Comment thread apps/native/e2e/fixtures/interactive-agent.mjs Outdated
Comment thread apps/native/crates/harness/src/detect.rs
Comment thread apps/web/src/desktop/agent-terminal/terminal-controller.ts
Comment thread apps/native/crates/local-api/src/terminal/launch_context.rs
Comment thread apps/web/src/desktop/agent-terminal/terminal-capability-replies.ts Outdated
Comment thread apps/native/crates/harness/src/run.rs Outdated
Comment thread apps/web/src/components/chat/select-model/index.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files (changes from recent commits).

You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/native/e2e/terminal-agent-ws.e2e.test.ts Outdated
Comment thread apps/native/crates/local-api/src/routes/terminal.rs Outdated
@tlgimenes

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this

@tlgimenes I can't start this review because your workspace has reached its free monthly review limit. cubic has reviewed 42,059 of the 40,000 allowed lines of code this month. Reviews resume on 1 September 2026 (in 29 days). Paid plans include much higher monthly review limits. Upgrade now to resume reviews.

To help optimise your usage, you can tune cubic to get the most out of your usage limits:

Learn more →

@tlgimenes
tlgimenes force-pushed the feat/native-terminal-agents branch from 62cc545 to be2a639 Compare August 3, 2026 04:15
@tlgimenes
tlgimenes force-pushed the feat/native-opencode-agent branch 2 times, most recently from 1ca9589 to 2279a39 Compare August 3, 2026 04:39
@tlgimenes
tlgimenes force-pushed the feat/native-opencode-agent branch from 2279a39 to 3846114 Compare August 3, 2026 04:54
@tlgimenes
tlgimenes merged commit 3846114 into feat/native-terminal-agents Aug 3, 2026
24 checks passed
@tlgimenes
tlgimenes deleted the feat/native-opencode-agent branch August 3, 2026 05:09
@tlgimenes

Copy link
Copy Markdown
Contributor Author

Consolidation note: this PR was automatically marked merged when its exact validated head (3846114) was fast-forwarded into the base branch for #5557. No separate change landed on main; #5557 is now the sole open PR and contains the full three-agent implementation. This PR remains as review-history traceability.

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