fix(providers): preserve workspace model options#21531
Workspace provider snapshots carry skills and commands, but cannot carry the directory's model options. Project-local OpenCode agents therefore cannot reach clients without changing the machine catalog.
Add optional workspace option descriptors to the existing snapshot contract and preserve them in the registry. A shared projection replaces matching descriptor IDs for the selected cwd across models, preserving other capabilities and the global catalog. When a refresh omits descriptors, retain the last successful result for that directory; without a previous result, clients keep the machine catalog. An explicit empty result clears the prior choices. Older clients and servers remain compatible.
This is the foundation of the replacement for @maria-rcks's #15637. The next layer, #21532, supplies OpenCode discovery, selected-agent execution, and web/mobile consumers. This layer alone does not change the picker.
Verification: all 87 focused registry/client-runtime tests pass (86 existing main cases retained; one registry case extended through wire encode/decode and one shared projection scenario added). Bypassing the behavior produces two assertion failures. Scoped lint, formatting and typecheck pass. Independent Claude and Sol full-diff reviews found no blockers. Screenshots are not applicable to this unused foundation API; the feature layer supplies live proof. macOS, Windows, iOS, Android and Electron desktop were not verified.
Implementation: Codex gpt-6.1-sol (high); tests: Codex gpt-6-astra (high); review: Claude claude-opus-5-5 and Codex gpt-6-sol through T3 Code.
Checks
Added 2 commits
Approvability
Verdict: Approved at 32657b5
Macroscope's review found this PR approvable ā This is a small, backward-compatible provider metadata change that preserves workspace options and adds an isolated cwd-specific projection without changing the existing machine catalog or current user-facing flows. Its refresh, wire-compatibility, clearing, and immutability behavior is covered by focused tests.
No code changes detected at 18e511d. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
ā Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | +7 B (+0.1%) | 6.8 KiB | ā |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | +7 B (+0.6%) | 2.0 KiB | ā |
| Codex | Live turn WebSocket decoded | 20.9 KiB | 20.9 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | ā7 B (ā0.1%) | 6.8 KiB | ā |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Claude | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | ā7 B (ā0.6%) | 2.0 KiB | ā |
| Claude | Live turn WebSocket decoded | 21.2 KiB | 21.2 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
Baseline: 673c5e3 Ā· PR result: 18e511d Ā· Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Important
Review skipped
Review was skipped as selected files did not have any reviewable changes.
āļø Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
99766970-43b8-491a-96c9-003b67dbb393
š„ Commits
Reviewing files that changed from the base of the PR and between 32657b5dbd79a6f770c5a38edc9ba1522d70c6c7 and 18e511ddb695a4158d0f568a7f0d112831ae1de1.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- š Trigger review
No actionable comments were generated in the recent review. š
ā¹ļø Recent review info
āļø Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
f0b971ca-8eec-4fb0-b706-263baaade61e
š„ Commits
Reviewing files that changed from the base of the PR and between 8ae53fd4db0c30456b8275989e387fc393dfde30 and 32657b5dbd79a6f770c5a38edc9ba1522d70c6c7.
š Files selected for processing: 6
apps/server/src/provider/ProviderRegistry.test.tsapps/server/src/provider/ProviderRegistry.tspackages/client-runtime/src/providerSkills.test.tspackages/client-runtime/src/providerSkills.tspackages/contracts/src/server.tspackages/provider-core/src/server/driver.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
š Walkthrough
Workspace snapshots now carry option descriptors through the server contract and provider type. The server preserves stored descriptors when updates omit them. The client runtime applies descriptors from the matching workspace snapshot to provider models.
Changes: Workspace Option Descriptors
Layer / File(s) Summary Carry descriptors in workspace snapshots
packages/contracts/src/server.ts,packages/provider-core/src/server/driver.ts,apps/server/src/provider/ProviderRegistry.ts,apps/server/src/provider/ProviderRegistry.test.tsThe snapshot contract and provider type include option descriptors. Snapshot updates retain stored descriptors when incoming snapshots omit them. Tests cover serialization, descriptor preservation, empty descriptors, and refreshes without descriptors. Apply descriptors for a cwd
packages/client-runtime/src/providerSkills.ts,packages/client-runtime/src/providerSkills.test.tsFor a matching cwd, the resolver replaces model descriptors with workspace descriptors that have matching IDs and retains unrelated descriptors. Tests cover empty descriptors, unchanged catalogs, and unmatched cwd values. Priority: ā¬ļø Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant ProviderRegistry 3 participant ServerProvider 4 participant ClientRuntime 5 participant ProviderModels 6 ProviderRegistry->>ServerProvider: Include workspace option descriptors 7 ServerProvider->>ClientRuntime: Supply provider with workspace snapshots 8 ClientRuntime->>ProviderModels: Apply descriptors for matching cwd Suggested reviewers:
maria-rcks
Merge Risk: āŖ Minimal Ā· up to 32657
This change is mergeable as a compatible foundation; workspace-specific options will not appear until the planned integration is added.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title clearly and concisely describes the primary change: preserving workspace model options for providers. Description check Passed The description explains the problem, implementation, scope, compatibility behavior, verification results, and unverified platforms. It provides relevant issue links and testing details, although it d⦠Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request. Full details: Description check
Explanation
The description explains the problem, implementation, scope, compatibility behavior, verification results, and unverified platforms. It provides relevant issue links and testing details, although it does not use the template headings or state explicit maintainer approval.
⨠Finishing Touches: š” 1
-
š ļø Fix failing CI checks: š”
- Commit to this branch
- Create a new PR
š Generate docstrings
- Commit to this branch
- Create a new PR
š§Ŗ Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix Ā· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- Merge remote-tracking branch 'origin/main' into HEAD18e511d