Conversation
Co-authored-by: dongyuxin <dongyuxin@dev.dongyuxin.msh-dev.svc.cluster.local> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
…node-gyp path at build time (anomalyco#21040)
…ut to prevent confusion (anomalyco#21070)
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
There was a problem hiding this comment.
Pull request overview
Syncs the fork with upstream opencode through v1.3.15, updating package versions and integrating upstream changes such as Console org switching APIs/UI and the Effect-based read tool refactor.
Changes:
- Bump workspace/package versions to
1.3.15(incl. extensions + lockfile). - Add experimental Console endpoints + SDK bindings, and wire Console org/provider state into the TUI (including org switching dialog).
- Migrate
tool.readimplementation/tests to the Effect service graph and update ToolRegistry dependencies.
Reviewed changes
Copilot reviewed 46 out of 47 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/vscode/package.json | VS Code extension version bump to 1.3.15. |
| packages/web/src/content/docs/zen.mdx | Removes MiMo free model references from docs/pricing tables. |
| packages/web/package.json | Web package version bump to 1.3.15. |
| packages/util/package.json | Util package version bump to 1.3.15. |
| packages/ui/package.json | UI package version bump to 1.3.15. |
| packages/slack/package.json | Slack package version bump to 1.3.15. |
| packages/sdk/openapi.json | Adds experimental Console endpoints to OpenAPI spec. |
| packages/sdk/js/src/v2/gen/types.gen.ts | Adds generated types for new Console endpoints. |
| packages/sdk/js/src/v2/gen/sdk.gen.ts | Adds generated client methods for Console endpoints and repositions Tool client. |
| packages/sdk/js/package.json | SDK JS package version bump to 1.3.15. |
| packages/plugin/package.json | Plugin package version bump to 1.3.15. |
| packages/opencode/test/tool/read.test.ts | Refactors read tool tests to Effect-based harness/layers. |
| packages/opencode/test/session/compaction.test.ts | Expands tests for reasoning token separation and cost calculation. |
| packages/opencode/test/config/config.test.ts | Updates mocks to include new Account.activeOrg() behavior. |
| packages/opencode/src/tool/registry.ts | Adds required layers/services for effectified tools (ReadTool deps). |
| packages/opencode/src/tool/read.ts | Migrates ReadTool to Tool.defineEffect, using AppFileSystem/LSP/Instruction services. |
| packages/opencode/src/tool/external-directory.ts | Adds Effect wrapper + switches normalization helpers to AppFileSystem. |
| packages/opencode/src/session/prompt/kimi.txt | Removes “Skills” section content from Kimi prompt template. |
| packages/opencode/src/session/index.ts | Adjusts usage accounting to separate reasoning vs output tokens. |
| packages/opencode/src/server/routes/experimental.ts | Adds /experimental/console endpoints (get/list orgs/switch org). |
| packages/opencode/src/npm/index.ts | Sets Arborist ignoreScripts: true (safer installs). |
| packages/opencode/src/filesystem/index.ts | Improves Windows path normalization + adds normalizePathPattern. |
| packages/opencode/src/config/console-state.ts | Introduces ConsoleState schema + empty default. |
| packages/opencode/src/config/config.ts | Tracks console-managed providers + active org name in Config state; adds getter. |
| packages/opencode/src/cli/cmd/tui/util/provider-origin.ts | Adds labeling/helpers for Console-managed providers. |
| packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx | Adds categoryView rendering for richer category headers. |
| packages/opencode/src/cli/cmd/tui/context/sync.tsx | Fetches Console state via SDK and stores it in sync context. |
| packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx | Displays Console org + managed-provider indicator in prompt header; triggers org switch command. |
| packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx | Shows Console-managed providers in connect dialog with icon/footer; blocks selection. |
| packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx | Labels providers with Console-managed indicator in model dialog. |
| packages/opencode/src/cli/cmd/tui/component/dialog-console-org.tsx | Adds org-switching dialog calling new experimental endpoints. |
| packages/opencode/src/cli/cmd/tui/app.tsx | Adds “Switch org” command when multiple orgs are available. |
| packages/opencode/src/account/index.ts | Adds activeOrg() + changes org listing behavior to be more fault-tolerant. |
| packages/opencode/specs/effect-migration.md | Documents the transitional defineEffect pattern; marks read.ts migrated. |
| packages/opencode/script/build.ts | Marks node-gyp as external for build. |
| packages/opencode/package.json | Core opencode package version bump to 1.3.15. |
| packages/function/package.json | Function package version bump to 1.3.15. |
| packages/extensions/zed/extension.toml | Zed extension version + release asset URLs updated to v1.3.15. |
| packages/enterprise/package.json | Enterprise package version bump to 1.3.15. |
| packages/desktop/package.json | Desktop package version bump to 1.3.15. |
| packages/desktop-electron/package.json | Desktop Electron package version bump to 1.3.15. |
| packages/console/mail/package.json | Console mail package version bump to 1.3.15. |
| packages/console/function/package.json | Console function package version bump to 1.3.15. |
| packages/console/core/package.json | Console core package version bump to 1.3.15. |
| packages/console/app/package.json | Console app package version bump to 1.3.15. |
| packages/app/package.json | App package version bump to 1.3.15. |
| bun.lock | Lockfile updated for version bumps across workspace packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "x-codeSamples": [ | ||
| { | ||
| "lang": "js", | ||
| "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.get({\n ...\n})" | ||
| } |
There was a problem hiding this comment.
The x-codeSamples JS snippet is syntactically invalid: the import string is missing the closing quote after @opencode-ai/sdk (and the newline is inside the string). This will break generated docs/examples. Update the sample to a valid import (e.g. from "@opencode-ai/sdk") and keep newlines outside the string.
| "x-codeSamples": [ | ||
| { | ||
| "lang": "js", | ||
| "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.listOrgs({\n ...\n})" | ||
| } |
There was a problem hiding this comment.
The x-codeSamples JS snippet for experimental.console.listOrgs is syntactically invalid (missing closing quote in the import path, newline embedded in the string). Please fix the example string so it produces valid JS when rendered/copied.
| "requestBody": { | ||
| "content": { | ||
| "application/json": { | ||
| "schema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "accountID": { | ||
| "type": "string" | ||
| }, | ||
| "orgID": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "required": ["accountID", "orgID"] | ||
| } | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
/experimental/console/switch validates a JSON body with required accountID and orgID, but the OpenAPI requestBody is not marked as required. This causes generated clients to treat the body as optional and can lead to runtime 400s. Mark the requestBody as required (or adjust the route/validator if the body is truly optional).
| "x-codeSamples": [ | ||
| { | ||
| "lang": "js", | ||
| "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.switchOrg({\n ...\n})" | ||
| } |
There was a problem hiding this comment.
The x-codeSamples JS snippet for experimental.console.switchOrg is syntactically invalid (missing closing quote in the import path, newline embedded in the string). Fixing this in the OpenAPI spec will keep generated docs/examples usable.
| public switchOrg<ThrowOnError extends boolean = false>( | ||
| parameters?: { | ||
| directory?: string | ||
| workspace?: string | ||
| accountID?: string | ||
| orgID?: string | ||
| }, |
There was a problem hiding this comment.
Console.switchOrg() takes accountID/orgID as optional parameters, but the server route requires both fields (and the OpenAPI schema marks them required). The SDK method signature should require these fields so callers can’t accidentally invoke it with an invalid body.
| const stat = yield* fs.stat(filepath).pipe( | ||
| Effect.catchIf( | ||
| (err) => "reason" in err && err.reason._tag === "NotFound", | ||
| () => Effect.succeed(undefined), | ||
| ), | ||
| ) |
There was a problem hiding this comment.
The Effect.catchIf predicate uses "reason" in err without first verifying err is a non-null object. If a non-object is ever thrown/rejected, this predicate will itself throw a TypeError and mask the original error. Use a safer guard (similar to packages/opencode/src/storage/storage.ts:71-77) before using the in operator / accessing err.reason.
| const orgsByAccount = Effect.fn("Account.orgsByAccount")(function* () { | ||
| const accounts = yield* repo.list() | ||
| const [errors, results] = yield* Effect.partition( | ||
| return yield* Effect.forEach( | ||
| accounts, | ||
| (account) => orgs(account.id).pipe(Effect.map((orgs) => ({ account, orgs }))), | ||
| (account) => | ||
| orgs(account.id).pipe( | ||
| Effect.catch(() => Effect.succeed([] as readonly Org[])), | ||
| Effect.map((orgs) => ({ account, orgs })), | ||
| ), | ||
| { concurrency: 3 }, | ||
| ) |
There was a problem hiding this comment.
orgsByAccount() now swallows all per-account errors and returns an empty org list with no logging. This makes auth/network/config issues indistinguishable from “no orgs” and will also skew switchableOrgCount. Consider at least logging a warning (and ideally preserving the previous behavior of surfacing/collecting errors) when an account’s org fetch fails.
| total, | ||
| input: adjustedInputTokens, | ||
| output: outputTokens, | ||
| output: outputTokens - reasoningTokens, |
There was a problem hiding this comment.
output is computed as outputTokens - reasoningTokens without clamping. If a provider reports reasoning tokens separately (i.e. not included in outputTokens) or ever reports reasoningTokens > outputTokens, this becomes negative and will undercount cost. Consider guarding with Math.max(0, outputTokens - reasoningTokens) (or enforce/validate the invariant before subtracting).
| output: outputTokens - reasoningTokens, | |
| output: Math.max(0, outputTokens - reasoningTokens), |
| footer: consoleManaged ? sync.data.console_state.activeOrgName : undefined, | ||
| category: provider.id in PROVIDER_PRIORITY ? "Popular" : "Other", | ||
| gutter: consoleManaged ? ( | ||
| <text fg={theme.textMuted}>{CONSOLE_MANAGED_ICON}</text> | ||
| ) : connected ? ( | ||
| <text fg={theme.success}>✓</text> | ||
| ) : undefined, | ||
| async onSelect() { | ||
| if (consoleManaged) return | ||
|
|
There was a problem hiding this comment.
Selecting a Console-managed provider currently becomes a no-op (if (consoleManaged) return) while the option remains enabled. In the “Connect a provider” dialog this results in user-visible broken behavior (selection does nothing). Consider marking these options as disabled: true (with an explanatory description) or handling selection by showing a dialog explaining it’s managed via Console / taking the user to org switching.
…c workflow - Change opencode dependency from fixed "1.3.13" to "workspace:*" so upstream version bumps don't break bun install - Bump guardrails version to 1.3.15 - Fix upstream-sync workflow: detect merge conflicts properly, graceful fallback when PR creation lacks permissions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…endency The guardrails package now uses workspace:* instead of a pinned version to prevent bun install failures when upstream bumps the version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codex CLI セカンドオピニオンレビュー結果 (2026-04-05)ドリフトチェックフォーク独自の変更はIssueに対応する内容のみ(memory system, GLM fix, notifications, CI fixes)。 Codex 検出 → コード検証結果
PR #67 Copilot レビュー指摘 (9件)全てupstreamコード(sdk/openapi.json, sdk.gen.ts, read.ts, dialog-provider.tsx, session/index.ts, account/index.ts)への指摘。 |
What
Sync upstream anomalyco/opencode changes into fork (v1.3.13 → post-v1.3.15).
Why
Fork's dev build (
0.0.0-dev) can't auto-update becauseInstallation.method()returns"unknown".The only way to stay current is via git merge from upstream.
Closes #66
Changes
Upstream commits merged (workflows excluded):
release: v1.3.14+release: v1.3.15fix(npm): Arborist reify fails on compiled binary(fix(npm): Arborist reify fails on compiled binary — Bun pre-resolves node-gyp path at build time anomalyco/opencode#21040)fix: ensure reasoning tokens aren't double counted(fix: ensure reasoning tokens arent double counted when calculating usage anomalyco/opencode#21047)refactor(effect): move read tool onto defineEffect(refactor(effect): move read tool onto defineEffect anomalyco/opencode#21016)feat(tui): show console-managed providers(feat(tui): show console-managed providers anomalyco/opencode#20956)test: add regression test for double counting bug(test: add regression test for double counting bug anomalyco/opencode#21053)Test plan
bun testpasses with no regressions🤖 Generated with Claude Code