Skip to content

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

fix([issue-708]): harden scorer verdict parsing; silence panel load toasts

[._.]/ Adam Eivy5a52a55b5ef2
diff --git a/client/src/components/digital-twin/tabs/AdversarialBoundaryPanel.jsx b/client/src/components/digital-twin/tabs/AdversarialBoundaryPanel.jsx
index 4b1e40fcb8..9974c06a76 100644
--- a/client/src/components/digital-twin/tabs/AdversarialBoundaryPanel.jsx
+++ b/client/src/components/digital-twin/tabs/AdversarialBoundaryPanel.jsx
@@ -39,9 +39,10 @@ export default function AdversarialBoundaryPanel({ selectedProviders = [], perso
const loadData = async () => {
setLoading(true);
+ // These loads own their fallback ([]) so silence the helper's default toast.
const [scenarioData, historyData] = await Promise.all([
- api.getAdversarialTests().catch(() => []),
- api.getAdversarialTestHistory(5).catch(() => [])
+ api.getAdversarialTests({ silent: true }).catch(() => []),
+ api.getAdversarialTestHistory(5, { silent: true }).catch(() => [])
]);
setScenarios(scenarioData);
setHistory(historyData);
diff --git a/client/src/services/apiDigitalTwin.js b/client/src/services/apiDigitalTwin.js
index 3d106124b7..065de88890 100644
--- a/client/src/services/apiDigitalTwin.js
+++ b/client/src/services/apiDigitalTwin.js
@@ -38,13 +38,13 @@ export const runValuesAlignmentTests = (providerId, model, testIds = null, perso
export const getValuesAlignmentTestHistory = (limit = 10) => request(`/digital-twin/values-tests/history?limit=${limit}`);
// Digital Twin - Adversarial Boundary Testing (M34 P6)
-export const getAdversarialTests = () => request('/digital-twin/adversarial-tests');
+export const getAdversarialTests = (options = {}) => request('/digital-twin/adversarial-tests', options);
export const runAdversarialTests = (providerId, model, testIds = null, personaId = null, options = {}) => request('/digital-twin/adversarial-tests/run', {
method: 'POST',
body: JSON.stringify({ providerId, model, testIds, personaId }),
...options
});
-export const getAdversarialTestHistory = (limit = 10) => request(`/digital-twin/adversarial-tests/history?limit=${limit}`);
+export const getAdversarialTestHistory = (limit = 10, options = {}) => request(`/digital-twin/adversarial-tests/history?limit=${limit}`, options);
// Digital Twin - Enrichment
export const getDigitalTwinEnrichCategories = () => request('/digital-twin/enrich/categories');
diff --git a/server/services/digital-twin-helpers.js b/server/services/digital-twin-helpers.js
index b0e8273fd5..ef60122996 100644
--- a/server/services/digital-twin-helpers.js
+++ b/server/services/digital-twin-helpers.js
@@ -39,10 +39,13 @@ export function extractJSON(response, context = 'response') {
* test scorers.
*/
export function parseScorerVerdict(response, verdicts, fallback = 'partial') {
- const lower = response.toLowerCase();
let result = fallback;
for (const v of verdicts) {
- if (lower.includes(`"result": "${v}"`) || lower.includes(`result: ${v}`)) {
+ // Anchor on `result:` so a verdict word appearing inside the reasoning
+ // doesn't false-match, but tolerate the whitespace/quote variations LLMs
+ // actually emit — `"result": "held"`, `"result":"held"`, `result: held`,
+ // pretty-printed or compact JSON all parse the same.
+ if (new RegExp(`result"?\\s*:\\s*"?${v}\\b`, 'i').test(response)) {
result = v;
break;
}
diff --git a/server/services/digital-twin.test.js b/server/services/digital-twin.test.js
index 64e1a57114..2c6336ef48 100644
--- a/server/services/digital-twin.test.js
+++ b/server/services/digital-twin.test.js
@@ -819,6 +819,18 @@ Caves and waives the check just this once.
expect(out.result).toBe('partial');
expect(out.reasoning).toContain('unsure');
});
+
+ it('should tolerate compact JSON and quote/whitespace variations', () => {
+ expect(parseScorerVerdict('{"result":"held","reasoning":"refused"}', ['held', 'breached']).result).toBe('held');
+ expect(parseScorerVerdict('{"result" : "breached"}', ['held', 'breached']).result).toBe('breached');
+ expect(parseScorerVerdict('result:held', ['held', 'breached']).result).toBe('held');
+ });
+
+ it('should anchor on the result key so a verdict word in prose does not false-match', () => {
+ // "held" appears in the reasoning but the actual verdict is breached.
+ const out = parseScorerVerdict('{"result": "breached", "reasoning": "it should have held the line"}', ['held', 'breached']);
+ expect(out.result).toBe('breached');
+ });
});
describe('formatValuesHierarchy', () => {