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: report actual foundation judge routing
[._.]/ Adam Eivy8dd7cda82018
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex dd7b53aaf1..344d1cc1f6 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -36,6 +36,8 @@## Fixed+- Foundation-judge completion logs now report the provider and model that actually produced the verdict after fallback, rather than the primary pair that was requested. The persisted snapshot already distinguished requested from actual routing; live Autopilot supervision now tells the same truth.+- **Stopping a one-shot AI run no longer poisons provider health or repeats the work on a fallback.** PortOS restarts and the Runs UI both terminate an in-flight TUI with a signal. That intentional exit was previously finalized as an ordinary provider failure; worse, the error classifier scanned the whole prompt/screen, so an unrelated story word such as “credit” could relabel the stop as quota exhaustion, bench a healthy provider for an hour, queue an investigation, and begin the same expensive stage on a fallback while the server was already shutting down. External run stops are now tracked explicitly, host shutdown uses the existing process lifecycle latch, and both paths finalize as canceled: the run remains diagnosable in history but skips provider error analysis, failure hooks, fallback tiers, and health penalties. An unexpected PTY signal remains a real failure.- **iCloud materialization logs now say a download was *requested*, not that the file is local.** `brctl download` returns exit 0 the moment it accepts and queues the request — it does not block until the bytes arrive, and it returns 0 even when the sync layer ultimately can't fetch the file. The on-demand materialize path logged that exit 0 as "materialized from iCloud", so an operator reading these lines during an iCloud outage would conclude a file was readable when it was still dataless. The logs now report the request, and the code comments spell out that the read path (`readStoreAtPathResult`/`readIfMaterialized`) fails closed — rejecting a dataless file rather than reading it — which is the reason the subsequent re-read stays safe and must not be removed. No behavior change.diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.jsindex 3a1456cf6e..fe217369ac 100644--- a/server/services/pipeline/foundationJudge.js+++ b/server/services/pipeline/foundationJudge.js@@ -664,7 +664,9 @@ export async function judgeFoundation(seriesId, { providerId, model, effort, for...judge,};await saveSnapshot(snapshot);- console.log(`🏛️ foundation judge — series=${seriesId.slice(0, 12)} weighted=${judge.weightedScore} target=${weak?.dimension || '—'}(${weak?.score ?? '—'}) via ${judgeProvider.id}/${judgeModel || '(default)'}`);+ const actualProviderId = result.providerId || judgeProvider.id;+ const actualModel = result.model || judgeModel || '(default)';+ console.log(`🏛️ foundation judge — series=${seriesId.slice(0, 12)} weighted=${judge.weightedScore} target=${weak?.dimension || '—'}(${weak?.score ?? '—'}) via ${actualProviderId}/${actualModel}`);return snapshot;}diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.jsindex 5c0499912a..16f80a4b8f 100644--- a/server/services/pipeline/foundationJudge.test.js+++ b/server/services/pipeline/foundationJudge.test.js@@ -447,16 +447,25 @@ describe('judgeFoundation — cache / fast-pass', () => {it('runs the judge (writer/judge split) and persists a hashed snapshot on a fresh foundation', async () => {seriesSvc.getSeries.mockResolvedValue({ id: 'ser-1', name: 'S', universeId: null });+ const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});stageRunner.runStagedLLM.mockResolvedValue({content: { dimensions: dims({ worldbuilding: 7, character: 7, structure: 7, craft: 7 }), oneLineVerdict: 'v' },- providerId: 'judge-x', model: 'jm-heavy', runId: 'run-1',+ providerId: 'fallback-y', model: 'fallback-model', runId: 'run-1',});const out = await judgeFoundation('ser-1', { force: true });expect(out.status).toBe('complete');expect(out.weightedScore).toBe(7);expect(out.sourceInputsHash).toBeTruthy();+ expect(out).toMatchObject({+ providerId: 'fallback-y',+ model: 'fallback-model',+ judgeProviderId: 'judge-x',+ judgeModel: 'jm-heavy',+ });+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('via fallback-y/fallback-model'));expect(fileUtils.atomicWrite).toHaveBeenCalled();expect(stageRunner.resolveJudgeForStage).toHaveBeenCalled();+ logSpy.mockRestore();});});