refactor(coding-agent): derive available connection models on read - #1741
Closed
snimu wants to merge 6 commits into
Closed
refactor(coding-agent): derive available connection models on read#1741snimu wants to merge 6 commits into
snimu wants to merge 6 commits into
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The TUI stored
connectionModels— a filtered copy of the model catalog x configured providers — with its own assignment, clearing, and versioned return paths. A pure function of two other fields, stored, and therefore synchronizable and driftable (audit: duplicate sources of truth, dup-truth.md finding 4).The fix
The stored copy and its sync paths are deleted; the available-model list derives on read with the identical predicate (
catalog.filter(m => providers.has(m.provider))). The catalog, provider set, and async-refresh generation guard remain — they are source data and stale-request protection, not copy-sync. +17/−22.How it's verified
Reviewer confirmed all 4 former field sites converted (zero references remain), predicate character-identical including the invalidate and stale-generation cases, derivation off any render hot path, and the retained machinery guards source data only. 174/174 focused; full CI-style suite identical failing set to stack base. Two-model implement/review loop, approved first pass.
Stacked on #1739 (test the whole stack at the leaf; merge base-first).
Note: intentionally no Linear ticket for this cleanup stack, so that check stays red.
Note
Low Risk
Internal refactor with identical filtering logic and in-tree test updates; no auth or API surface changes beyond removing a private field.
Overview
InteractiveMode no longer keeps a separate cached
connectionModelslist. Available models are derived on read viagetAvailableConnectionModels(), filteringconnectionModelCatalogbyconnectionConfiguredProviderswith the same predicate as before.applyConnectionModelCatalogonly updates catalog and provider set;invalidateConnectionModelsclears providers (so derived availability is empty) instead of wiping a duplicate array. Async catalog refresh and stale-request handling still use the getter after fetch or on version mismatch.Tests and harnesses assert through
getAvailableConnectionModels()instead of the removed field. Changelog notes keeping available lists aligned with catalog and configured providers.Reviewed by Cursor Bugbot for commit 63cbcd3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Derive available connection models on read in
InteractiveModeconnectionModelsfield fromInteractiveMode; availability is now computed on demand fromconnectionModelCatalogandconnectionConfiguredProvidersvia the newgetAvailableConnectionModelsaccessor.applyConnectionModelCatalogno longer populates a separate cache;invalidateConnectionModelsrelies on clearingconnectionConfiguredProvidersto make available models empty.getConnectionAvailableModelsuses the new getter in both the version-mismatch path and after fetching a catalog.getAvailableConnectionModels()instead of the removed field.connectionModelsdirectly will break; all known in-tree callers are updated.Macroscope summarized 63cbcd3.
Linear ticket: ENG-5660
(ticket linked above)