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: keep a way back when the archived apps filter empties (#3434)
[._.]/ Adam Eivya95dfdc67ed6
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8d7e1a4713..447ff87e62 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -54,3 +54,4 @@- **A quota status read never blocks — on either page.** `/api/quota-burn` and `/api/usage/providers` answer a cold cache with `pending: true` cards; the UI renders "reading quota…" and polls (via the shared `useAutoRefetch`, so it pauses on a hidden tab) until the readings land. `pending` is its own state ahead of the verdict everywhere it is rendered: on a Quota Burn family card, and on the Usage page's `ProviderQuotaCard`, which would otherwise have shown a pending provider as "No rate-limit data reported" — a verdict about the provider rather than a statement about a scrape still in flight. It fails closed in the burn gate ladder, ahead of the error branch and holding even under force, so a card with no numbers on it can never become a burn candidate. `?refresh=1` — the Refresh button, and every runner cycle about to spend real quota — still waits for a live reading.- **Quota-burn agents run as TUI, so a burn can be watched and steered.** A burn runs unattended for minutes on the user's own subscription, and the family's provider was picked with a plain `find` over the enabled CLI/TUI providers — which returns the CLI, because that is what sorts first. Every dispatch therefore went to a headless run that could only be read after it finished. The picker now prefers the TUI (the same preference `pickScrapeProvider` applies when reading `/usage`), so the agent shows up in Active Agents with a live terminal. Two selection bugs came out with it: the whole **`agy` family was unreachable** — its providers ship as `antigravity-cli`/`antigravity-tui`, neither of which contains "agy", so a configured Antigravity plan reported "no enabled CLI/TUI provider" forever while the quota card above it showed a healthy window (the card's matcher checks the *command*; the burn picker only checked the id, and now checks both) — and an **ollama-backed wrapper was eligible**: `claude-ollama-tui` matches the claude family and is a TUI, but it runs a local model, so burning through it spends nothing and lets the window it was meant to drain expire unused. `resolveEnabledFamilies` already excludes those from the quota cards for the same reason; the burn picker now excludes them too, explicit pin included.- **A provider's reset time is an instant, not the wording its CLI happened to use.** Two of the four quota adapters put a raw panel string on the wire — claude's `Aug 4 at 1:59pm` plus a separate `timezone` field, grok's year-less `August 10, 06:07` — so the Usage page printed those two verbatim while codex and agy rendered properly: the same field, formatted two ways on one screen, with no localization and no relative time. The parsing stays in `server/lib/quotaReset.js` but is now exported as `parseHumanReset(str, { now, timezone })` and called from `parseLimitLine` and `parseGrokUsage`, so `resetsAt` is ISO 8601 (or `null` when unreadable) for all four families and a fifth provider's dialect belongs in its own adapter rather than in the shared choke point. Both parsers take `now` explicitly, as `parseAgyUsage` already did. `normalizeResetAt` keeps its wall-clock fallback — a reading off an older federated peer still carries the raw string and must not regress to "no window states a reset time" — but every in-tree adapter now hits its `hasExplicitZone` fast path. The Usage page localizes the instant and adds the countdown (`Aug 4, 1:59 PM (in 3h)`). (#3433)+- **Unarchiving your last archived app no longer strands you on a blank Apps page.** The Active/Archived toggle only rendered while at least one archived app existed, and `showArchived` was local state with nothing to reset it — so unarchiving the last one unmounted the only control on screen and left a permanently empty "No archived apps" card, recoverable only by navigating away and back. The filter now lives in the URL (`/apps?view=archived`), so the archived list is linkable and reload-safe; the toggle stays mounted while the archived view is open even once it empties (reading `Active (N)`), and the empty state gained a "Back to active apps" button. (#3434)diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsxindex b796e13172..54acd19c08 100644--- a/client/src/pages/Apps.jsx+++ b/client/src/pages/Apps.jsx@@ -11,6 +11,7 @@ import KanbanBoard from '../components/KanbanBoard';import StatusBadge from '../components/StatusBadge';import ActivityLog from '../components/apps/ActivityLog';import { useAppOperation } from '../hooks/useAppOperation';+import useUrlParams from '../hooks/useUrlParams';import * as api from '../services/api';import socket from '../services/socket';import { NON_PM2_TYPES, getAppTypeLabel } from '../components/apps/constants';@@ -26,7 +27,13 @@ export default function Apps() {const [refreshingConfig, setRefreshingConfig] = useState({});const [building, setBuilding] = useState({});const [archiving, setArchiving] = useState({});- const [showArchived, setShowArchived] = useState(false);+ // The archived filter lives in the URL (`/apps?view=archived`) so the archived+ // list is linkable/bookmarkable and — critically — survivable: unarchiving the+ // last archived app used to strand the user on an empty card with no control+ // to get back (#3434).+ const [searchParams, updateParams] = useUrlParams();+ const showArchived = searchParams.get('view') === 'archived';+ const setShowArchived = (next) => updateParams({ view: next ? 'archived' : null });const [jiraTickets, setJiraTickets] = useState({});const [loadingTickets, setLoadingTickets] = useState({});// Per-row "…" trigger refs, so dismissing a row's delete confirmation hands@@ -162,10 +169,11 @@ export default function Apps() {<p className="text-gray-500 text-sm sm:text-base">Manage registered applications</p></div><div className="flex items-center gap-3">- {/* Archive Toggle */}- {archivedApps.length > 0 && (+ {/* Archive Toggle — stays mounted while the archived view is open even+ once it empties, so the way back never disappears. */}+ {(showArchived || archivedApps.length > 0) && (<button- onClick={() => setShowArchived(prev => !prev)}+ onClick={() => setShowArchived(!showArchived)}className={`px-3 py-2 rounded-lg text-sm flex items-center gap-2 transition-colors ${showArchived? 'bg-port-warning/20 text-port-warning border border-port-warning/30'@@ -195,7 +203,14 @@ export default function Apps() {<p className="text-gray-500 mb-6">{showArchived ? 'Archived apps will appear here' : 'Register your first app to monitor its health, restart it, and surface it on your dashboard.'}</p>- {!showArchived && (+ {showArchived ? (+ <button+ onClick={() => setShowArchived(false)}+ className="inline-block px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors"+ >+ Back to active apps+ </button>+ ) : (<Linkto="/apps/create"className="inline-block px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors"diff --git a/client/src/pages/Apps.test.jsx b/client/src/pages/Apps.test.jsxindex 2553b62ab2..fdf37f2835 100644--- a/client/src/pages/Apps.test.jsx+++ b/client/src/pages/Apps.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen, waitFor } from '@testing-library/react';+import { act, render, screen, waitFor } from '@testing-library/react';import userEvent from '@testing-library/user-event';import { MemoryRouter } from 'react-router';@@ -39,8 +39,11 @@ vi.mock('../services/socket', () => ({}));import * as api from '../services/api';+import socket from '../services/socket';import Apps from './Apps';+const ARCHIVED_APP = { ...APPS[0], archived: true };+const renderApps = async () => {render(<MemoryRouter><Apps /></MemoryRouter>);await screen.findByRole('link', { name: 'Example App' });@@ -134,3 +137,48 @@ describe('Apps row action hierarchy', () => {expect(screen.queryByRole('button', { name: /More actions/ })).toBeNull();});});++describe('Apps archived filter', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ api.getApps.mockResolvedValue([ARCHIVED_APP]);+ });++ // Fire the `apps:changed` handler the page registered, so the list refreshes+ // exactly the way it does in the app after an archive/unarchive round-trip.+ const emitAppsChanged = async () => {+ const [, handler] = socket.on.mock.calls.find(([evt]) => evt === 'apps:changed');+ await act(async () => { await handler(); });+ };++ it('opens the archived list directly from /apps?view=archived', async () => {+ render(<MemoryRouter initialEntries={['/apps?view=archived']}><Apps /></MemoryRouter>);++ await screen.findByRole('link', { name: 'Example App' });+ expect(screen.getByRole('button', { name: /Active \(0\)/ })).toBeTruthy();+ });++ it('leaves a way back to the active list after the last archived app is unarchived', async () => {+ const user = userEvent.setup();+ render(<MemoryRouter initialEntries={['/apps']}><Apps /></MemoryRouter>);++ await user.click(await screen.findByRole('button', { name: /Archived \(1\)/ }));+ await screen.findByRole('link', { name: 'Example App' });++ await user.click(screen.getByRole('button', { name: 'More actions for Example App' }));+ await user.click(screen.getByRole('menuitem', { name: 'Unarchive' }));+ await waitFor(() => expect(api.unarchiveApp).toHaveBeenCalledWith('app-alpha'));++ // The archive is now empty, which used to unmount the toggle and strand the+ // user on a blank "No archived apps" card.+ api.getApps.mockResolvedValue([{ ...APPS[0], archived: false }]);+ await emitAppsChanged();++ expect(screen.getByText('No archived apps')).toBeTruthy();+ expect(screen.getByRole('button', { name: /Active \(1\)/ })).toBeTruthy();++ await user.click(screen.getByRole('button', { name: 'Back to active apps' }));+ await screen.findByRole('link', { name: 'Example App' });+ expect(screen.queryByText('No archived apps')).toBeNull();+ });+});