Skip to content

fix(auto-capture): reuse injected opencode client#146

Open
huilang021x wants to merge 1 commit into
tickernelz:mainfrom
huilang021x:fix-use-plugin-client-for-autocapture
Open

fix(auto-capture): reuse injected opencode client#146
huilang021x wants to merge 1 commit into
tickernelz:mainfrom
huilang021x:fix-use-plugin-client-for-autocapture

Conversation

@huilang021x

Copy link
Copy Markdown
Contributor

Summary

  • What changed: Auto-capture now builds its structured-output session client from the injected OpenCode ctx.client instead of creating a second client from ctx.serverUrl. session.create failures now include underlying status/error details when available.
  • Why: In no-port OpenCode sessions, ctx.serverUrl can be http://localhost:4096/ even when no REST API is listening there, causing session.create returned no session id during auto-capture.
  • Current phase: Ready for review. Closes Auto-capture uses unreachable ctx.serverUrl in no-port OpenCode sessions #145.

Scope

  • In scope: Structured-output auto-capture client initialization and regression coverage for the injected-client adapter.
  • Out of scope: Provider/model timeout tuning, storage/indexing behavior, web UI behavior.
  • Risk level: Low/medium; changes the internal client used for auto-capture session create/prompt/delete while preserving the existing request shapes.

Deployment Targets

  • Impacted services: opencode-mem plugin auto-capture and user-profile structured-output paths that use the shared opencode provider client.
  • Restart/deploy needed: Users need to restart OpenCode after upgrading the plugin.
  • Target environment: OpenCode plugin runtime.
  • Rollback note: Revert this commit to restore the previous ctx.serverUrl client path.

Acceptance Plan

  • Acceptance criteria: Auto-capture should not fail with no session id solely because ctx.serverUrl points to an unreachable default port; structured-output calls should use the injected client and still pass format, system, model, and parts correctly.
  • Evidence to collect: Regression test verifies createStructuredOutputClient() maps v2-style calls onto the injected client without opening a new serverUrl client.
  • Required checks: Typecheck, build, formatter check, targeted provider tests, full test suite.
  • Manual verification needed: Optional validation in a no-port OpenCode runtime after publishing.

Validation

  • Commands run:
    • bun test tests/opencode-provider.test.ts
    • bun run format:check
    • bun run typecheck
    • bun run build
    • bun test
  • Result: All passed after formatting.
  • Evidence links/log snippets:
    • Targeted test: 12 pass, 0 fail
    • Full test suite: 157 pass, 0 fail

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.

Auto-capture uses unreachable ctx.serverUrl in no-port OpenCode sessions

1 participant