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

harden the sweep panel's finish latch and result-row identity

[._.]/ Adam Eivyab50ad0055b5
diff --git a/client/src/components/settings/AssessmentSweepPanel.jsx b/client/src/components/settings/AssessmentSweepPanel.jsx
index d8cc6c8eac..bdcb4d7aea 100644
--- a/client/src/components/settings/AssessmentSweepPanel.jsx
+++ b/client/src/components/settings/AssessmentSweepPanel.jsx
@@ -182,6 +182,12 @@ export default function AssessmentSweepPanel({ counts, contextTokens = [], onSwe
// parent so its per-model buttons go quiet for the duration.
useEffect(() => { onRunningChange?.(running); }, [running, onRunningChange]);
+ // Re-arm the latch for every queue that starts, not only one started from this
+ // tab: a sweep launched in another tab (or before a reload) would otherwise
+ // finish with the latch still set from a previous run, and this page would
+ // never re-read the ranking it just earned.
+ useEffect(() => { if (running) finishNotifiedRef.current = false; }, [running]);
+
// Poll only while something is running, and only while the tab is visible —
// `useAutoRefetch` gives both, which matters for a queue deliberately left
// running in a background tab all night.
@@ -311,7 +317,7 @@ export default function AssessmentSweepPanel({ counts, contextTokens = [], onSwe
</summary>
<div className="px-3 pb-3 space-y-1">
{status.results.map((result) => (
- <SweepResultRow key={`${result.backend}:${result.modelId}:${result.finishedAt}`} result={result} />
+ <SweepResultRow key={`${result.backend}:${result.modelId}@${result.tuningLabel || ''}`} result={result} />
))}
</div>
</details>
diff --git a/client/src/components/settings/AssessmentSweepPanel.test.jsx b/client/src/components/settings/AssessmentSweepPanel.test.jsx
index 58149d43c4..2ee2af01df 100644
--- a/client/src/components/settings/AssessmentSweepPanel.test.jsx
+++ b/client/src/components/settings/AssessmentSweepPanel.test.jsx
@@ -162,6 +162,22 @@ describe('AssessmentSweepPanel', () => {
expect(await screen.findByText(/sample 2\/3/)).toBeInTheDocument();
});
+ // A sweep started in another tab has to re-arm this tab's finish latch, or its
+ // completion lands with the latch still set from an earlier run and the ranking
+ // it just earned is never re-read.
+ it('re-reads the report when a sweep it did not start finishes', async () => {
+ const onSweepFinished = vi.fn();
+ getLocalLlmAssessmentSweep.mockResolvedValue({ ...idle, status: 'running', total: 2, completed: 1 });
+ renderPanel({ onSweepFinished });
+ await screen.findByText(/1\/2 measured/);
+
+ getLocalLlmAssessmentSweep.mockResolvedValue({ ...idle, status: 'complete', total: 2, completed: 2 });
+ const handler = socket.on.mock.calls.find(([event]) => event === 'localLlm:progress')[1];
+ await act(async () => handler({ scope: 'assessment-sweep', event: 'complete', status: 'complete' }));
+
+ await waitFor(() => expect(onSweepFinished).toHaveBeenCalledTimes(1));
+ });
+
it('offers nothing to press when no runtime lists a model to measure', async () => {
renderPanel({ counts: { unmeasured: 0, stale: 0, all: 0 } });
expect(await screen.findByRole('button', { name: 'Measure all models' })).toBeDisabled();