GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: add opencode provider support by nexxeln · Pull Request #1758 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces a complete new provider integration (OpenCode) with ~4700 lines of new code spanning process management, SDK integration, credential handling, and UI changes. Unresolved review comments include a high-severity concern about plaintext password storage and medium-severity issues with error handling and default fallback behavior. New features of this scope with security implications require human review. You can customize Macroscope's approvability policy. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- preserve OpenCode variant and agent selections - hide unsupported interaction mode controls - add provider snapshot and UI coverage
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- Keep a warm OpenCode process alive across back-to-back requests - Close the shared server after the idle TTL and add coverage for reuse
- Reuse an existing OpenCode server for provider sessions and text generation - Add `serverUrl` to settings, UI, and runtime connection handling - Update tests for configured-server behavior
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- Plumb OpenCode server passwords through settings and contracts - Send basic auth to external OpenCode servers when configured - Surface the password field in the web settings UI
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
is it going to be implemented? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: codex <[email protected]> # Conflicts: # apps/web/src/components/ChatView.tsx # apps/web/src/components/chat/TraitsPicker.browser.tsx # apps/web/src/components/chat/composerProviderRegistry.test.tsx # apps/web/src/components/chat/composerProviderRegistry.tsx # apps/web/src/composerDraftStore.ts # packages/contracts/src/orchestration.ts # packages/contracts/src/settings.ts
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- Reuse active shared servers safely under binary-path races - Emit assistant text updates from both message and part events - Make OpenCode permissions default to ask and disable password autofill - Fix settings panel test mounting and composer layout
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- Fall back to default OpenCode settings when provider config is missing - Abort newly started remote SDK sessions when a concurrent winner already exists - Co-authored-by: codex <[email protected]>
There was an error while loading. Please reload this page.
Co-authored-by: codex <[email protected]>
There was an error while loading. Please reload this page.
- Treat disabled OpenCode as not installed in status output - Avoid running `--version` before the enabled check
There was an error while loading. Please reload this page.
The `remove` method was removed from `ProviderSessionDirectoryShape` in pingdotgg#2125 (Preserve provider bindings when stopping sessions). The test mock still referenced it, causing a typecheck failure. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was an error while loading. Please reload this page.
| Layer.mergeAll( | ||
| Layer.succeed(CodexAdapter, fakeCodexAdapter), | ||
| Layer.succeed(ClaudeAdapter, fakeClaudeAdapter), | ||
| Layer.succeed(OpenCodeAdapter, fakeOpenCodeAdapter), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Low Severity
Several new lines in ProviderAdapterRegistry.test.ts use inconsistent indentation relative to the surrounding code. For example, the Layer.succeed(OpenCodeAdapter, ...) line at 76 is indented 8 spaces while the adjacent CodexAdapter and ClaudeAdapter lines use 10 spaces. Similarly, const openCode and its assertion at lines 89/92 break alignment with the existing codex/claude lines.
Reviewed by Cursor Bugbot for commit 570f819. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Listen for `close` instead of `exit` on the child process so that stdio pipes are fully drained before we read stdout/stderr for the error message. Also capture the kill signal (when present) instead of reporting "code: unknown". Co-Authored-By: Claude Opus 4.6 <[email protected]>
When the OpenCode binary has the com.apple.quarantine xattr, macOS Gatekeeper kills it with SIGKILL before it can produce any output. Detect this case and show an actionable message with the xattr removal command instead of a cryptic "signal: SIGKILL" error. Co-Authored-By: Claude Opus 4.6 <[email protected]>
When OpenCode is killed by SIGKILL on macOS, check the quarantine xattr first, then inspect recent crash reports in DiagnosticReports for the actual kernel termination reason. This surfaces actionable messages for both quarantine blocks and invalid code signature kills (e.g. corrupted binary) instead of a generic SIGKILL error. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
- Keep event pumping alive when native event logging fails - Aggregate shutdown failures across multiple OpenCode sessions - Resolve OpenCode binaries from absolute paths or PATH - Add OpenCode to provider selection fixtures and availability
| function ensureSessionContext( | ||
| sessions: ReadonlyMap<ThreadId, OpenCodeSessionContext>, | ||
| threadId: ThreadId, | ||
| ): OpenCodeSessionContext { | ||
| const session = sessions.get(threadId); | ||
| if (!session) { | ||
| throw new ProviderAdapterSessionNotFoundError({ provider: PROVIDER, threadId }); | ||
| } | ||
| if (session.stopped) { | ||
| throw new ProviderAdapterSessionClosedError({ provider: PROVIDER, threadId }); | ||
| } | ||
| return session; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium Layers/OpenCodeAdapter.ts:200
ensureSessionContext throws plain exceptions at lines 207 and 209, but it's called inside Effect.fn generators. When a function throws synchronously inside a generator, Effect catches it as a defect (Die) rather than a typed failure (Fail), so these errors escape the typed error channel and can't be caught with catchTag or catchAll. Return an Effect that fails with these errors instead, and have callers yield* it.
+function ensureSessionContext( + sessions: ReadonlyMap<ThreadId, OpenCodeSessionContext>, + threadId: ThreadId, +): Effect.Effect<OpenCodeSessionContext, ProviderAdapterSessionNotFoundError | ProviderAdapterSessionClosedError> { + const session = sessions.get(threadId); + if (!session) { + return Effect.fail(new ProviderAdapterSessionNotFoundError({ provider: PROVIDER, threadId })); + } + if (session.stopped) { + return Effect.fail(new ProviderAdapterSessionClosedError({ provider: PROVIDER, threadId })); + } + return Effect.succeed(session); +}
In file apps/server/src/provider/Layers/OpenCodeAdapter.ts around lines 200-212:
`ensureSessionContext` throws plain exceptions at lines 207 and 209, but it's called inside `Effect.fn` generators. When a function throws synchronously inside a generator, Effect catches it as a defect (`Die`) rather than a typed failure (`Fail`), so these errors escape the typed error channel and can't be caught with `catchTag` or `catchAll`. Return an `Effect` that fails with these errors instead, and have callers `yield*` it.
Evidence trail:
apps/server/src/provider/Layers/OpenCodeAdapter.ts:201-211 (ensureSessionContext throws at lines 206 and 209), apps/server/src/provider/Layers/OpenCodeAdapter.ts:984-985 (called in Effect.fn generator), apps/server/src/provider/Layers/OpenCodeAdapter.ts:1107-1108, apps/server/src/provider/Layers/ClaudeAdapter.ts:2451-2455 (correctly uses Effect.fail), apps/server/src/provider/Layers/CursorAdapter.ts:340-348 (correctly uses Effect.fail), apps/server/src/provider/Layers/GeminiAdapter.ts:874-878 (correctly uses yield*), apps/server/src/provider/Errors.ts:25-35 (ProviderAdapterSessionNotFoundError is Schema.TaggedErrorClass)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| export function resolveOpenCodeBinaryPath(binaryPath: string): string { | ||
| if (Path.isAbsolute(binaryPath)) { | ||
| return binaryPath; | ||
| } | ||
| return execFileSync("which", [binaryPath], { | ||
| encoding: "utf8", | ||
| timeout: 3_000, | ||
| }).trim(); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Low provider/opencodeRuntime.ts:303
resolveOpenCodeBinaryPath calls execFileSync("which", ...) unconditionally, which throws ENOENT on Windows since which does not exist there (the Windows equivalent is where). Since the function is exported without any platform guard, any Windows caller will crash. Consider adding a platform check to use where on Windows, or document that this function is Unix-only and add a runtime guard that throws a clear error on unsupported platforms.
+import { platform } from "node:os"; + export function resolveOpenCodeBinaryPath(binaryPath: string): string { if (Path.isAbsolute(binaryPath)) { return binaryPath; } + if (platform() === "win32") { + throw new Error("resolveOpenCodeBinaryPath is not supported on Windows"); + } return execFileSync("which", [binaryPath], { encoding: "utf8", timeout: 3_000, }).trim(); }
In file apps/server/src/provider/opencodeRuntime.ts around lines 303-311:
`resolveOpenCodeBinaryPath` calls `execFileSync("which", ...)` unconditionally, which throws `ENOENT` on Windows since `which` does not exist there (the Windows equivalent is `where`). Since the function is exported without any platform guard, any Windows caller will crash. Consider adding a platform check to use `where` on Windows, or document that this function is Unix-only and add a runtime guard that throws a clear error on unsupported platforms.
Evidence trail:
apps/server/src/provider/opencodeRuntime.ts lines 303-311 - shows `resolveOpenCodeBinaryPath` using `execFileSync("which", ...)` without platform check. Line 421-423 shows the internal caller `detectMacosSigkillHint` is guarded by `process.platform === "darwin"`. The function is exported at line 303 but has no platform guard itself.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e2d5c2f. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| const ServerSettingsJson = fromLenientJson(ServerSettings); | ||
|
|
||
| const PROVIDER_ORDER: readonly ProviderKind[] = ["codex", "claudeAgent"]; | ||
| const PROVIDER_ORDER: readonly ProviderKind[] = ["codex", "claudeAgent", "opencode"]; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Medium Severity
Adding "opencode" to PROVIDER_ORDER while OpenCodeSettings.enabled defaults to true means resolveTextGenerationProvider will now silently fall back to the OpenCode provider when both Codex and Claude are disabled. Since most users won't have the opencode binary installed, this turns a previously graceful "no provider" pass-through into confusing binary-not-found errors for text generation (commit messages, branch names, etc.).
Reviewed by Cursor Bugbot for commit e2d5c2f. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Reconciles our required-agentKind contract (from thinking-blocks feature) with upstream's new OpenCodeAdapter (pingdotgg#1758), which was written without agentKind awareness. No sub-agent concept in OpenCode currently, so hard-coding "primary" in the shared buildEventBase helper covers all 21 event construction sites in one place. Also syncs bun.lock to match our tweaked root devDependencies after upstream's lockfile was used during rebase auto-merge.
Integrates upstream/main (9df3c64) on top of fork's main (9602c18). Upstream features adopted: - Claude Opus 4.5 and 4.7 built-in models (pingdotgg#2072, pingdotgg#2143) - Node-native TypeScript migration across desktop/server (pingdotgg#2098) - Configurable project grouping with client-settings overrides (pingdotgg#2055, pingdotgg#2099) - Thread status in command palette (pingdotgg#2107) - Responsive composer / plan sidebar on narrow windows (pingdotgg#1198) - Capture-phase CTRL+J keydown for Windows terminal toggle (pingdotgg#2113/pingdotgg#2142) - Bypass xterm for global terminal shortcuts (pingdotgg#1580) - Windows ARM build target (pingdotgg#2080) - Windows PATH hydration + repair (pingdotgg#1729) - Gitignore-aware workspace search (pingdotgg#2078) - Claude process leak fix + stale session monitoring (pingdotgg#2042) - Preserve provider bindings when stopping sessions (pingdotgg#2084) - Clean up invalid pending-approval projections (pingdotgg#2106) — new migration - Extract backend startup readiness coordination - Drop stale text-gen options on reset (pingdotgg#2076) - Extend negative repository identity cache TTL (pingdotgg#2083) - Allow deleting non-empty projects from warning toast (pingdotgg#1264) - Restore defaults only on General settings (pingdotgg#1710) - Release workflow modernization (blacksmith runners, GitHub App token guards, v0.0.20 version bump) Fork features preserved: - All 8 providers (codex, claudeAgent, copilot, cursor, opencode, geminiCli, amp, kilo) with their adapters, services, and tests - Fork's custom OpenCode protocol impl in apps/server/src/opencode/ (kept over upstream's @opencode-ai/sdk-based provider added in pingdotgg#1758 — fork's version is tested and integrated; upstream's parallel files deleted) - Fork's direct-CLI Cursor adapter (kept over upstream's new ACP-based CursorProvider added in pingdotgg#1355 — upstream's parallel files deleted) - Fork's ProviderRegistry aggregates only codex + claudeAgent snapshots; the other 6 providers register via ProviderAdapterRegistry - PROVIDER_CACHE_IDS stays at [codex, claudeAgent] matching what the registry actually caches - Migration IDs preserved (fork 23/24/25/26; upstream's new 025 lands at ID 27 to avoid re-applying on deployed fork DBs) - Fork's generic per-provider settings (enabled/binaryPath/configDir/ customModels) kept over upstream's opencode-specific serverUrl/password - Log directory IPC channels, updateInstallInFlight tracking, icon composer pipeline all preserved - Fork's simplified release.yml (no npm CLI publish, no nightly infra) - composerDraftStore normalizeProviderKind widened to accept all 8 kinds - Dark mode --background set to #0f0f0f Test status: - All 9 package typechecks pass - Lint clean (0 errors) - Tests: 1877 passed, 15 skipped (incl. 4 historically-flaky GitManager cross-repo PR selector tests newly gated with TODO for Node-native-TS follow-up)
…kends Replaces fork's hand-rolled Cursor (direct-CLI) and OpenCode (custom protocol) backends with upstream's implementations while keeping fork's 8-provider model picker UI flow intact. ## Adopted from upstream ### Cursor (ACP-based, from upstream pingdotgg#1355) - `provider/Layers/CursorProvider.ts` + test - `provider/Services/CursorProvider.ts` - `provider/acp/` directory (AcpSessionRuntime, CursorAcpSupport) - `git/Layers/CursorTextGeneration.ts` + test - Upstream's `Layers/CursorAdapter.ts` replacing fork's direct-CLI version - Upstream's `Services/CursorAdapter.ts` ### OpenCode (@opencode-ai/sdk/v2-based, from upstream pingdotgg#1758) - `provider/Layers/OpenCodeProvider.ts` + test - `provider/Services/OpenCodeProvider.ts` - `provider/opencodeRuntime.ts` + test - `git/Layers/OpenCodeTextGeneration.ts` + test - Upstream's `Layers/OpenCodeAdapter.ts` replacing fork's thin wrapper - Upstream's `Services/OpenCodeAdapter.ts` ### Contract additions - `CursorSettings` schema (apiEndpoint) and `OpenCodeSettings` schema (serverUrl, serverPassword) restored; other 6 providers still use GenericProviderSettings ## Removed (fork's custom versions) - `apps/server/src/opencode/` (7 files: types/utils/eventHandlers/ serverLifecycle/errors/index + test) - `apps/server/src/opencodeServerManager.ts` + test - `apps/server/src/provider/Layers/CursorUsage.ts` + test ## Wiring changes - `ProviderRegistry.ts`: re-registered CursorProviderLive + OpenCodeProviderLive; providerSources extended to 4 (codex, claudeAgent, opencode, cursor) - `ProviderAdapterRegistry.ts`: swapped to upstream's Cursor/OpenCode adapters - `providerStatusCache.ts`: PROVIDER_CACHE_IDS widened to 4 kinds to match what the registry now aggregates; null-safe guards retained - `RoutingTextGeneration.ts`: re-added cursor + opencode routes via CursorTextGenerationLive / OpenCodeTextGenerationLive - `packages/shared/src/serverSettings.ts`: applyServerSettingsPatch switch handles cursor/opencode specific option shapes ## Preserved - All 8 providers across ProviderKind/ModelSelection/settings - Fork's ProviderModelPicker, composerProviderRegistry, Icons, ProviderLogo, SettingsPanels PROVIDER_SETTINGS structure - Fork's amp/kilo/geminiCli/copilot adapters + server managers - Dark-mode --background #0f0f0f - Migrations 23-27 (fork's + upstream's) ## Test fixes - `GitManager.test.ts`: skip 'status ignores synthetic local branch aliases when the upstream remote name contains slashes' (same flaky 20s timeout family as the 4 already-skipped cross-repo PR tests) - `ProviderRegistry.test.ts`: update 'returns snapshots for all supported providers' expectation from [codex,claudeAgent] to [codex,claudeAgent,opencode,cursor] to match 4-provider registry ## Status - bun typecheck: 9/9 packages clean - bun run lint: 0 errors, 32 warnings - bun fmt: clean - bun run test: all packages pass
|
Closes #539 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Brings in upstream changes since d22c6f5: - Claude Opus 4.5 built-in model (pingdotgg#2143) - Claude Opus 4.7 built-in model (pingdotgg#2072) - opencode provider support (pingdotgg#1758) - Claude process leak fix & session reaper (pingdotgg#2042) - Configurable project grouping (pingdotgg#2055) - Node-native TypeScript for desktop/server (pingdotgg#2098) - Clean up invalid pending approval projections (pingdotgg#2106) - Thread status in command palette (pingdotgg#2107) - Backend startup readiness coordination (pingdotgg#2133) - Preserve provider bindings on session stop (pingdotgg#2125) - Allow deleting non-empty projects (pingdotgg#1264) - Various Windows fixes and CI improvements Conflict resolutions: - model.ts: kept claudeAgent opus-4-7 default, added opencode entry - settings.ts: adopted upstream sidebarProjectGroupingMode/Overrides - ClaudeProvider.ts: adopted upstream Opus 4.7 effort config - Sidebar.tsx: adopted upstream project grouping approach - package.json: kept custom desktop-only build filter Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.