Skip to content

feat(agents): support OpenCode 2.x config, telemetry and session analytics - #627

Open
Siarhei-Yarkavy wants to merge 2 commits into
codemie-ai:mainfrom
Siarhei-Yarkavy:feat/opencode-v2-config
Open

Siarhei-Yarkavy wants to merge 2 commits into
codemie-ai:mainfrom
Siarhei-Yarkavy:feat/opencode-v2-config

Conversation

@Siarhei-Yarkavy

@Siarhei-Yarkavy Siarhei-Yarkavy commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Adds supplementary OpenCode 2.x support while retaining OpenCode 1.x as the
primary installation path. The wrapper selects the matching configuration schema,
loads the appropriate telemetry plugin, and reads both SQLite session layouts
through the existing analytics contracts.

Closes #577

codemie install opencode still installs OpenCode v1 via opencode-ai.
Making v2 the default installed version is out of scope: this task provides
v2 support without replacing the primary v1 installation policy.

General agent-version enforcement and process-scanning doctor diagnostics are
outside this runtime adaptation: neither is required to emit v2 configuration
or select and translate session data.

Changes

  • Native v2 provider configuration for the CodeMie proxy, Ollama and Bedrock,
    including existing model capabilities, pricing and reasoning variants.
  • Validated version probing with bounded success/failure caches and Windows
    executable quoting. The default installer remains opencode-ai.
  • Version-gated standalone isolation only for v2 commands that accept it;
    explicit server selections and existing v1 argument behavior are retained.
  • Directory-packaged v2 hooks, durable lifecycle event mapping, shared matcher
    logic and platform-shell delivery when a POSIX sh is unavailable.
  • SQLite v1/v2 layout detection, message/part/error translation, actual-binary
    database discovery with the child's environment, exact source-session handoff,
    Windows v2 path representation and v2 file-operation metrics.
  • Strict rejection of a missing selected v2 proxy model before launch, with
    source-aware recovery instructions and early proxy/timer cleanup.
  • Bedrock model-ID corrections without invented suffixes. The existing us.
    geography default is retained when no region is supplied; explicit qualified
    IDs and ARNs remain authoritative.
  • Related regression coverage, MCP JSONC/native-shape handling, portable plugin
    URLs, Responses-routing improvements and integration documentation.

Impact and design decisions

The changes adapt existing CodeMie configuration, hooks and session analytics to
OpenCode 2.x. A missing v2 proxy-model selection is rejected instead of silently
selecting another emitted model. The database resolver uses the launch's binary
and environment instead of assuming another installation or storage root.

  • Private launch context: supported v2 commands use an isolated server because
    a shared service cannot inherit provider configuration from a later wrapper
    invocation. Explicit server choices are preserved; unrelated sessions are not stopped.
  • Source identity: an OpenCode source ID selects the conversation in a shared
    database, while the CodeMie UUID retains lifecycle/API correlation. A missing
    explicit source ID fails instead of selecting another session.
  • Catalogue metadata: proxy variants are available independently of startup
    effort, and existing prices/capabilities are preserved for interactive selection
    and cost estimates. Declaring a variant does not prove provider acceptance.
  • Shared hooks runtime: v1/v2 host registration remains separate, while matcher
    and command-execution logic is shared to prevent escaping and platform behavior drift.
  • Bedrock IDs: model-specific suffixes cannot be safely invented. Qualified
    IDs/ARNs are authoritative, and the existing us. default avoids a global-routing
    policy change for v1 and the built-in agent.

Small shared corrections to Bedrock IDs, shell-hook delivery, MCP/URL handling
and launch cleanup are intentionally included; they also affect existing paths.
The provider allowlist and model guard do not certify live backend availability.
Full-selector/resume handling, general inline/file precedence and broader
discovery/resource-ownership changes are outside this adaptation.

Testing

Local validation on Linux, Node 24.22.0:

  • Commitlint, license-check, lint (zero warnings), typecheck, build and
    git diff --check: passed.
  • Full unit project: 5586 passed, 367 files, no skipped tests.
  • Full CLI project: 278 passed, 10 skipped, 38 files. The skipped cases are
    nine authenticated skills cases without local SSO and one opt-in VS Code live
    certification case.
  • GitHub CI: commit messages/PR title, Gitleaks, build, full unit and CLI projects
    on Ubuntu/Windows with Node 20 passed. CI results.
  • Manual live smoke check: OpenCode v2 successfully launched through CodeMie with
    the generated v2 configuration. This user-confirmed local launch currently uses
    a manually created ~/.local/bin/codemie-opencode shim, not a default v2 installation
    from codemie install opencode.

The ordinary CI stages were executed separately. Dependencies were reused from
the existing installation; a fresh npm ci was not performed in this pass.
The full live agent suite and a dedicated provider/AWS acceptance matrix were
not run. Node 20/Windows and Gitleaks were verified in CI rather than locally.
The manual smoke check establishes basic v2 startup, not the full live
provider/analytics pipeline or actual billing behavior.

Checklist

  • Self-reviewed
  • Full local unit and CLI validation completed, with skips reported
  • OpenCode v2 launched live through CodeMie with generated v2 configuration (manual smoke check)
  • Documentation updated
  • Compatibility-affecting shared corrections documented
  • Automated implementation checks passed on Ubuntu/Windows CI
  • Current implementation verified end-to-end with live providers

Consolidate native provider config, directory hooks, SQLite session analytics,
source-ID and runtime context handling, version probing, file metrics, and
the related regression coverage and integration documentation.

Retain the shared cleanup, MCP/URL fixes and Responses routing net change.
Keep the legacy US Bedrock geography default when no region is supplied.
Leave the installer on opencode-ai and automatic standalone enrichment v2-only.

Split agent-version enforcement and process-scanning diagnostics into independent
branches. Preserve current upstream ACP and OTLP changes during the transfer.
Source history: backup/opencode-v2-config-before-split-2026-10-15.
Source-level fixes do not establish live provider or Windows acceptance.
@Siarhei-Yarkavy
Siarhei-Yarkavy force-pushed the feat/opencode-v2-config branch from 70350f2 to 6eaeabd Compare October 15, 2026 09:47
Document database selection, source identity, hook delivery and provider metadata with their rationale. Keep the v1 installer default out of scope and record the manual v2 launch smoke check without claiming full provider acceptance.

Refs: codemie-ai#627
@codemie-ai

Copy link
Copy Markdown
Owner

[AUTO_CLOSE_WARNING] ⏰ This pull request has had no activity for 7 days (last activity: 2026-10-15).

It will be automatically closed no earlier than 2026-10-29 (UTC) (~6 more days).

Any activity from anyone — a comment, a push, a review, reopening — restarts the countdown from that moment. This warning will be deleted automatically once that happens.

@Siarhei-Yarkavy

Copy link
Copy Markdown
Author

Hi team, is there any review?

This branch has not been deployed

No deployments
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.

[Feature]: Support opencode v2

2 participants