fix(providers): preserve workspace model options#21531

merged3
main
other-providers-14/workspace-options
opened11d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 10d ago

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

22 successful Ā· 11 skipped
All checks passed
18e511d

Added 2 commits

  • fix(providers): retain workspace options after failed refresh32657b5
  • fix(providers): preserve workspace model optionsd156601
Synced from GitHub

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.

Synced from GitHub

Thread transfer impact

āœ… Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB+7 B (+0.1%)6.8 KiBāœ…
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBāœ…
CodexLive turn WebSocket wire1.2 KiB1.2 KiB+7 B (+0.6%)2.0 KiBāœ…
CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiBāœ…
CodexLive turn messages220 (0.0%)8āœ…
ClaudeTotal thread wire5.0 KiB5.0 KiBāˆ’7 B (āˆ’0.1%)6.8 KiBāœ…
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBāœ…
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiBāˆ’7 B (āˆ’0.6%)2.0 KiBāœ…
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiBāœ…
ClaudeLive turn messages220 (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.

Synced from GitHub

Review in Change Stack →

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.ts
  • apps/server/src/provider/ProviderRegistry.ts
  • packages/client-runtime/src/providerSkills.test.ts
  • packages/client-runtime/src/providerSkills.ts
  • packages/contracts/src/server.ts
  • packages/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.ts
The 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.ts
For 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)

mermaid
1sequenceDiagram
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 nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the primary change: preserving workspace model options for providers.
Description checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck 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