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: never advertise a retry the scheduler is not actually going to run
[._.]/ Adam Eivyea870d39a05f
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsxindex ece81c6d54..76f827fd0c 100644--- a/client/src/components/cos/tabs/MindTab.jsx+++ b/client/src/components/cos/tabs/MindTab.jsx@@ -118,7 +118,10 @@ const MindTurnIndicator = ({ progress }) => {const detail = [progress.stage, progress.detail].filter(Boolean).join(' · ');if (progress.phase === 'thinking') {- const typingLabel = detail ? `Chief of Staff is typing — ${detail}` : 'Chief of Staff is typing';+ // Stage only: it changes when the turn genuinely moves on, while the+ // elapsed/heartbeat text re-renders on every 10s poll and would otherwise+ // re-announce the same state endlessly.+ const typingLabel = progress.stage ? `Chief of Staff is typing — ${progress.stage}` : 'Chief of Staff is typing';return (<spandata-testid="mind-typing-indicator"@@ -897,7 +900,7 @@ export default function MindTab() {</div><p className="mt-3 text-sm text-port-text-muted">{turnProgress.phase === 'stalled' ? 'No heartbeat from the current turn — checking whether it is still alive.'- : turnProgress.phase === 'blocked' ? `${turnProgress.reason || 'Blocked'} — the mind retries on its own; no action needed.`+ : turnProgress.phase === 'blocked' ? `${turnProgress.reason || 'Blocked'}${turnProgress.retryAt ? ' — the mind retries on its own; no action needed.' : '. No retry is scheduled.'}`: turnProgress.phase === 'thinking' ? `${turnProgress.stage || 'Working through the current turn'}.`: state?.pauseReason || (state?.started ? 'Listening for messages and scheduled wakes.' : 'Configure the AI profile to begin.')}</p>diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsxindex 31081652f2..974e4652f5 100644--- a/client/src/components/cos/tabs/MindTab.test.jsx+++ b/client/src/components/cos/tabs/MindTab.test.jsx@@ -660,9 +660,10 @@ describe('MindTab', () => {renderTab();const indicator = await screen.findByTestId('mind-typing-indicator');- expect(indicator).toHaveAccessibleName(/Waiting on the model/);- expect(indicator).toHaveAccessibleName(/2m 40s/);- expect(indicator).toHaveAccessibleName(/heartbeat 5s ago/);+ expect(indicator).toHaveTextContent('Waiting on the model · 2m 40s · heartbeat 5s ago · model loaded');+ // The announced name is the stage alone: the durations re-render every 10s+ // poll, and putting them in a live region re-reads the same state forever.+ expect(indicator).toHaveAccessibleName('Chief of Staff is typing — Waiting on the model');expect(await screen.findByTestId('mind-turn-progress-detail')).toHaveTextContent('2m 40s · heartbeat 5s ago · model loaded');});diff --git a/client/src/lib/mindTurnProgress.js b/client/src/lib/mindTurnProgress.jsindex fc3743edaa..4aac964d35 100644--- a/client/src/lib/mindTurnProgress.js+++ b/client/src/lib/mindTurnProgress.js@@ -126,13 +126,15 @@ export function describeMindTurnProgress({ state, runtime, events } = {}) {phase,busy,stage: busy ? mindTurnStage(state, events) : null,- // A usage-limit autopause clears `nextEligibleWakeAt` (no backoff gate, no- // failureCount climb), so its schedule lives only in the readiness probe- // the runtime endpoint reports. Read the probe first and fall back to the- // ordinary backoff gate, which is what a degraded wake uses instead.- retryAt: phase === 'blocked'- ? trimmed(runtime?.usageLimitRetryAt) || trimmed(state?.nextEligibleWakeAt)- : null,+ // Each block reads its OWN retry axis. A usage-limit autopause clears+ // `nextEligibleWakeAt` (no backoff gate, no failureCount climb), so its+ // schedule lives only in the readiness probe; a degraded wake sets the+ // backoff gate and has no probe. Reading the probe for both would let a+ // leftover quota schedule stand in for a degraded wake's real retry.+ retryAt: phase !== 'blocked' ? null+ : state?.usageLimited === true+ ? trimmed(runtime?.usageLimitRetryAt)+ : trimmed(state?.nextEligibleWakeAt),reason: phase === 'blocked' ? trimmed(state?.pauseReason) : null,detail: parts.length > 0 ? parts.join(' · ') : null,};diff --git a/client/src/lib/mindTurnProgress.test.js b/client/src/lib/mindTurnProgress.test.jsindex d0f2b6c1ce..eccdf263c4 100644--- a/client/src/lib/mindTurnProgress.test.js+++ b/client/src/lib/mindTurnProgress.test.js@@ -115,13 +115,14 @@ describe('describeMindTurnProgress', () => {});it('treats a degraded wake as blocked so a failing provider is not read as working', () => {+ const degradedState = { status: 'degraded', started: true, activeTurnId: null, usageLimited: false, pauseReason: 'Provider unavailable or wake failed', nextEligibleWakeAt: '2026-09-01T00:05:00.000Z' };const progress = describeMindTurnProgress({- state: { status: 'degraded', started: true, activeTurnId: null, usageLimited: false, pauseReason: 'Provider unavailable or wake failed', nextEligibleWakeAt: '2026-09-01T00:05:00.000Z' },+ state: degradedState,+ // A leftover quota probe time must NOT stand in for this wake's own gate.+ runtime: { usageLimitRetryAt: '2026-09-01T09:00:00.000Z' },});expect(progress.phase).toBe('blocked');- // Falls back to the backoff gate, which a degraded wake (unlike a quota- // autopause) really does set.expect(progress.retryAt).toBe('2026-09-01T00:05:00.000Z');});diff --git a/server/services/persistentMindSupervisor.js b/server/services/persistentMindSupervisor.jsindex 0d6254374f..e79388d6e4 100644--- a/server/services/persistentMindSupervisor.js+++ b/server/services/persistentMindSupervisor.js@@ -266,8 +266,13 @@ function scheduleUsageLimitProbe(attempt = 0) {* user actually has while waiting one out.*/export function persistentMindUsageLimitRetryAt() {- const nextRunAt = getEvent(PERSISTENT_MIND_USAGE_LIMIT_PROBE_EVENT_ID)?.nextRunAt;- return Number.isFinite(nextRunAt) ? new Date(nextRunAt).toISOString() : null;+ const event = getEvent(PERSISTENT_MIND_USAGE_LIMIT_PROBE_EVENT_ID);+ // A fired one-shot nulls its own nextRunAt, but a PAUSED event keeps a future+ // one it will never honour, and a probe scheduled before a clock jump can sit+ // in the past. Both would advertise a retry that is not coming, which is worse+ // than saying nothing: the whole point is to stop the user guessing.+ if (!event?.active || !Number.isFinite(event.nextRunAt) || event.nextRunAt <= Date.now()) return null;+ return new Date(event.nextRunAt).toISOString();}/**diff --git a/server/services/persistentMindSupervisor.test.js b/server/services/persistentMindSupervisor.test.jsindex 496fdd78b2..ffcfd0de58 100644--- a/server/services/persistentMindSupervisor.test.js+++ b/server/services/persistentMindSupervisor.test.js@@ -10,6 +10,7 @@ import {const mock = vi.hoisted(() => ({root: null,scheduled: new Map(),+ events: new Map(),emitted: [],budget: { withinBudget: true, exceeded: null },budgetError: null,@@ -51,6 +52,7 @@ vi.mock('./eventScheduler.js', () => ({return config;}),cancel: vi.fn((id) => mock.scheduled.delete(id)),+ getEvent: vi.fn((id) => mock.events.get(id) || null),}));vi.mock('./domainUsage.js', () => ({@@ -1544,4 +1546,31 @@ describe('persistent mind supervisor', () => {expect(mock.scheduled.has(supervisor.PERSISTENT_MIND_WAKE_EVENT_ID)).toBe(false);});});+describe('usage-limit retry time', () => {+ const PROBE_ID = 'cos-persistent-mind-usage-limit-probe';+ beforeEach(() => mock.events.clear());++ it('reports the pending probe as the retry time', () => {+ const nextRunAt = Date.now() + 15 * 60_000;+ mock.events.set(PROBE_ID, { id: PROBE_ID, active: true, nextRunAt });++ expect(supervisor.persistentMindUsageLimitRetryAt()).toBe(new Date(nextRunAt).toISOString());+ });++ it('reports nothing rather than a retry that is not coming', () => {+ expect(supervisor.persistentMindUsageLimitRetryAt()).toBeNull();++ // A fired one-shot: the scheduler nulls its own next run.+ mock.events.set(PROBE_ID, { id: PROBE_ID, active: true, nextRunAt: null });+ expect(supervisor.persistentMindUsageLimitRetryAt()).toBeNull();++ // Paused: it keeps a future time it will never honour.+ mock.events.set(PROBE_ID, { id: PROBE_ID, active: false, nextRunAt: Date.now() + 60_000 });+ expect(supervisor.persistentMindUsageLimitRetryAt()).toBeNull();++ // Stale: scheduled before a clock jump, so the time already passed.+ mock.events.set(PROBE_ID, { id: PROBE_ID, active: true, nextRunAt: Date.now() - 60_000 });+ expect(supervisor.persistentMindUsageLimitRetryAt()).toBeNull();+ });+ });});