Skip to content

Fix/issue 82 provider bootstrap#165

Merged
GraDea merged 3 commits into
mainfrom
fix/issue-82-provider-bootstrap
Jul 10, 2026
Merged

Fix/issue 82 provider bootstrap#165
GraDea merged 3 commits into
mainfrom
fix/issue-82-provider-bootstrap

Conversation

@GraDea

@GraDea GraDea commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the remaining issue #82 bootstrap regression by keeping OpenCode provider/OIDC code out of the plugin-loader bundle.

This restores lazy loading for the OpenCode provider path and defers @opencode-ai/sdk/v2/client until runtime provider use, so plugin startup does not eagerly pull SDK/OIDC internals such as @vercel/oidc / getVercelOidcToken.

Changes

  • Added a lazy loadOpencodeProvider() boundary for provider call sites.
  • Changed plugin startup host transport setup to load provider code only when needed.
  • Added a lazy SDK client wrapper so @opencode-ai/sdk/v2/client is imported only on runtime SDK use.
  • Updated auto-capture/user-profile provider call sites to use the lazy loader.
  • Added bundle-boundary regression tests for:
    • transformer/sharp bootstrap safety
    • OpenCode SDK/OIDC absence from plugin-loader bundle
    • bundled lazy provider loader runtime resolution

Testcase for issue #82

Automated regression

bun run build
bun test tests/plugin-bundle-boundary.test.ts
Expected: plugin-loader bundle does not contain:
- @opencode-ai/sdk/v2/client
- node_modules/@opencode-ai/sdk
- @vercel/oidc
- getVercelOidcToken
- transformer/sharp internals
Full verification run
bun run build
bun run typecheck
bun test tests/plugin-bundle-boundary.test.ts tests/plugin-host-config.test.ts tests/opencode-provider.test.ts tests/auto-capture.test.ts
Result: 29 passing tests.
Real OpenCode runtime check
Configured OpenCode to load this branch directly:
{
  "plugin": ["/home/peshkov/src/opencode-mem"]
}
Then cleared logs, started a fresh OpenCode session, and triggered auto-capture.
Observed result:
Auto-capture memory persisted
No bootstrap crash from provider/OIDC, no getVercelOidcToken startup failure, and no auto-capture provider fallback in the branch retest.
Notes
OpenCode still logs schema rejection warnings on both main and this branch, but auto-capture persists successfully on both. Those warnings are not introduced by this change and do not block the issue #82 bootstrap fix.

GraDea and others added 3 commits July 10, 2026 10:29
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@GraDea GraDea merged commit bc08e7f into main Jul 10, 2026
4 of 5 checks passed
@GraDea GraDea deleted the fix/issue-82-provider-bootstrap branch July 10, 2026 09:42
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.

1 participant