Skip to content

chore: upstream sync v1.4.3 (2026-04-10)#160

Merged
terisuke merged 31 commits intodevfrom
chore/upstream-sync-20260410
Apr 10, 2026
Merged

chore: upstream sync v1.4.3 (2026-04-10)#160
terisuke merged 31 commits intodevfrom
chore/upstream-sync-20260410

Conversation

@terisuke
Copy link
Copy Markdown

Summary

  • Merge 30 upstream commits from anomalyco/opencode dev branch
  • Includes v1.4.2 and v1.4.3 releases
  • Effect refactoring: SessionRunState, SessionRevert, Git service, tool registry extraction
  • Node 24 CI fix for ECONNRESET issues
  • Fast mode support, MCP OAuth redirect URI, TS LSP fix

Conflict Resolution

  • publish.yml: kept fork deletion (fork-only CI)
  • processor.ts: adopted upstream completeToolCall/failToolCall helpers + preserved fork memory extraction
  • prompt.ts: adopted upstream SessionRunState/SessionRevert services + preserved fork hook injection
  • harness.ts: added new service layer dependencies (SessionRunState, SessionRevert, Skill)

Verification

  • typecheck passes (all 13 packages)
  • Fork-only paths protected by .gitattributes merge=ours
  • No conflict markers remaining

Test plan

  • CI unit tests pass
  • CI typecheck passes
  • Binary launch + plugin load verification post-merge

🤖 Generated with Claude Code

kitlangton and others added 30 commits April 9, 2026 10:54
…alyco#21385)

Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
The CLI imports every top-level command before argument parsing has
decided which handler will run. This makes simple invocations pay for
the full command graph up front and slows down the default startup path.

Parse the root argv first and load only the command module that matches
the selected top-level command. Keep falling back to the default TUI
path for non-command positionals, and preserve root help, version and
completion handling
…ry hack (anomalyco#21749)

Co-authored-by: OpeOginni <brightoginni123@gmail.com>
Beta releases no longer trigger unnecessary Winget submissions, and release
finalization now completes even when some build artifacts are missing.
Skip Windows and Linux code signing, along with artifact downloads for
the beta branch to ensure beta builds don't go through production
release processes.
Ensures users on the prod channel have their data persisted to the same
database as latest and beta channels, preventing data fragmentation
across different release channels.
Merge 30 upstream commits including:
- v1.4.2 and v1.4.3 releases
- Effect refactoring: SessionRunState, SessionRevert, Git service, tool registry
- Session sharing orchestration extraction
- Node 24 CI fix for ECONNRESET
- TS LSP fix, Windows e2e SIGTERM fix
- Fast mode support, MCP OAuth redirect URI

Conflicts resolved:
- publish.yml: kept fork deletion (fork-only CI)
- processor.ts: adopted completeToolCall/failToolCall + kept memory extraction
- prompt.ts: adopted SessionRunState/SessionRevert + kept hook injection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 10, 2026 12:53
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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

@github-actions
Copy link
Copy Markdown

New PR opened -- automated review will run on the next push.

To trigger a manual review, comment /review on this PR.

@github-actions
Copy link
Copy Markdown

Workflow files modified -- verify upstream compatibility

The following workflow files were changed in this PR:

  • .github/workflows/test.yml

Before merging, please verify:

  • Changes do not break upstream sync (upstream-sync.yml restores our workflows on merge)
  • New workflows use pull_request_target (not pull_request) for fork compatibility
  • Runner is set to ubuntu-latest (not blacksmith or other custom runners)
  • No secrets are exposed in workflow logs

@github-actions
Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@terisuke terisuke merged commit fde1af0 into dev Apr 10, 2026
13 of 14 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

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 anomalyco/opencode through v1.4.3, bringing in the latest service refactors (session run-state/revert/share), tool registry extraction, MCP OAuth redirect support, CI Node 24 fixes, and assorted SDK/spec/test updates.

Changes:

  • Refactors session orchestration by introducing SessionRunState and moving sharing into a dedicated SessionShare service.
  • Extracts dynamic tool descriptions (task/skill) into ToolRegistry and updates affected tests/layers.
  • Adds MCP OAuth redirectUri support (config + OpenAPI/SDK) and updates CI to run actions under Node 24.

Reviewed changes

Copilot reviewed 77 out of 78 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
specs/v2/session.md Adds v2 note to remove dedicated session.init route in favor of normal /init command flow.
sdks/vscode/package.json Bumps VS Code extension version to 1.4.3.
packages/web/package.json Bumps web package version to 1.4.3.
packages/util/package.json Bumps util package version to 1.4.3.
packages/ui/package.json Bumps UI package version to 1.4.3.
packages/slack/package.json Bumps Slack package version to 1.4.3.
packages/sdk/openapi.json Updates OpenAPI schemas/events and adds MCP OAuth redirectUri.
packages/sdk/js/src/v2/index.ts Cleans up v2 SDK exports for data.
packages/sdk/js/src/v2/gen/types.gen.ts Regenerates SDK types to match updated OpenAPI/events and MCP OAuth config.
packages/sdk/js/package.json Bumps JS SDK version to 1.4.3.
packages/plugin/package.json Bumps plugin package version to 1.4.3.
packages/opencode/test/tool/task.test.ts Updates tests to use ToolRegistry for tool descriptions and adds registry layer deps.
packages/opencode/test/tool/skill.test.ts Updates skill tool description tests to use ToolRegistry.
packages/opencode/test/storage/storage.test.ts Provides Git.defaultLayer to storage tests after Git service dependency introduction.
packages/opencode/test/session/snapshot-tool-race.test.ts Adds new service-layer dependencies (SessionRunState, SessionRevert, Skill) to test harness wiring.
packages/opencode/test/session/prompt-effect.test.ts Updates prompt tests for SessionRunState busy assertions, adds new cancel/truncation coverage, and wires new layers.
packages/opencode/test/session/compaction.test.ts Adopts updated SessionProcessor handle interface in test fakes.
packages/opencode/test/server/session-actions.test.ts Updates busy assertions to spy on SessionRunState.assertNotBusy.
packages/opencode/test/scenario/harness.ts Wires new session services (SessionRunState, SessionRevert) and Skill into scenario harness.
packages/opencode/test/provider/provider.test.ts Adds coverage for fast-mode cost merging / over-200k pricing preservation.
packages/opencode/test/mcp/oauth-callback.test.ts Adds tests for redirect URI parsing and callback server startup with custom port/path.
packages/opencode/test/lsp/index.test.ts Removes tests tied to previous TypeScript LSP argument wiring.
packages/opencode/test/file/watcher.test.ts Provides Git.defaultLayer to file watcher tests.
packages/opencode/test/effect/runner.test.ts Updates runner tests for new startShell signature/cancel semantics.
packages/opencode/src/worktree/index.ts Makes worktree service depend on Git.Service and uses service methods instead of static helpers.
packages/opencode/src/tool/task.ts Removes standalone dynamic description helper (moved into registry).
packages/opencode/src/tool/skill.ts Removes standalone dynamic description helper (moved into registry).
packages/opencode/src/tool/registry.ts Centralizes dynamic tool descriptions (task/skill) and updates registry layering/deps.
packages/opencode/src/storage/storage.ts Updates migrations to accept Git.Interface and provides Git in default layer/runtime.
packages/opencode/src/storage/db.ts Treats prod like stable channels for db path selection.
packages/opencode/src/share/share-next.ts Improves event watcher typing and removes shared sessions on Session.Event.Deleted.
packages/opencode/src/share/session.ts Introduces SessionShare service to encapsulate create/share/unshare + auto-share behavior.
packages/opencode/src/session/todo.ts Removes exported Todo.update wrapper (service-only API).
packages/opencode/src/session/summary.ts Switches default layer construction to Layer.suspend.
packages/opencode/src/session/status.ts Exports SessionStatus.defaultLayer (used by new run-state service).
packages/opencode/src/session/run-state.ts Adds new per-session runner coordination service (busy/idle/cancel/ensureRunning/startShell).
packages/opencode/src/session/revert.ts Refactors revert logic to depend on SessionRunState.assertNotBusy and updates default layer wiring.
packages/opencode/src/session/prompt.ts Moves concurrency control to SessionRunState, adopts new processor tool-call helpers, and updates layering.
packages/opencode/src/session/processor.ts Adds updateToolCall / completeToolCall helpers and tool-call lifecycle tracking to reduce races.
packages/opencode/src/session/index.ts Removes in-service share/unshare/initialize; adds getPart; updates DB schema imports and layering deps.
packages/opencode/src/session/compaction.ts Switches default layer construction to Layer.suspend and removes exported process wrapper.
packages/opencode/src/server/routes/session.ts Routes now use SessionShare and SessionRunState; keeps /session/:id/init as compatibility wrapper with TODO for v2 removal.
packages/opencode/src/pty/index.ts Removes exported resize wrapper (service-only API).
packages/opencode/src/provider/provider.ts Adds model “mode” variants and cost merging, preserving over-200k pricing.
packages/opencode/src/provider/models.ts Extends models.dev schema to support experimental modes with per-mode cost/provider overrides.
packages/opencode/src/project/vcs.ts Refactors VCS instance-state initialization for clarity (same behavior).
packages/opencode/src/plugin/codex.ts Updates provider model filtering to match against API model IDs.
packages/opencode/src/mcp/oauth-provider.ts Adds MCP OAuth redirectUri support and exposes parseRedirectUri.
packages/opencode/src/mcp/oauth-callback.ts Allows callback server to bind to redirectUri-derived port/path and reconfigure if needed.
packages/opencode/src/mcp/index.ts Plumbs redirectUri through OAuth flow and ensures callback server starts with configured redirectUri.
packages/opencode/src/lsp/server.ts Simplifies TypeScript LSP spawn args to --stdio.
packages/opencode/src/git/index.ts Removes several top-level convenience wrappers, keeping run/defaultBranch exports.
packages/opencode/src/file/watcher.ts Uses Git.Service to resolve git dir and provides Git in default layer.
packages/opencode/src/file/index.ts Uses Git.Service for status/diff/show and provides Git in default layer.
packages/opencode/src/effect/runner.ts Changes startShell API to take an Effect directly and simplifies shell cancellation.
packages/opencode/src/effect/instance-state.ts Removes withALS helper (no remaining references found).
packages/opencode/src/effect/cross-spawn-spawner.ts Removes unused runPromise export (keeps runPromiseExit).
packages/opencode/src/config/config.ts Adds MCP OAuth redirectUri to config schema/docs.
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx Changes default scrollbar visibility to false.
packages/opencode/src/cli/cmd/mcp.ts Plumbs OAuth redirectUri through MCP debug command.
packages/opencode/src/cli/cmd/github.ts Uses SessionShare.share instead of Session.share.
packages/opencode/src/agent/agent.ts Adjusts OpenAI OAuth agent creation to avoid system messages and pass instructions via provider options; switches layer construction to Layer.suspend.
packages/opencode/src/account/index.ts Removes several exported wrappers (service-only API surface).
packages/opencode/package.json Bumps opencode package version to 1.4.3.
packages/function/package.json Bumps function package version to 1.4.3.
packages/extensions/zed/extension.toml Bumps Zed extension version and release asset URLs to v1.4.3.
packages/enterprise/package.json Bumps enterprise package version to 1.4.3.
packages/desktop/scripts/finalize-latest-json.ts Fixes env var check and makes missing latest.json a graceful no-op.
packages/desktop/package.json Bumps desktop package version to 1.4.3.
packages/desktop-electron/package.json Bumps desktop-electron package version to 1.4.3.
packages/console/mail/package.json Bumps console mail package version to 1.4.3.
packages/console/function/package.json Bumps console function package version to 1.4.3.
packages/console/core/package.json Bumps console core package version to 1.4.3.
packages/console/app/package.json Bumps console app package version to 1.4.3.
packages/app/package.json Bumps app package version to 1.4.3.
packages/app/e2e/backend.ts Improves backend process “done” detection to include signal termination.
bun.lock Updates workspace package versions to 1.4.3.
.github/workflows/test.yml Forces GitHub JS actions onto Node 24 and explicitly sets up Node 24 in CI jobs.

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

Comment on lines +210 to 214
validator("json", Session.create.schema),
async (c) => {
const body = c.req.valid("json") ?? {}
const session = await Session.create(body)
const session = await SessionShare.create(body)
return c.json(session)
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

POST /session now validates the request body with Session.create.schema (non-optional), but the handler still treats the body as optional (c.req.valid("json") ?? {}). This will reject requests with no JSON body and is a breaking API change vs the previous behavior. Consider switching the validator back to Session.create.schema.optional() (or provide a default in the validator) so empty-body creates continue to work.

Copilot uses AI. Check for mistakes.
Comment on lines 7667 to 7671
}
},
"required": ["sessionID"]
}
}
},
"required": ["type", "properties"]
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

In the OpenAPI schema for Event.session.error, the nested properties object does not declare any required fields, so error becomes optional in the spec. The server-side event schema (Session.Event.Error) requires error (only sessionID is optional), so the OpenAPI should include required: ["error"] inside the event's properties schema to match actual behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +203 to 215
export type EventSessionError = {
type: "session.error"
properties: {
sessionID: string
sessionID?: string
error?:
| ProviderAuthError
| UnknownError
| MessageOutputLengthError
| MessageAbortedError
| StructuredOutputError
| ContextOverflowError
| ApiError
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

EventSessionError.properties marks both sessionID and error as optional, but the runtime event schema requires error (only sessionID is optional). This makes the generated SDK types looser than reality and can hide missing-field regressions. Regenerate/fix the types so error is required (and keep sessionID optional if intended).

Copilot uses AI. Check for mistakes.
Comment on lines +461 to +474
const getPart: Interface["getPart"] = Effect.fn("Session.getPart")(function* (input) {
const row = Database.use((db) =>
db
.select()
.from(PartTable)
.where(
and(
eq(PartTable.session_id, input.sessionID),
eq(PartTable.message_id, input.messageID),
eq(PartTable.id, input.partID),
),
)
.get(),
)
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Session.getPart performs a DB query via Database.use(...) directly inside the Effect generator, unlike other queries in this module which go through the local db(...) helper (Effect.sync(() => Database.use(...))). For consistency (and to keep DB access inside Effect boundaries/spans), consider switching this to yield* db((d) => ...) like the rest of the file.

Copilot uses AI. Check for mistakes.
Comment on lines 9 to 12
import { Config } from "../config/config"
import { Permission } from "@/permission"
import { Effect } from "effect"
import { Log } from "@/util/log"

Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Log is imported here but not used anywhere in this file. Consider removing the import to avoid unused-code drift.

Copilot uses AI. Check for mistakes.
Comment on lines +195 to +205
export function parseRedirectUri(redirectUri?: string): { port: number; path: string } {
if (!redirectUri) {
return { port: OAUTH_CALLBACK_PORT, path: OAUTH_CALLBACK_PATH }
}

try {
const url = new URL(redirectUri)
const port = url.port ? parseInt(url.port, 10) : url.protocol === "https:" ? 443 : 80
const path = url.pathname || OAUTH_CALLBACK_PATH
return { port, path }
} catch {
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

parseRedirectUri derives a port/path from any URL (including non-local hosts and https: defaulting to port 443). Since McpOAuthCallback always binds a local HTTP server on 127.0.0.1, allowing a remote hostname or privileged ports can produce a redirect URL that the local callback server can never receive (or fail to bind). Consider validating that the redirect URI is http(s)://127.0.0.1 or http(s)://localhost (and that the port is safe), otherwise fall back to defaults or throw a clear config error.

Copilot uses AI. Check for mistakes.
Sign up for free to 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.

8 participants