Skip to content

Keep provider pages running across provider deploys - #1193

Merged
railgrid-prow[bot] merged 3 commits into
mainfrom
provider-deploy-keep-mounted
Nov 18, 2026
Merged

railgrid-prow[bot] merged 3 commits into
mainfrom
provider-deploy-keep-mounted

Conversation

@cwilhit

@cwilhit cwilhit commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A provider deploy no longer tears down the provider page that is open. The mounted element keeps running the bundle this document loaded, and its context transport stays usable.
  • The new version is picked up the next time the provider is opened. A direct-registration provider, which cannot replace its custom element in place, finishes that navigation as one ordinary page load instead of showing "version changed; reload the page". A per-provider sessionStorage guard (60s) stops a flapping catalog from looping. A successful mount clears the guard.
  • Fix the mount watch in ProviderFrame.vue. Its source was a getter that returned a new array on every evaluation, which Vue compares by identity, so any replacement of the catalog entry or binding projection remounted the element even when no key changed. The watch now uses one source per key.
  • Hold the mounted element while a catalog or bindings re-read is in flight for exactly the mounted identity (provider copy, org, workspace, cluster). Before this, every re-read made access briefly non-authoritative and remounted the page, on main too. A re-read that settles to denied or fails still tears the element down, and any identity change never holds. kcp still authorizes every request.
  • Opening a stale provider does not reload automatically while the agent overlay reports an open conversation. The reload error offers the reload instead.
  • Dashboard tiles and the agent overlay opt into acceptLoadedVersion and keep the loaded bundle of the same provider copy. A different copy still rejects.

Validation

  • Portal unit and conformance tests (736), vue-tsc -b, make verify-ui-conformance, make verify-portalkit and make verify-design-docs passed after rebasing on main.
  • Smoke-tested in headless Chromium against a live local Tilt stack, with this branch's portal served against the stack's hub and main's portal as the baseline. The deploy was simulated in-page by changing the provider's catalog and binding version in the providers store, which is all the portal sees of a deploy. Changing the CatalogEntry itself was not exercised.
Step (Code provider) main This branch
Deploy while the page is open Element replaced by "Failed to load provider bundle" Same element and document
Reopen after a deploy Error One full page load, then the guard clears
Bindings re-read while open Remounted Kept
Catalog re-read while open Remounted Kept
Reopen after a deploy with an assistant conversation open Error Reload error, no automatic reload

Kuery gave the same results for the deploy and reopen steps.

Known limits

  • "Conversation open" comes from the active session label the Agents provider already publishes. It does not mean a reply is streaming, so the check is slightly more conservative than necessary.
  • The page header shows the new catalog version while the older bundle is still running.
  • DashboardTile still uses a getter-array watch and remounts on any entry change. A tile remount is cheap, so it is unchanged here.

🤖 Generated with Claude Code

cwilhit and others added 3 commits November 18, 2026 01:59
A catalog version change no longer tears down a mounted provider page.
The element keeps running the bundle this document loaded, and its
context transport stays current. The new version is picked up the next
time the provider is opened: a direct-registration provider that cannot
be replaced in place finishes the navigation as an ordinary page load,
guarded per provider in sessionStorage so a flapping catalog cannot
loop.

Dashboard tiles and the agent overlay opt into acceptLoadedVersion and
keep the loaded bundle for the same provider copy; a different copy
still rejects. The overlay remounts for a new bundle only when no
assistant is running.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mount watch's source was a getter returning a new array, which Vue
compares by identity. Any replacement of the catalog entry or the
binding projection therefore re-ran it, so a provider deploy still
remounted the open page (and, for a direct-registration provider,
immediately triggered the guarded reload) even with the version out of
the key. Use per-key watch sources so only a real identity change
remounts.

Found by a live smoke test against a Tilt stack: after a simulated
deploy the mounted Code and Kuery pages now keep their element and
document, and reopening the provider performs one guarded page load.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A catalog or bindings re-read briefly made provider access
non-authoritative, which tore the mounted element down and remounted
it. After a deploy that remount then hit the guarded page reload, so
the page reloaded itself while the user worked in it. While a re-read
is in flight for exactly the mounted identity (provider copy, org,
workspace, cluster), keep the element, its outlet and its transport,
and suppress the refresh banners. A re-read that settles to denied or
fails still tears it down; any identity change never holds.

Opening a stale provider no longer reloads automatically while the
agent overlay reports an open conversation; the reload error offers it
instead. A successful mount clears the reload guard, so a second deploy
inside the window still gets its page load.

Smoke-tested against a live Tilt stack (Code provider): bindings and
catalog re-reads keep the element; reopening after a deploy reloads
once and clears the guard; with a conversation open it shows the
reload error instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cwilhit

cwilhit commented Nov 18, 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 findings. Two Notes below, one anchored and one in the test file; neither blocks the merge.

Not anchored

  • Note: retryProviderBundle (ProviderFrame.vue:632) and onProviderBootstrapRetry (:645) still gate on accessAllowed, while the rest of the file now uses accessActive. While a catalog or bindings re-read holds a mounted element, a bootstrap-retry event from the provider is ignored, because the preventDefault acknowledgement is skipped. The window is only the length of the re-read. Switching both to accessActive would make them consistent.

Checked

  • Read beyond the diff: loadProviderScript, invalidateProviderScript and the failure-cleanup block in providerScriptLoader.ts; all of ProviderFrame.vue (catalogSettled, catalogRefreshing, bindingProjectionCurrent, accessAllowed, clearMountedElement, mountElement, loadAndMount, pushContext, retryProviderBundle, onProviderBootstrapRetry); AgentOverlay.vue (clear, mountAgent, authorityKey and its watches); stores/agentOverlay.ts; the bindingsStale and bindingsLoadState transitions in stores/providers.ts.
  • Correctness: the per-key watch sources fix the identity-compare problem. catalogSettled is dropped from the watch but still part of accessAllowed, so accessActive still requires it. mountedIdentity is only set after mountElement and cleared in clearMountedElement, so a hold never applies to a mount that has not happened. The reload guard fails closed: no storage, unreadable marker or a hit inside 60s results in the error UI. One gap is the first Note.
  • Concurrency: JS single-threaded. Generation checks (isCurrentMount, current()) still cover the new async paths. The bundleRevision watch only remounts when !element && !loading, so it cannot race a live conversation. Not applicable: the Go and hub side.
  • Tenancy: mountIdentity includes provider name, export path, scope, org, workspace and cluster. A hold is bounded by a re-read in flight, and kcp still authorizes each request. acceptLoadedVersion requires an identical provider identity. No findings.
  • Provider contract, API/codegen, hub and provider Go modules: not applicable. The diff is portal/ only, with no manifest, CRD, chart or verb change.
  • Security: no new fetch, header or token handling. The reload guard stores only a provider name and a timestamp in sessionStorage. No findings.
  • Portal: no vendored portalkit or agentkit file is touched. No visible markup is added beyond the !accessHeld guards on two existing banners. The PR body describes headless-Chromium evidence for the behaviour, but no screenshots in dark and light were attached. I did not render the UI.
  • Tests: the new ProviderFrame tests assert on source text with regexes and a re-evaluated accessHeld expression. They would catch someone editing the watch source list, but they do not drive the hold, remount or reload paths through Vue (see the Note on the tests). providerUpdateReload and providerScriptLoader have behavioural tests.
  • Ran in portal/: node --test on the 9 changed *.test.mjs files passed (143 pass, 0 fail). npx vue-tsc -b exited 0.
  • Not run: make verify-ui-conformance, make verify-portalkit, make verify-design-docs, and the Go build, vet, lint and e2e targets. The PR touches no Go, apis/, provider or portalkit-source files, and no e2e suite covers this portal-only change.

if (!name || !ready || !settled || !allowed || !mount) return
await loadAndMount(name, version, mount)
if (!name || !ready || !allowed || !mount) return
await loadAndMount(name, entry.value?.version, mount)

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 failed load is no longer retried when the catalog moves to a new version
The watch no longer lists entry.version. If the first load of v1 fails (bundle 5xx, SRI mismatch, 5s whenDefined timeout), loadState stays 'error'. A deploy of v2 that fixes the bundle no longer re-runs loadAndMount, so the user sees the error until they press Retry or navigate away and back. Before this PR the version change re-ran the loader. AgentOverlay.vue handles the same case with its bundleRevision watch, which remounts when !element, and this frame has no equivalent. A small fix is to re-run when there is nothing mounted:

watch(() => entry.value?.version, () => {
  const mount = mountRef.value
  const name = entry.value?.name
  if (loadState.value === 'error' && accessActive.value && entry.value?.ready && name && mount) {
    void loadAndMount(name, entry.value.version, mount)
  }
})

assert.match(functionBody('loadAndMount'), /loadState\.value = 'ready'\s*clearProviderUpdateReload\(name\)/)
})

test('a catalog or bindings re-read holds the mounted element for the same identity only', () => {

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: the hold and reload tests check source text, not behaviour
The accessHeld truth table is real, because it re-evaluates the expression. But the wiring that matters is only matched by regexes: that bindingsRefreshing has a given shape, that the mount <div> uses v-if="accessActive", and that loadAndMount has the instanceof ProviderPageReloadRequiredError branch. A change that kept the text but broke the behaviour would still pass. Examples are mountedIdentity not being set in mountElement, or the guard return skipping state cleanup. A mounted-component test would cover it: mount ProviderFrame with a stub provider, flip providers.loading or bindingsLoadState, and assert the element node is the same. A second case would assert that a stale direct-registration provider calls the injected reload once.

@cwilhit

cwilhit commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

/approve

@railgrid-prow

railgrid-prow Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cwilhit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@railgrid-prow
railgrid-prow Bot merged commit 8c6081b into main Nov 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants