Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix([issue-708]): self-heal persona picker on values-alignment 404 too
[._.]/ Adam Eivy80c6196faf9b
diff --git a/client/src/components/digital-twin/tabs/TestTab.jsx b/client/src/components/digital-twin/tabs/TestTab.jsxindex 2b027ca287..5ba55bd6ff 100644--- a/client/src/components/digital-twin/tabs/TestTab.jsx+++ b/client/src/components/digital-twin/tabs/TestTab.jsx@@ -110,6 +110,14 @@ export default function TestTab({ onRefresh }) {});};+ // Self-heal the picker when a run is rejected because the selected persona no+ // longer exists (the route guard 404s). Shared by the behavioral runner's+ // catch and the values-alignment panel via the onPersonaNotFound callback.+ const handlePersonaNotFound = () => {+ setSelectedPersonaId('');+ loadData();+ };+const toggleTest = (testId) => {setSelectedTests(prev =>prev.includes(testId) ? prev.filter(id => id !== testId) : [...prev, testId]@@ -148,8 +156,7 @@ export default function TestTab({ onRefresh }) {// self-heal the picker so the next run isn't blocked. The api helper// already toasts the error, so don't add a second one here.if (err?.code === 'NOT_FOUND') {- setSelectedPersonaId('');- loadData();+ handlePersonaNotFound();}} finally {// Always clear the spinner — without this an error (e.g. the 404 above)@@ -680,7 +687,7 @@ export default function TestTab({ onRefresh }) {)}{/* Values-Alignment Tests (M34 P6) — shares the provider + persona selection above */}- <ValuesAlignmentPanel selectedProviders={selectedProviders} personaId={selectedPersonaId} onRefresh={onRefresh} />+ <ValuesAlignmentPanel selectedProviders={selectedProviders} personaId={selectedPersonaId} onPersonaNotFound={handlePersonaNotFound} onRefresh={onRefresh} /></div>);}diff --git a/client/src/components/digital-twin/tabs/ValuesAlignmentPanel.jsx b/client/src/components/digital-twin/tabs/ValuesAlignmentPanel.jsxindex 00d41a1a6d..f07933ac11 100644--- a/client/src/components/digital-twin/tabs/ValuesAlignmentPanel.jsx+++ b/client/src/components/digital-twin/tabs/ValuesAlignmentPanel.jsx@@ -24,7 +24,7 @@ import { timeAgo } from '../../../utils/formatters';* Reuses the provider/model selection from the parent TestTab via the* `selectedProviders` prop so the two suites share one configuration.*/-export default function ValuesAlignmentPanel({ selectedProviders = [], personaId = '', onRefresh }) {+export default function ValuesAlignmentPanel({ selectedProviders = [], personaId = '', onPersonaNotFound, onRefresh }) {const [dilemmas, setDilemmas] = useState([]);const [history, setHistory] = useState([]);const [loading, setLoading] = useState(true);@@ -56,11 +56,13 @@ export default function ValuesAlignmentPanel({ selectedProviders = [], personaIdsetRunning(true);setResults([]);+ // These calls own their error UI below (and one path delegates to the+ // parent), so silence the helper's default toast to avoid double-toasting.const runResults = await Promise.all(selectedProviders.map(({ providerId, model }) =>- api.runValuesAlignmentTests(providerId, model, null, personaId || null)+ api.runValuesAlignmentTests(providerId, model, null, personaId || null, { silent: true }).then(result => ({ providerId, model, ...result }))- .catch(err => ({ providerId, model, error: err.message }))+ .catch(err => ({ providerId, model, error: err.message, code: err?.code }))));@@ -73,7 +75,13 @@ export default function ValuesAlignmentPanel({ selectedProviders = [], personaIdif (fresh.length) setHistory(prev => [...fresh, ...prev].slice(0, 5));setRunning(false);- if (runResults.some(r => r.error)) {+ // A stale/deleted persona is rejected by the same route guard the+ // behavioral runner hits; ask the parent (which owns the picker) to clear+ // it, and show a persona-specific message instead of the generic one.+ if (runResults.some(r => r.code === 'NOT_FOUND')) {+ onPersonaNotFound?.();+ toast.error('That persona no longer exists — switched to the base twin. Try again.');+ } else if (runResults.some(r => r.error)) {toast.error('Some runs failed — check provider availability');} else {toast.success('Values-alignment tests completed');diff --git a/client/src/services/apiDigitalTwin.js b/client/src/services/apiDigitalTwin.jsindex 92d357cd0f..95a623cb38 100644--- a/client/src/services/apiDigitalTwin.js+++ b/client/src/services/apiDigitalTwin.js@@ -30,9 +30,10 @@ export const getDigitalTwinTestHistory = (limit = 10) => request(`/digital-twin/// Digital Twin - Values-Alignment Testing (M34 P6)export const getValuesAlignmentTests = () => request('/digital-twin/values-tests');-export const runValuesAlignmentTests = (providerId, model, testIds = null, personaId = null) => request('/digital-twin/values-tests/run', {+export const runValuesAlignmentTests = (providerId, model, testIds = null, personaId = null, options = {}) => request('/digital-twin/values-tests/run', {method: 'POST',- body: JSON.stringify({ providerId, model, testIds, personaId })+ body: JSON.stringify({ providerId, model, testIds, personaId }),+ ...options});export const getValuesAlignmentTestHistory = (limit = 10) => request(`/digital-twin/values-tests/history?limit=${limit}`);