Skip to content

feat: provider selection + searchable model picker in workflows#375

Merged
alari76 merged 5 commits intomainfrom
feat/workflow-provider-model-picker
Apr 12, 2026
Merged

feat: provider selection + searchable model picker in workflows#375
alari76 merged 5 commits intomainfrom
feat/workflow-provider-model-picker

Conversation

@alari76
Copy link
Copy Markdown
Contributor

@alari76 alari76 commented Apr 12, 2026

Summary

  • Add Claude Code / OpenCode provider toggle to workflow Add and Edit modals (only shown when OpenCode is available)
  • Replace hardcoded 3-button model picker with adaptive WorkflowModelPicker: inline buttons for ≤5 models, searchable dropdown with recent selections for >5 models
  • Add provider field to frontend ReviewRepoConfig type to match server schema

Test plan

  • Open Add Workflow modal → verify model picker shows 3 Claude buttons (inline mode) when OpenCode is unavailable
  • With OpenCode running, verify provider toggle appears and switching to OpenCode loads models dynamically
  • With >5 OpenCode models, verify searchable dropdown appears with search field and recent selections
  • Edit an existing workflow → verify provider and model are pre-populated correctly
  • Save workflow with OpenCode provider → verify provider field persists in config

🤖 Generated with Claude Code

@alari76
Copy link
Copy Markdown
Contributor Author

alari76 commented Apr 12, 2026

CI Fix — Lint Error

Root cause: setLoadingOcModels in src/components/workflows/ProviderModelSection.tsx:39 was declared via useState but never called, triggering an @typescript-eslint/no-unused-vars error — the only error among 743 warnings, causing CI to fail.

Fix: Wired up setLoadingOcModels(true) before the fetchOpenCodeModels call and setLoadingOcModels(false) in a .finally() block. This resolves the lint error and also makes the existing isLoadingModels derived state (line 67) functional for the loading indicator.

Commit: 56299fe

@alari76
Copy link
Copy Markdown
Contributor Author

alari76 commented Apr 12, 2026

CI Fix — react-hooks/set-state-in-effect lint error

Root cause: In ProviderModelSection.tsx, setLoadingOcModels(true) was called synchronously inside a useEffect body (line 44). The react-hooks/set-state-in-effect rule flags this as an error because synchronous setState in an effect body triggers cascading renders.

Fix: Initialize loadingOcModels to true in the useState call instead (useState(true)), since the fetch fires immediately on mount and the loading state should start as true anyway. This removes the synchronous setState from the effect body entirely.

Commit: 207d8b3

@alari76
Copy link
Copy Markdown
Contributor Author

alari76 commented Apr 12, 2026

CI Fix Analysis (Workflow Run #929)

Root cause: In src/components/workflows/ProviderModelSection.tsx, setLoadingOcModels(true) was called synchronously in the useEffect body (line 44). The react-hooks linter flags this as an error because synchronous setState inside an effect can trigger cascading renders.

Fix: Initialize loadingOcModels state as true (since the fetch fires immediately on mount) and remove the synchronous setLoadingOcModels(true) call from the effect body. This preserves the same loading behavior — the component starts in a loading state and transitions to loaded once the fetch completes.

This was the only error among 726 warnings. The fix is in commit 207d8b3.

alari76 and others added 5 commits April 12, 2026 13:13
…modals

Workflow modals now support choosing between Claude Code and OpenCode
providers, with dynamic model loading from the OpenCode API. The model
picker switches between inline buttons (≤5 models) and a searchable
dropdown with recent selections (>5 models). OpenCode option is only
shown when the server reports available models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The setLoadingOcModels setter was declared but never called, causing an
eslint no-unused-vars error that failed CI (workflow run #928). Wire up
the setter to track loading state around the fetchOpenCodeModels call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…picker

- Set loadingOcModels to true before fetching and false in finally, so
  the model picker shows "Loading models..." while OpenCode models load
- Exclude recent model IDs from the "All Models" section to prevent
  duplicate entries in the searchable dropdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t body

The react-hooks/set-state-in-effect rule forbids calling setState
synchronously inside useEffect. Initialize the loading state to true
in useState instead, since the fetch fires immediately on mount.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ries

Without workingDir, the OpenCode API would return a generic model list
instead of models scoped to the workflow's repository.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alari76 alari76 force-pushed the feat/workflow-provider-model-picker branch from 0ba0366 to d8c3986 Compare April 12, 2026 10:13
@alari76 alari76 merged commit c8e4483 into main Apr 12, 2026
2 checks passed
@alari76 alari76 deleted the feat/workflow-provider-model-picker branch April 12, 2026 10:15
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