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

Give dashboard "Add widget?" suggestions a visible result

Adam Eivy158d1e7f4415
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 594b7238fe..aa00f6aa1b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -38,6 +38,7 @@
Three things around it were wrong in the same way. The stack rendered in grid-array order, but `placeAndCompact` hoists the moved item to the front of that array on every desktop drag — so a phone showed the most recently moved widget first regardless of where it had been dropped; reading order (`y`, then `x`) is now what both the stack and the DOM/tab order follow. Saving an arrangement left the layout's `widgets` list in its old order, so the layout editor listed widgets in an order the dashboard didn't show; it's rewritten to the grid's reading order on save. And the edit-mode hint picked its wording from a CSS `sm:` breakpoint while the grid picks its mode from its own measured container — page padding makes the container narrower, so in a ~30px band the hint described handles that weren't on screen. The grid reports its mode to the page now, so there is one seam instead of two.
+- **Tapping a dashboard "Add <widget>?" suggestion chip just made it vanish with no visible result.** The chip did add the widget to the active layout, but new widgets append at the bottom of the grid — off-screen on the single-column mobile stack — and nothing confirmed the add, so the suggestion read as a dead button that dismissed itself. Adding one now raises a success toast naming the widget ("Added Daily Driver to your dashboard") and smooth-scrolls the newly-placed widget into view, so the action produces a result the user can actually see. Each grid cell carries a `data-widget-id` so the scroll can target the just-added one; the pending scroll is scoped to the layout it was added on and only fires while that layout is still active, so switching layouts mid-save can't scroll to an unrelated widget.
- **Quota-burn tasks were queued and then never picked up, so the window they were meant to spend expired unspent anyway.** Three separate faults, each of which alone was enough to strand a burn. First, a queued burn inherited the per-app *review cooldown* — a 30-minute throttle re-stamped by every task that completes on that app. On an app that carries any other recurring CoS work (a perpetual claim-issue drain, which is itself exempt from the cooldown and therefore keeps completing) the cooldown never lapses, so the burn task sat in Pending indefinitely while agents ran past it. The cooldown was never this task's throttle: the burn plan's own gate ladder — the reset horizon, the family's reserve, and `maxDispatchesPerWindow` — is checked before the task is queued at all, so burns now bypass it, as pipeline continuations and perpetual drains already did. Tasks already queued carry no marker, so migration 225 back-fills it onto them rather than leaving them stranded — and a stranded burn is worse than late, because `addTask` dedupes on description + app, so a pending twin makes the runner report "an identical burn task is already pending" and that job in the plan is permanently unreachable. Second, the runner always walked the family's job plan from the top, and an `agent-prompt` job always probes as "work pending" (its probe only checks that an app and a provider resolve) — so job #1 won every dispatch forever and the other seven audits in an eight-job plan never ran once. The walk now resumes after the family's last dispatch, read from the run log rather than a second cursor file, and still runs the first job with pending work from there, so a probing job like `universe-bible-images` keeps its ordering. Third, the plan only advanced once per `checkIntervalMinutes` — at the 12-hour default, two dispatches a day against an allowance of five on a five-hour window. Each finished burn agent now re-evaluates its own family, so the plan is walked one agent at a time until a gate actually closes; the chain is bounded by the same ledger every other cycle charges, and switching the feature off ends it immediately. That re-evaluation reads only the burning family's quota card rather than respawning every enabled provider's TUI for numbers it then discards — a per-family scrape the usage page already asked for this way.
- **Quota Burn was watching the 5-hour window and calling it the weekly one, so its one real gate never gated anything — and it kept dispatching after the provider started refusing.** Every subscription family publishes two windows on the same card: a short rolling one (claude/codex `session` ≈ 5h, antigravity `5-hour`) and a long one (`week`, `month`). Selection picked "the soonest-resetting window", and the short one is nearly always the soonest — so a plan written against a weekly allowance showed "62% left · resets in 3h" on its card, `resetWithinHours: 24` was satisfied by a horizon that re-opened every five hours (making "only spend as the window is about to expire" bound nothing at all), and `maxDispatchesPerWindow: 5` silently meant *five burns every five hours* rather than five per week, because the dispatch ledger keyed on the short window's reset. A family now burns against its **target** window — the broadest one in scope, classified by period in the new `server/lib/quotaWindows.js` — and the card names which window its percentage and countdown describe, so the two can never be confused again. The **limiting** window (the narrowest) and the **tightest** window (least headroom, what `reservePercent` already guarded) stay separate concepts, because they answer different questions; the per-family Window scope field still pins the target explicitly for anyone who wants the old behavior. A provider whose window vocabulary this can't classify falls back to soonest-reset ordering rather than parking.
diff --git a/client/src/components/dashboard/DashboardGrid.jsx b/client/src/components/dashboard/DashboardGrid.jsx
index f430285d89..c8e423b246 100644
--- a/client/src/components/dashboard/DashboardGrid.jsx
+++ b/client/src/components/dashboard/DashboardGrid.jsx
@@ -243,7 +243,7 @@ const GridCell = memo(function GridCell({
: `relative w-full h-full overflow-hidden rounded-xl ${editable ? 'ring-1 ring-port-border' : ''}`;
return (
- <div ref={setNodeRef} className={itemClass} style={itemStyle}>
+ <div ref={setNodeRef} data-widget-id={item.id} className={itemClass} style={itemStyle}>
<div className={innerClass}>
{renderItem(item)}
{editable && !isMobile && (
diff --git a/client/src/components/dashboard/DashboardGrid.test.jsx b/client/src/components/dashboard/DashboardGrid.test.jsx
index ab27a71288..974f3b2f16 100644
--- a/client/src/components/dashboard/DashboardGrid.test.jsx
+++ b/client/src/components/dashboard/DashboardGrid.test.jsx
@@ -196,3 +196,16 @@ describe('DashboardGrid desktop', () => {
expect(screen.queryByLabelText('Reorder a')).not.toBeInTheDocument();
});
});
+
+describe('DashboardGrid scroll target', () => {
+ beforeEach(() => { mockWidth = 1200; });
+
+ // The Dashboard scrolls a just-added widget into view by querying
+ // [data-widget-id="…"]; that attribute is the scroll-target contract.
+ it('tags each cell with its widget id', () => {
+ renderGrid();
+ expect(document.querySelector('[data-widget-id="a"]')).not.toBeNull();
+ expect(document.querySelector('[data-widget-id="b"]')).not.toBeNull();
+ expect(document.querySelector('[data-widget-id="c"]')).not.toBeNull();
+ });
+});
diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx
index ae8f5401a1..13b84f624e 100644
--- a/client/src/pages/Dashboard.jsx
+++ b/client/src/pages/Dashboard.jsx
@@ -66,6 +66,17 @@ export default function Dashboard() {
// viewport, so the two disagree in a ~30px band and the hint would describe
// handles that aren't on screen.
const [gridIsMobile, setGridIsMobile] = useState(false);
+ // Widget just added from a suggestion chip, so the render pass that lands it
+ // in the grid can scroll it into view (new widgets append at the bottom —
+ // off-screen on the single-column mobile stack, which made the suggestion
+ // look like it did nothing when it was actually added). Scoped to the layout
+ // it was added on ({ widgetId, layoutId }) so a layout switch mid-save can't
+ // scroll to an unrelated widget that happens to exist in the new layout.
+ const [pendingScroll, setPendingScroll] = useState(null);
+ // Mirrors activeLayoutId for reads inside the async onAdd handler, whose
+ // closure captured a possibly-stale activeLayout — lets it skip arming the
+ // scroll when the user switched layouts while the add was still saving.
+ const activeLayoutIdRef = useRef(null);
const fetchData = useCallback(async () => {
setDataError(null);
@@ -224,8 +235,13 @@ export default function Dashboard() {
// Cancel grid edit mode whenever the user switches layouts so unsaved
// positional edits don't bleed across layouts.
useEffect(() => {
+ activeLayoutIdRef.current = activeLayoutId;
setEditingGrid(false);
setDraftGrid(null);
+ // Drop any pending "scroll the just-added widget into view" — it was armed
+ // against the previous layout, so honoring it after a switch could scroll
+ // to an unrelated widget (or an existing cell) in the new layout.
+ setPendingScroll(null);
}, [activeLayoutId]);
// Stable identity so DashboardGrid's memoized cells actually bail out — a
@@ -259,6 +275,20 @@ export default function Dashboard() {
);
}, [dashboardState]);
+ // Once a just-added widget lands in the rendered grid, scroll it into view
+ // so the "Add <widget>?" suggestion produces a visible result instead of a
+ // chip that silently vanishes.
+ useEffect(() => {
+ if (!pendingScroll) return;
+ // Only honor the scroll on the layout the widget was actually added to —
+ // a save that resolved after a layout switch must not scroll the new one.
+ if (pendingScroll.layoutId !== activeLayout?.id) return;
+ if (!renderGrid.some((item) => item.id === pendingScroll.widgetId)) return;
+ const el = document.querySelector(`[data-widget-id="${CSS.escape(pendingScroll.widgetId)}"]`);
+ el?.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ setPendingScroll(null);
+ }, [pendingScroll, renderGrid, activeLayout]);
+
const startGridEdit = () => {
setDraftGrid(renderGrid);
setEditingGrid(true);
@@ -479,12 +509,20 @@ export default function Dashboard() {
<WidgetSuggestions
presentWidgetIds={activeLayout.widgets}
dashboardState={dashboardState}
- onAdd={(widgetId) => saveLayout({
- id: activeLayout.id,
- name: activeLayout.name,
- widgets: [...activeLayout.widgets, widgetId],
- activateWindow: activeLayout.activateWindow ?? null,
- })}
+ onAdd={async (widgetId) => {
+ const layoutId = activeLayout.id;
+ await saveLayout({
+ id: layoutId,
+ name: activeLayout.name,
+ widgets: [...activeLayout.widgets, widgetId],
+ activateWindow: activeLayout.activateWindow ?? null,
+ });
+ toast.success(`Added ${WIDGETS_BY_ID[widgetId]?.label ?? 'widget'} to your dashboard`);
+ // Only arm the scroll if this layout is still active — a switch
+ // while the save was in flight means the added widget isn't on
+ // screen, so arming would fire a stray scroll on returning here.
+ if (activeLayoutIdRef.current === layoutId) setPendingScroll({ widgetId, layoutId });
+ }}
/>
)}