Skip to content

chore: sync upstream v1.3.15 - #67

Merged
terisuke merged 17 commits into
devfrom
chore/upstream-sync-20260405
Apr 5, 2026
Merged

chore: sync upstream v1.3.15#67
terisuke merged 17 commits into
devfrom
chore/upstream-sync-20260405

Conversation

@terisuke

@terisuketerisuke commented Apr 5, 2026

Copy link
Copy Markdown

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 because Installation.method() returns "unknown".
The only way to stay current is via git merge from upstream.

Closes#66

Changes

Upstream commits merged (workflows excluded):

Test plan

  • bun test passes with no regressions
  • Fork-specific features (memory system, GLM fix, notifications) work
  • Typecheck passes
  • Build produces working binary

🤖 Generated with Claude Code

CopilotAI review requested due to automatic review settings April 5, 2026 08:54
@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.read implementation/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
FileDescription
sdks/vscode/package.jsonVS Code extension version bump to 1.3.15.
packages/web/src/content/docs/zen.mdxRemoves MiMo free model references from docs/pricing tables.
packages/web/package.jsonWeb package version bump to 1.3.15.
packages/util/package.jsonUtil package version bump to 1.3.15.
packages/ui/package.jsonUI package version bump to 1.3.15.
packages/slack/package.jsonSlack package version bump to 1.3.15.
packages/sdk/openapi.jsonAdds experimental Console endpoints to OpenAPI spec.
packages/sdk/js/src/v2/gen/types.gen.tsAdds generated types for new Console endpoints.
packages/sdk/js/src/v2/gen/sdk.gen.tsAdds generated client methods for Console endpoints and repositions Tool client.
packages/sdk/js/package.jsonSDK JS package version bump to 1.3.15.
packages/plugin/package.jsonPlugin package version bump to 1.3.15.
packages/opencode/test/tool/read.test.tsRefactors read tool tests to Effect-based harness/layers.
packages/opencode/test/session/compaction.test.tsExpands tests for reasoning token separation and cost calculation.
packages/opencode/test/config/config.test.tsUpdates mocks to include new Account.activeOrg() behavior.
packages/opencode/src/tool/registry.tsAdds required layers/services for effectified tools (ReadTool deps).
packages/opencode/src/tool/read.tsMigrates ReadTool to Tool.defineEffect, using AppFileSystem/LSP/Instruction services.
packages/opencode/src/tool/external-directory.tsAdds Effect wrapper + switches normalization helpers to AppFileSystem.
packages/opencode/src/session/prompt/kimi.txtRemoves “Skills” section content from Kimi prompt template.
packages/opencode/src/session/index.tsAdjusts usage accounting to separate reasoning vs output tokens.
packages/opencode/src/server/routes/experimental.tsAdds /experimental/console endpoints (get/list orgs/switch org).
packages/opencode/src/npm/index.tsSets Arborist ignoreScripts: true (safer installs).
packages/opencode/src/filesystem/index.tsImproves Windows path normalization + adds normalizePathPattern.
packages/opencode/src/config/console-state.tsIntroduces ConsoleState schema + empty default.
packages/opencode/src/config/config.tsTracks console-managed providers + active org name in Config state; adds getter.
packages/opencode/src/cli/cmd/tui/util/provider-origin.tsAdds labeling/helpers for Console-managed providers.
packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsxAdds categoryView rendering for richer category headers.
packages/opencode/src/cli/cmd/tui/context/sync.tsxFetches Console state via SDK and stores it in sync context.
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsxDisplays Console org + managed-provider indicator in prompt header; triggers org switch command.
packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsxShows Console-managed providers in connect dialog with icon/footer; blocks selection.
packages/opencode/src/cli/cmd/tui/component/dialog-model.tsxLabels providers with Console-managed indicator in model dialog.
packages/opencode/src/cli/cmd/tui/component/dialog-console-org.tsxAdds org-switching dialog calling new experimental endpoints.
packages/opencode/src/cli/cmd/tui/app.tsxAdds “Switch org” command when multiple orgs are available.
packages/opencode/src/account/index.tsAdds activeOrg() + changes org listing behavior to be more fault-tolerant.
packages/opencode/specs/effect-migration.mdDocuments the transitional defineEffect pattern; marks read.ts migrated.
packages/opencode/script/build.tsMarks node-gyp as external for build.
packages/opencode/package.jsonCore opencode package version bump to 1.3.15.
packages/function/package.jsonFunction package version bump to 1.3.15.
packages/extensions/zed/extension.tomlZed extension version + release asset URLs updated to v1.3.15.
packages/enterprise/package.jsonEnterprise package version bump to 1.3.15.
packages/desktop/package.jsonDesktop package version bump to 1.3.15.
packages/desktop-electron/package.jsonDesktop Electron package version bump to 1.3.15.
packages/console/mail/package.jsonConsole mail package version bump to 1.3.15.
packages/console/function/package.jsonConsole function package version bump to 1.3.15.
packages/console/core/package.jsonConsole core package version bump to 1.3.15.
packages/console/app/package.jsonConsole app package version bump to 1.3.15.
packages/app/package.jsonApp package version bump to 1.3.15.
bun.lockLockfile updated for version bumps across workspace packages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1273 to +1277
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.get({\n ...\n})"
}

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +1344 to +1348
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.listOrgs({\n ...\n})"
}

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +1385 to +1402
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"accountID": {
"type": "string"
},
"orgID": {
"type": "string"
}
},
"required": ["accountID", "orgID"]
}
}
}
},

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

/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).

Copilot uses AI. Check for mistakes.
Comment on lines +1403 to +1407
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.switchOrg({\n ...\n})"
}

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +1053 to +1059
public switchOrg<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
accountID?: string
orgID?: string
},

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +104
const stat = yield* fs.stat(filepath).pipe(
Effect.catchIf(
(err) => "reason" in err && err.reason._tag === "NotFound",
() => Effect.succeed(undefined),
),
)

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines 302 to 312
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 },
)

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
total,
input: adjustedInputTokens,
output: outputTokens,
output: outputTokens - reasoningTokens,

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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).

Suggested change
output: outputTokens-reasoningTokens,
output: Math.max(0,outputTokens-reasoningTokens),

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +59
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

CopilotAIApr 5, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
terisukeand others added 2 commits April 5, 2026 18:02
…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>
@terisuke

Copy link
Copy Markdown
Author

Codex CLI セカンドオピニオンレビュー結果 (2026-04-05)

ドリフトチェック

フォーク独自の変更はIssueに対応する内容のみ(memory system, GLM fix, notifications, CI fixes)。
ただし upstream merge 由来の out-of-scope 変更(console/org-switching, tooling refactors)が含まれる — これは upstream 側の変更であり意図的に取り込んでいる。

Codex 検出 → コード検証結果

FindingCodex判定検証結果対応
npm ignoreScripts 削除HIGHFALSEignoreScripts: true は npm/index.ts:67,108 に存在対応不要(誤検出)
non-macOS notification focusMEDIUMTRUE — notification/index.ts:48Issue #68
parseFrontmatter 型バリデーションLOWTRUE — memory/file.ts:41Issue #69
repetition test 重複LOWTRUE — repetition.test.ts:8-23Issue #69
Token double-countingMEDIUMRESOLVED — upstream anomalyco#21047/anomalyco#21053 がこの sync に含まれる対応不要

PR #67 Copilot レビュー指摘 (9件)

全てupstreamコード(sdk/openapi.json, sdk.gen.ts, read.ts, dialog-provider.tsx, session/index.ts, account/index.ts)への指摘。
フォーク側で修正すべきものではなく、upstream に報告すべき内容。
CRITICAL/HIGH 指摘はゼロ。

@terisuke
terisuke merged commit e04eef8 into devApr 5, 2026
2 of 5 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: upstream sync to v1.3.15 — fix auto-update incompatibility

7 participants

@terisuke@kitlangton@Yuxin-Dong@thdxr@rekram1-node@fwang