Skip to content

Add OpenCode v2 support - #30

Merged
koltyakov merged 14 commits into
mainfrom
v2
Sep 17, 2026
Merged

koltyakov merged 14 commits into
mainfrom
v2

Conversation

@koltyakov

Copy link
Copy Markdown
Owner

No description provided.

Detect and adapt OpenCode v2 servers while retaining v1 compatibility. Prefer the v2 CLI by default, handle authenticated startup and v2 event projection, and let users copy legacy v1 sessions into v2.
Validate legacy service registrations through the authenticated status endpoint when newer client discovery rejects them.

Hide session sharing actions when the connected backend does not support sharing.
Render native skill and shell records as assistant tool activity, preserve compaction status, and keep internal generated instructions out of user-visible text.

Resync transcript records when related skill, shell, or compaction events arrive.
Recognize patch alongside apply_patch so pending and running calls display as Editing, remain outside shared activity summaries, and hand off streaming presentation immediately.
Recommend OpenCode v2 for new installs while preserving v1-specific setup and update paths.

Use type-local v2 content identities and reconcile combined prompts with attachment references so streamed and hydrated messages remain consistent.
Uppercase lowercase drive letters before sending OpenCode v2 location queries, with unit and integration coverage for Windows instruction loading.
Add a required action matrix for AI parity and regression runs across backends.

Clarify that switching from v1 to v2 may require restarting the active server and verifying the connected version.
Use PowerShell listener and read-only Restart Manager queries to verify database ownership on Windows, with platform-specific tests and documentation.
Preserve session-scoped Always approvals during Default-mode sends, apply hidden authentication defaults, and use step-start timestamps for request timing.

Classify v2 declined tool calls as permission rejections so they remain outside completed-work summaries.
Distinguish an expired running-tool window from a viewport that never reaches the bottom. Add browser coverage for tool completion during native smooth returns at two scroll distances.
Confirm the preconfigured full mode through the host snapshot and assert wildcard permissions are applied before the initial message is sent.
Increase perf suite timeouts for DOM setup under parallel load while retaining row, observer, and work-count assertions.
Select compatibility ceilings and upgrade packages from the detected API version.

Run Windows CLI replacements as VS Code tasks so the server reconnects when the command finishes, without waiting for the terminal to close. Ignore stale version reads across restarts and avoid displaying a guessed version during startup.
Copilot AI lite review requested due to automatic review settings September 17, 2026 23:15
@koltyakov
koltyakov merged commit 15532c1 into main Sep 17, 2026
3 of 4 checks passed
@koltyakov
koltyakov deleted the v2 branch September 17, 2026 23:15

Copilot AI 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.

🟡 Changes recommended

Four unresolved moderate or critical findings affect v2 import functionality, state deletion, Windows isolation, and scroll-return test validity.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds OpenCode v2 support while preserving v1 compatibility across transport, sessions, permissions, UI, migration, installation, reporting, and testing.

Changes:

  • Adds v2 adapters, event projection, authentication, and session handling.
  • Adds v1 history import and version-aware installation/update flows.
  • Expands UI, compatibility, Windows isolation, integration, and E2E coverage.
  • Review findings remain unresolved in the import command, session-state removal, Windows isolation tooling, and scroll-return E2E test.
File summaries
File Summary
src/webview/perf/message-list-virtualization.perf.test.ts Adjusts virtualization performance coverage.
src/webview/perf/assistant-message-content.perf.test.ts Adjusts performance test timing.
src/webview/lib/tool-normalization.ts Supports v2 patch tools.
src/webview/lib/state-session-lifecycle.ts Updates session marker handling.
src/webview/lib/state-session-lifecycle.markers.test.ts Tests marker behavior.
src/webview/lib/state-messages.ts Reconciles optimistic v2 messages.
src/webview/lib/state-messages.optimistic.test.ts Tests optimistic reconciliation.
src/webview/lib/skill-reference.ts Re-exports shared skill utilities.
src/webview/lib/bridge.ts Unwraps reactive data for transport.
src/webview/lib/bridge.test.ts Tests structured-clone transport.
src/webview/lib/assistant-activity.test.ts Tests declined-tool activity.
src/webview/hooks/useOpenCode.sessionState.test.ts Updates session fixtures.
src/webview/hooks/useOpenCode.sendMessage.test.ts Tests permission synchronization.
src/webview/hooks/session/session-send.ts Updates steering and permission handling.
src/webview/hooks/session/session-selection.ts Handles unavailable and legacy sessions.
src/webview/hooks/session/session-reasoning-events.ts Resolves v2 reasoning ownership.
src/webview/hooks/session/session-reasoning-events.test.ts Tests reasoning synchronization.
src/webview/hooks/session/session-projected-events.ts Corrects named event ownership.
src/webview/hooks/session/session-projected-events.test.ts Tests v2 event ownership.
src/webview/hooks/session/session-event-utils.ts Adds compaction synchronization.
src/webview/hooks/session/session-event-handlers.ts Handles v2 execution and compaction.
src/webview/hooks/session-send.test.ts Tests permission preservation.
src/webview/hooks/session-selection.test.ts Tests unavailable-session handling.
src/webview/hooks/session-event-handlers.test.ts Tests v2 event handling.
src/webview/hooks/runtime/open-code-runtime-instance.ts Preserves optimistic messages.
src/webview/components/ToolCall.tsx Renders v2 patch and skill tools.
src/webview/components/ToolCall.test.ts Tests v2 tool rendering.
src/webview/components/ServerStatus.tsx Adds installation guidance.
src/webview/components/ServerStatus.test.ts Updates installation assertions.
src/webview/components/ModelPicker.tsx Displays model release dates.
src/webview/components/ModelPicker.test.ts Tests release-date display.
src/webview/components/MessageList.presentation.test.ts Tests v2 streaming presentation.
src/webview/components/message/CompactionDivider.tsx Displays compaction states.
src/webview/components/message/CompactionDivider.test.tsx Tests compaction labels.
src/webview/components/Message.test.ts Tests v2 transcript rendering.
src/webview/components/ChatInput.tsx Normalizes model variants.
src/webview/components/ChatInput.test.ts Tests variant warnings.
src/webview/components/chat/SessionActionsMenu.tsx Hides unsupported sharing actions.
src/shared/skill-reference.ts Adds shared skill utilities.
src/shared/server-ownership.ts Persists server credentials.
src/shared/protocol.ts Adds legacy-import messaging.
src/shared/opencode-types.ts Extends v2 types.
src/shared/opencode-install.ts Adds v1/v2 install commands.
src/shared/opencode-install.test.ts Tests upgrade commands.
src/shared/opencode-compatibility.ts Adds v2 compatibility metadata.
src/shared/opencode-compatibility.test.ts Tests dependency detection.
src/shared/model-variant.ts Normalizes default variants.
src/shared/model-variant.test.ts Tests variant normalization.
src/shared/error-classification.ts Recognizes v2 permission errors.
src/shared/error-classification.test.ts Tests error classification.
src/extension/util/windows-cli-update.ts Runs Windows updates as tasks.
src/extension/util/windows-cli-update.test.ts Tests Windows update handling.
src/extension/util/webview-message.ts Validates import messages.
src/extension/util/webview-message.test.ts Tests command validation.
src/extension/util/webview-message.test-support.ts Adds import fixtures.
src/extension/usage-report-service.ts Merges v1/v2 usage data.
src/extension/usage-report-database.test.ts Tests usage reporting.
src/extension/sidebar-provider.ts Integrates imports and updates.
src/extension/sidebar-provider.permissions.test.ts Tests version status handling.
src/extension/sidebar-provider.messages.test.ts Tests update completion.
src/extension/sidebar-provider-utils.ts Parses v2 model routes.
src/extension/sidebar-provider-actions.ts Routes legacy imports.
src/extension/sidebar-provider-actions.test.ts Updates action fixtures.
src/extension/session-state-manager.ts Preserves v2 busy state.
src/extension/session-state-manager.test.ts Tests execution state.
src/extension/rest-proxy.test.ts Tests v2 configuration mappings.
src/extension/opencode-v2-session-state.ts Stores v2 annotations.
src/extension/opencode-v2-inbox.test.ts Tests pending v2 inputs.
src/extension/opencode-v2-events.ts Projects v2 events.
src/extension/opencode-startup.integration.test.ts Tests v2 startup.
src/extension/opencode-connection.ts Adds v2 detection and authentication.
src/extension/open-code-transport.test.ts Tests transport isolation.
src/extension/message-router.ts Routes import commands.
src/extension/message-router.test.ts Tests import routing.
src/extension/legacy-session-import.test.ts Tests session migration.
src/extension/extension-manifest.ts Caches API-family version limits.
src/extension/error-hub.ts Updates documentation links.
src/extension/error-hub.test.ts Tests documentation links.
src/extension/commands.ts Adds v1 import and version-aware updates.
src/extension/commands.test.ts Tests update ceilings.
scripts/windows-database-ownership.ps1 Inspects Windows ownership.
scripts/vscode-sandbox/suite.cjs Adds v2 sandbox expectations.
scripts/vscode-sandbox/run.mjs Adds v2 sandbox scenarios.
scripts/vscode-launch-process.mjs Verifies Windows processes.
scripts/opencode-compatibility/verified.json Updates compatibility metadata.
scripts/opencode-compatibility/run-adapters.mjs Adds dual-version testing.
scripts/opencode-compatibility/README.md Documents compatibility testing.
scripts/ai-test-isolation.test.mjs Tests Windows isolation.
scripts/ai-test-isolation.mjs Uses ownership evidence.
scripts/ai-streaming-selection.test.mjs Tests Windows ownership validation.
scripts/ai-streaming-selection.mjs Adds Windows ownership checks.
scripts/ai-fuzzy-activity.test.mjs Expands activity timing coverage.
README.md Documents v1/v2 support.
package.json Adds v2 dependencies and commands.
e2e/tests/server-status.spec.ts Updates provider documentation coverage.
e2e/tests/scroll-return-tool-completion.spec.ts Adds scroll-return coverage.
e2e/tests/scroll-activity-handoff.spec.ts Adds streaming patch coverage.
e2e/tests/error-states.spec.ts Tests installation guidance.
docs/permissions.md Documents version-specific permissions.
docs/permission-lifecycle.md Documents v2 approval persistence.
docs/opencode-version-bumps.md Documents dual-version maintenance.
docs/onboarding-verification.md Updates platform verification.
docs/development.md Updates development guidance.
docs/ai-fuzzy-verification.md Adds verification guidance.
docs/ai-action-matrix.md Adds AI action coverage.
CHANGELOG.md Records the v2 release.
AGENTS.md Adds parity testing guidance.
Review details

Suppressed comments (3)

e2e/tests/scroll-return-tool-completion.spec.ts:119

  • The recording loop runs before the Scroll to latest message button is clicked, so while the page is scrolled up nothing can change scrollTop and the loop consumes its 600-frame budget without observing the return. The click must happen before awaiting/starting this recording (while still arranging for the tool-completion event to fire during the return), otherwise the subsequent bottom and sample assertions cannot exercise the intended behavior.
    await button.click();
    const samples = await recording;

scripts/ai-streaming-selection.mjs:76

  • On native Windows, the PowerShell pipeline collapses a one-element @(...) collection when it is serialized as a property, so the normal case of exactly one database owner and one listener produces scalar databaseOwners/listeners values. readActiveSessions then rejects that valid evidence at the Array.isArray(...) check, making Windows isolation verification fail closed for every normal single-process server. Serialize these fields explicitly as arrays (or normalize and validate singleton values before this check).
    if (!Array.isArray(windows.listeners) || !Array.isArray(windows.databaseOwners) ||
        windows.databaseOwners.some((owner) => !Number.isSafeInteger(owner) || owner <= 0)) {

src/extension/opencode-v2-session-state.ts:58

  • remove only waits for the operation that is present when it starts, then deletes the file. An update that begins after that single lookup can still write a new annotation after the delete completes, leaving Varro-owned state for a session that was just removed. Serialize removal with the same per-session operation chain (or otherwise prevent updates after removal) so deletion is final.
  • Files reviewed: 124/125 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/extension/commands.ts Resolved
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.

2 participants