Skip to content

Conversation

@justsisyphus
Copy link
Collaborator

@justsisyphus justsisyphus commented Jan 26, 2026

Summary

  • Adds connected-providers-cache to cache connected provider information
  • Improves model availability checking by filtering based on actually connected providers
  • Updates auto-update-checker to build cache on startup

Changes

  • New connected-providers-cache.ts with cache read/write functions
  • Enhanced data-path.ts with cache directory utilities
  • Updated model-availability.ts to use provider-models cache
  • Updated model-resolver.ts to use connected providers cache
  • Updated auto-update-checker to update cache on startup
  • Full test coverage for model availability changes

Summary by cubic

Adds a connected providers cache and model whitelist to ensure we only resolve models from providers the user has actually connected. Startup now builds this cache automatically, improving fallback resolution and doctor output.

  • New Features

    • Added connected-providers-cache and provider-models.json (whitelisted models per provider) under ~/.cache/oh-my-opencode.
    • Model availability filters by connected providers and prefers the whitelist; falls back to OpenCode’s models.json when needed.
    • Fallback resolver uses connected providers when the model cache is empty.
    • Auto-update-checker builds/updates the cache on startup and shows a first-run toast; doctor output clarifies provider counts and runtime behavior.
  • Migration

    • No changes required.
    • On first run, the cache builds in the background. Restart OpenCode to enable full model filtering.

Written for commit 5e2a0f4. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 10 files

Confidence score: 4/5

  • Safe to merge overall; the only noted issue is a medium-severity consistency concern rather than a clear breakage risk.
  • In src/shared/connected-providers-cache.ts, raw JSON.parse is used instead of parseJsonc/readJsoncFile, which could reduce JSONC compatibility and consistent error handling.
  • Pay close attention to src/shared/connected-providers-cache.ts - replace raw JSON.parse with the shared JSONC parser utilities for consistent behavior.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/shared/connected-providers-cache.ts">

<violation number="1" location="src/shared/connected-providers-cache.ts:45">
P2: Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.</violation>

<violation number="2" location="src/shared/connected-providers-cache.ts:96">
P2: Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


try {
const content = readFileSync(cacheFile, "utf-8")
const data = JSON.parse(content) as ProviderModelsCache
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 26, 2026

Choose a reason for hiding this comment

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

P2: Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/shared/connected-providers-cache.ts, line 96:

<comment>Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.</comment>

<file context>
@@ -0,0 +1,192 @@
+
+	try {
+		const content = readFileSync(cacheFile, "utf-8")
+		const data = JSON.parse(content) as ProviderModelsCache
+		log("[connected-providers-cache] Read provider-models cache", { 
+			providerCount: Object.keys(data.models).length, 
</file context>
Fix with Cubic


try {
const content = readFileSync(cacheFile, "utf-8")
const data = JSON.parse(content) as ConnectedProvidersCache
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 26, 2026

Choose a reason for hiding this comment

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

P2: Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/shared/connected-providers-cache.ts, line 45:

<comment>Avoid raw JSON.parse in shared utilities; use parseJsonc/readJsoncFile from src/shared/jsonc-parser.ts for consistent JSONC support and error handling.</comment>

<file context>
@@ -0,0 +1,192 @@
+
+	try {
+		const content = readFileSync(cacheFile, "utf-8")
+		const data = JSON.parse(content) as ConnectedProvidersCache
+		log("[connected-providers-cache] Read cache", { count: data.connected.length, updatedAt: data.updatedAt })
+		return data.connected
</file context>
Fix with Cubic

@justsisyphus justsisyphus force-pushed the feat/connected-providers-cache branch from 2970a77 to 4f14c12 Compare January 26, 2026 02:42
@justsisyphus justsisyphus force-pushed the feat/connected-providers-cache branch from 4f14c12 to 5e2a0f4 Compare January 26, 2026 02:48
@justsisyphus justsisyphus merged commit 3a79b87 into dev Jan 26, 2026
6 checks passed
@justsisyphus justsisyphus deleted the feat/connected-providers-cache branch January 26, 2026 02:53
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