Skip to content

fix(provider): accept "active" model status in config and catalog schemas - #1135

Merged
Astro-Han merged 1 commit into
devfrom
claude/config-active-status
Jun 3, 2026
Merged

fix(provider): accept "active" model status in config and catalog schemas#1135
Astro-Han merged 1 commit into
devfrom
claude/config-active-status

Conversation

@Astro-Han

Copy link
Copy Markdown
Owner

Summary

A user config or models.dev catalog entry declaring status: "active" crashed config load. The runtime already emits and reads "active" (provider.ts default model.status ?? "active" at :1041 and :1267), but the config-load schema and the catalog schema only allowed "alpha" | "beta" | "deprecated". So a model with status: "active" was rejected during validation — ConfigParse.schema throws InvalidError on a failed safeParse — instead of loading.

Fix

Add "active" to the status literal set in all three schemas:

  • config/provider.ts:54 — the config Model (Effect Schema Schema.Literals), used to validate opencode.json.
  • provider/models.ts:97 — the models.dev Model (zod z.enum).
  • provider/models.ts:163 — the models.dev PublishModel (zod z.enum).

Strictly widens the accepted set, so no previously valid input is rejected.

PawWork gap vs upstream

Adapted from upstream anomalyco/opencode 00c3248295 (PR #26592 — thanks Kit Langton). Upstream widens two Effect-Schema literal sets; PawWork's catalog schema (provider/models.ts) uses zod, so the port adds "active" to the zod z.enum there and to the Effect-Schema Literals in config/provider.ts. dev and upstream/dev share no common ancestor; re-implementation, not a cherry-pick.

Test

Added model-status-active.test.ts: asserts both the config Model schema (via its derived .zod, the actual config-load validator) and the models.dev Model schema accept status: "active". Proven red → green (without the widen both safeParse calls return success: false).

Verification

  • bun test test/provider/model-status-active.test.ts — 2 pass (red→green confirmed)
  • bun test test/provider/models-refresh.test.ts test/config/provider.test.ts — 14 pass (no regression)
  • bun run typecheck — clean

…emas

The runtime already emits and reads status "active" (provider.ts default
`model.status ?? "active"`), but the config-load schema and the models.dev
catalog schema only allowed "alpha" | "beta" | "deprecated". A user config or
catalog entry declaring status: "active" was rejected during config load,
throwing InvalidError instead of loading.

Add "active" to the status literal set in all three schemas: the config Model
(config/provider.ts) and both the models.dev Model and PublishModel
(provider/models.ts). Strictly widens the accepted set, so no previously valid
input is rejected.

Adapted from upstream anomalyco/opencode 00c3248295 (PR #26592, thanks Kit
Langton). dev and upstream/dev share no common ancestor; reimplemented, not
cherry-picked (PawWork uses zod for the catalog schema where upstream uses
Effect Schema).

Test: added regression asserting both the config Model schema and the
models.dev Model schema accept status: "active", proven red->green.
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 46 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ca5ffc9c-e63c-4e98-a9fd-33777dcc5c53

📥 Commits

Reviewing files that changed from the base of the PR and between 2081b37 and 148b2e4.

📒 Files selected for processing (3)
  • packages/opencode/src/config/provider.ts
  • packages/opencode/src/provider/models.ts
  • packages/opencode/test/provider/model-status-active.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/config-active-status

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added the bug Something isn't working label Jun 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds the 'active' status to the model schemas in both the config provider and models.dev definitions, preventing crashes when a model declares this status. It also introduces corresponding unit tests to verify that both schemas successfully parse the 'active' status. There are no review comments, so no additional feedback is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions github-actions Bot added harness Model harness, prompts, tool descriptions, and session mechanics P2 Medium priority labels Jun 3, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested priority: P2 (includes non-doc, non-test paths outside the low-risk bucket).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@Astro-Han
Astro-Han merged commit 669a3c9 into dev Jun 3, 2026
35 of 36 checks passed
@Astro-Han
Astro-Han deleted the claude/config-active-status branch June 3, 2026 12:01
Astro-Han added a commit that referenced this pull request Jun 3, 2026
Restructure the right-side Status panel from 2 sections (Progress + Sources) into 4 (Progress -> Workspace/Git -> Changed files/Artifact -> Sources), fold the standalone Files tab into the panel as a compact changed-files list, and move the titlebar worktree badge into the Git section.

Change boundary (packages/app, packages/ui):
- Status panel: new Git section (diff stats -> Review, branch row, worktree indicator with tooltip + open-directory) and Artifact section (changed files with hover/focus-visible open + reveal); Git section hidden outside a git repo. Data from sync.data.vcs (branch), sessionInfo().executionContext.activeWorktree (worktree), aggregateFiles(turn_change_aggregate) (diff stats).
- Files tab removed from RightPanelStaticTab / RIGHT_PANEL_TAB_META / command palette / keybind; legacy persisted "files" coerced to "status" via coerceLegacySidePanelTab + migrateLegacyRightPanelTab.
- Titlebar PawworkWorktreeBadge removed (worktree info now lives in the panel Git section).
- New `changes` icon registered (packages/ui).

Verification:
- typecheck clean; full app unit suite 1753 pass / 0 fail.
- Visual: status-summary-panel snap (4 sections + rest->hover open/reveal) plus a dev:desktop walk in the real Electron host (dark theme, zh locale, live sidecar) - Git section populated from real VCS (+N/-N, branch main), Artifact section listing a real session file (sample-test.md, +76).
- Codex adversarial review P1 findings fixed; 5 review threads resolved.

Brought current with dev: one conflict in context/layout.tsx - dev had extracted the inline layout helpers into context/layout-state.ts / layout-projects.ts (#1056 slice work). Took dev's refactored layout.tsx and ported this branch's defaultSidePanelTab `| "files"` widening into layout-state.ts. Final state 0 behind dev; also merged #1135/#1136/#1137/#1139 cleanly (no file overlap).

Deferred: dev:desktop worktree-indicator tooltip + non-git-hide are state-conditional and were not exercised live (hover open/reveal covered by the snap). session-side-panel.test.tsx isolation failure is the pre-existing mock.module warmup flake (its @/context/command mock omits matchKeybind/parseKeybind that terminal.tsx imports transitively); green in the full suite, tracked under the #1084 mock.module cleanup.

Relates #1056.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working harness Model harness, prompts, tool descriptions, and session mechanics P2 Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant