diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index cf6b639d6..c068a20e0 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -17,7 +17,14 @@
its track and the footer ended up overlapping the last row at 390px
(UX audit F14). -->
-
+
+
@@ -79,24 +86,44 @@ function handleAuthModalClose() {
systemStore.setAuthRequired(false)
}
+// Re-prime everything that only loads at mount. The key covers
+// the routed view, but these surfaces live outside it and would otherwise keep
+// their failed state until a full page reload (#1065).
+async function reloadAfterAuth() {
+ systemStore.connectEventSource()
+ serversStore.fetchServers()
+ systemStore.fetchInfo() // TopHeader version / update state
+ systemStore.fetchRouting() // TopHeader routing chip
+ // Server-edition role-based nav. The router guard does not run for a
+ // key-driven remount, so re-check here.
+ await authStore.checkAuth()
+}
+
function handleAuthModalAuthenticated() {
authModal.show = false
authModal.lastError = ''
- systemStore.setAuthRequired(false)
+ // markAuthRecovered, not setAuthRequired(false): this path validated the key,
+ // so it is safe to invalidate every view that failed while auth was broken.
+ systemStore.markAuthRecovered()
- // Refresh data now that we're authenticated
- systemStore.connectEventSource()
- serversStore.fetchServers()
+ void reloadAfterAuth()
}
-function handleAuthModalRefresh() {
+function handleAuthModalRefresh(verified: boolean) {
+ if (!verified) {
+ // The reloaded key did not authenticate. Leave the modal and the
+ // auth-required flag in place rather than remounting every view onto a
+ // key that is still 401.
+ return
+ }
+
authModal.show = false
authModal.lastError = ''
- systemStore.setAuthRequired(false)
+ // The modal verified the reloaded key, so this is a real recovery and the
+ // views holding stale auth errors must be invalidated too (#1065).
+ systemStore.markAuthRecovered()
- // Reconnect with potentially new API key
- systemStore.connectEventSource()
- serversStore.fetchServers()
+ void reloadAfterAuth()
}
// Handle API authentication errors
diff --git a/frontend/src/components/ActivityWidget.vue b/frontend/src/components/ActivityWidget.vue
index 3b08314f2..c0b0926ab 100644
--- a/frontend/src/components/ActivityWidget.vue
+++ b/frontend/src/components/ActivityWidget.vue
@@ -105,6 +105,7 @@ import api from '@/services/api'
import type { ActivityRecord, ActivitySummaryResponse } from '@/types/api'
import {
formatPreflightSummary,
+ getTypeIcon,
isChildCall,
isPreflightActivity,
statusPresentation,
@@ -161,18 +162,6 @@ const formatRelativeTime = (timestamp: string): string => {
return `${Math.floor(diff / 86400000)}d ago`
}
-const getTypeIcon = (type: string): string => {
- const typeIcons: Record = {
- 'tool_call': 'π§',
- 'policy_decision': 'π‘οΈ',
- 'quarantine_change': 'β οΈ',
- 'server_change': 'π',
- // Spec 098: required-tools preflight
- 'preflight': 'π«'
- }
- return typeIcons[type] || 'π'
-}
-
// Lifecycle
onMounted(() => {
loadData()
diff --git a/frontend/src/components/AuthErrorModal.vue b/frontend/src/components/AuthErrorModal.vue
index 8106efed6..7bf0704b2 100644
--- a/frontend/src/components/AuthErrorModal.vue
+++ b/frontend/src/components/AuthErrorModal.vue
@@ -109,7 +109,9 @@ interface Props {
interface Emits {
(e: 'close'): void
(e: 'authenticated'): void
- (e: 'refresh'): void
+ // `verified` says whether the reloaded key actually authenticated. App.vue
+ // only invalidates views when it did (#1065).
+ (e: 'refresh', verified: boolean): void
}
const props = withDefaults(defineProps(), {
@@ -175,10 +177,27 @@ async function handleSetAPIKey() {
}
}
-function handleRefresh() {
- // Reinitialize API key from URL/localStorage
- api.reinitializeAPIKey()
- emit('refresh')
+async function handleRefresh() {
+ // Reinitialize API key from URL/localStorage, then VERIFY it before telling
+ // the app auth is repaired. Without the verification this path could only
+ // assert recovery, so it could not safely invalidate the views holding stale
+ // auth errors -- and #1065's stale red panel survived on this path.
+ isValidating.value = true
+ inputError.value = ''
+ try {
+ api.reinitializeAPIKey()
+ const isValid = await api.validateAPIKey()
+ emit('refresh', isValid)
+ if (!isValid) {
+ inputError.value = 'No valid API key found β enter one above'
+ }
+ } catch (error) {
+ console.error('API key refresh error:', error)
+ inputError.value = error instanceof Error ? error.message : 'Refresh failed'
+ emit('refresh', false)
+ } finally {
+ isValidating.value = false
+ }
}
function handleClose() {
diff --git a/frontend/src/components/ServerCard.vue b/frontend/src/components/ServerCard.vue
index 9f7336914..7c49ea071 100644
--- a/frontend/src/components/ServerCard.vue
+++ b/frontend/src/components/ServerCard.vue
@@ -85,7 +85,14 @@
-