Skip to content

[FIX] Normalize free OpenCode model selection during onboarding - #374

Open
vmanvs wants to merge 1 commit into
peakflo:mainfrom
vmanvs:fix/normalizing-free-opencode
Open

[FIX] Normalize free OpenCode model selection during onboarding#374
vmanvs wants to merge 1 commit into
peakflo:mainfrom
vmanvs:fix/normalizing-free-opencode

Conversation

@vmanvs

@vmanvs vmanvs commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

OpenCode providers may return models either as arrays or as object maps keyed by model ID. Previously, free-model selection only handled array responses and checked only model display names for the free marker.

As a result, onboarding could miss an available free model and fall back to the first model returned by the provider. This PR applies the same response-shape handling already established in AgentForm.tsx, while additionally checking both model IDs and display names to select a free default.

Changes

  • Support both array and object-map model responses when selecting a free OpenCode model.
  • Detect the free marker in both model IDs and display names.
  • Use explicit model IDs when present, falling back to object-map keys.
  • Add regression tests for all supported response shapes and fallback behavior.

Testing

  • pnpm typecheck passes.
  • pnpm build succeeds.
  • Focused onboarding test suite passes: 27 tests.
  • Ran the Windows-equivalent full test suite:
$env:ELECTRON_RUN_AS_NODE='1'
.\node_modules\.bin\electron.cmd .\node_modules\vitest\vitest.mjs run

Checklist

  • pnpm typecheck passes
  • pnpm build succeeds
  • pnpm test:run passes
  • No hardcoded color classes (use CSS variable tokens)

Notes

The full suite completed with unrelated existing failures:

Test Files  3 failed | 94 passed (97)
Tests       11 failed | 1438 passed (1449)

Failures remain in agent-manager.test.ts, ipc-handlers.test.ts, and opencode-config.test.ts.
Literal pnpm test:run is not Windows-compatible because it uses Unix-style environment-variable syntax.

@vmanvs

vmanvs commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@dimavedenyapin please review these changes

@dimavedenyapin dimavedenyapin self-assigned this Jun 15, 2026
@dimavedenyapin
dimavedenyapin self-requested a review June 15, 2026 05:50
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