Skip to content

Align Agents provider and model setup with App Studio - #1071

Merged
cwilhit merged 2 commits into
mainfrom
codex/agents-provider-model-parity
Nov 11, 2026
Merged

cwilhit merged 2 commits into
mainfrom
codex/agents-provider-model-parity

Conversation

@cwilhit

@cwilhit cwilhit commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Load a saved provider’s model catalog automatically when it is empty. Put Refresh models inside the Model ID picker, preserve cached choices when refresh fails, and allow manual IDs during refresh.
  • Make the optional connection name available before verification.
  • Return standalone provider setup to Models as soon as the save succeeds. When setup starts from Add model, agent creation, or chat recovery, open Add model with the new connection selected.

Verification

  • Agents portal typecheck and all 1,370 tests passed.
  • App Studio model settings and picker suites passed.
  • Model connection API and catalog suites, UI conformance, design docs, and PortalKit checks passed.
  • Chromium verified the Agents picker at 1440 px and 390 px in light and dark themes. The cross-provider visual comparator timed out looking for App Studio’s Connect provider button.

@cwilhit

cwilhit commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

@mjudeikis-bot review.

@mjudeikis mjudeikis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No Critical or Warning findings. Three Notes below; all are contained portal-side issues.

Scope: portal-only change (Agents provider portal + one design doc). No Go, API, CRD, manifest, chart or codegen files are touched, so the server-path, tenancy and provider-contract categories do not apply.

Checked

Read beyond the diff

  • ProviderConnectionEditor.vue in full: connections/originalConnection/selectedConnection, fingerprint watcher, discover(), connect(), probeRequest(), cancel(), canSaveNameOnly, and declaration order of testing/catalogRequest against the new { immediate: true } watch (no TDZ).
  • Models.vue: saveModel, continueWithSavedProvider, openProvider, cancelCreate, cancelEditorAfterSave, and the routeOwned vs createRoute emit conditions.
  • App.vue: addAgentCredential, onCreateSuccess, onCreateCancel, credentialMatchesFamily, createSuccessRoute, rememberProviderConnectionOrigin.
  • resources.ts saveCredential (connectionWrite classification, harness exclusion) and credentialView; api.ts discoverProviderConnection; agentkit/ModelIDSelector.vue slots (search-action, status exist); model-probe-result.ts.

Hunt categories

  • Correctness: auto-refresh fires once per catalogIdentity change, no retry loop; stale-result fencing (isCurrent) and abort on unmount/identity change hold; harness credentials are excluded from connectionWrite, so the new isConnection guard in credentialMatchesFamily does not drop them. Two Notes (empty refresh result, discarded diagnostic).
  • Concurrency: only the single catalogRequest AbortController; superseded requests cannot write refreshedModels. No findings.
  • Tenancy/kcp, provider contract, API/codegen/storage: not applicable, no such files changed. uid/generation are read-only view fields added to the portal Credential type, nothing is written back.
  • Security: no global fetch; refresh goes through the existing api.discoverProviderConnection verb; the API key is not logged or placed in the identity string (secretRef/secretKey are names only). No findings.
  • Portal: no vendored portalkit/agentkit copy edited; InlineNotification is the existing portalkit component; .k-icon-action, .k-spin, .sr-only already exist. The removed .agents-provider-connected CSS has no remaining references. The design doc is updated and consistent with the code. One Note on test coverage.
  • Tests: new editor tests cover auto-discover on empty catalog, manual ID during refresh, failure retaining cache, and late-result discard on connection switch; the router/create-route tests were rewritten for the new post-save navigation.

Commands run

  • cd providers/agents/portal && npm ci: ok.
  • npx vue-tsc --noEmit: clean.
  • npx vitest run: 81 files, 1370 tests passed.
  • hack/sync-portalkit.sh --verify: portalkit copies in sync.
  • Root make build/vet/lint, Go tests, verify-codegen, verify-provider-contract, verify-boilerplate: not run, no Go, API, manifest or chart files changed.
  • e2e: not run. The change is confined to portal Vue/TS covered by the vitest suites above. I did not render it in a browser, so I did not independently confirm the Chromium evidence in the PR body. That body notes the cross-provider visual comparator timed out, and the new Connection name field and the removed Provider connected card are not listed in the rendered evidence.

const result = await api.discoverProviderConnection(selectedConnection.value, request.signal)
if (!isCurrent()) return
if (!result?.ok) throw new Error('Could not refresh models. Check the provider connection and try again.')
refreshedModels.value = result.models ?? []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: A successful refresh with no models erases the cached choices
modelOptions is refreshedModels ?? cachedModels, and this line sets refreshedModels to [] whenever the verb returns ok without a models array (or an empty one). The picker then loses the saved discovered options that the PR says are preserved. Only a failed refresh keeps them. Keep the cache when the response carries no list:

if (result.models?.length) refreshedModels.value = result.models

try {
const result = await api.discoverProviderConnection(selectedConnection.value, request.signal)
if (!isCurrent()) return
if (!result?.ok) throw new Error('Could not refresh models. Check the provider connection and try again.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: Refresh failure drops the provider diagnostic
A non-ok result throws a fixed message, so the user never sees the sanitized technicalDiagnostic that discover() surfaces through presentModelProbeResult. A provider that does not support listing and a revoked key now read the same. Reuse the presenter so both paths report alike:

if (!result?.ok) throw new Error(presentModelProbeResult(result || { ok: false, latencyMS: 0 }, 'discover').error || 'Could not refresh models.')

:initial-family="route.type === 'harness' ? 'harness' : 'chat'"
:select-connection="route.type === 'from-connection'"
:continue-add-model-after-provider-connect="continueAddModelAfterProviderConnect"
:continue-add-model-after-provider-connect="continueAddModelAfterProviderConnect || agentCredentialSetup?.family === 'chat'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: Agent-creation handoff change has no test
agentCredentialSetup?.family === 'chat' makes the Agent setup detour continue into Add model, and credentialMatchesFamily (line 488) now rejects connections. create-routes.test.ts only asserts the add-credential event is emitted, and element-router.test.ts covers the Models-tab detour, so nothing exercises this App-level path. Add a shell test: start agent creation, choose add credential, connect a provider, expect Add model with the connection selected, save a model, and expect a return to the agent draft with that model chosen.

@cwilhit
cwilhit merged commit 32dea0b into main Nov 11, 2026
28 checks passed
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.

2 participants