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: clear schedulingBusy when a goal time-block request fails so the buttons re-arm (#3517)
[._.]/ Adam Eivyc83fed114003
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5c0504a134..4c4d110b1c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -103,6 +103,8 @@- **[issue-3524] Brain's RSS feeds were unreadable on a phone — the feed picker and the article list were jammed side by side in two narrow strips.** The Feeds tab lays its desktop sidebar and its item list out as a flex row, and the row direction was unconditional: below `md` the sidebar hides and a `<select>` feed picker takes its place, but that picker and the item list were still being laid out as columns next to each other, squeezing article titles into a sliver and pushing the page wider than the viewport. The container now stacks vertically by default and only becomes a row from `md` up, so the picker sits above a full-width list on a phone while desktop keeps the sidebar beside the list exactly as before. The picker also stops carrying its own bottom margin — that margin did nothing in a row and would have doubled up with the container's gap once stacked — and no longer shrinks when a long list of items competes for the same vertical space.+- **[issue-3517] A failed "Schedule Time Blocks" left the goal's scheduling buttons stuck on "Scheduling..." until you reloaded the page.** Scheduling, rescheduling, and removing a goal's time blocks each raised a shared busy flag before their request and lowered it afterwards, but nothing caught a rejection — so a server error or a dropped connection aborted the handler before the flag came back down, and all three buttons stayed disabled with no way to retry short of reloading. The three now share one runner that always clears the flag, and the panel refreshes afterwards whether or not the request succeeded, because a scheduling run can write some blocks before it fails and leaving that half-written state off screen is the more confusing outcome. The failure itself still surfaces exactly once, from the shared request helper, rather than picking up a second toast of its own.+## Three.js Models- **[issue-3481] A generated model now tells you which of its own promises it did not actually build.** The spec check only ever proved that every feature the model listed pointed at a real part — so a spec could name eight defining features, aim all eight at the same box, and still validate clean: one fused mesh wearing a photograph. Each finished generation is now measured against its own inventory and the result is shown on the model's page: features collapsed onto a single shared part, geometry no feature claims, and features nothing was built for at all. Severity follows how much of the subject rides on the miss — a missing defining feature is an error, fine relief folded into the piece it sits on is called out as the correct modeling choice rather than a defect. When you hit Refine without typing your own notes, the refinement pass is now aimed at exactly those errors instead of a generic "improve it." The page states the check's honest limit alongside the findings: it proves the model built what its spec promised, never that the spec promised enough.diff --git a/client/src/hooks/useGoalDetail.js b/client/src/hooks/useGoalDetail.jsindex 88d1d4bc7a..b3f4c30c14 100644--- a/client/src/hooks/useGoalDetail.js+++ b/client/src/hooks/useGoalDetail.js@@ -145,26 +145,25 @@ export function useGoalDetail({ goal, allGoals, onClose, onRefresh }) {onRefresh();};- const handleSchedule = async () => {+ // The three time-block actions share one busy flag, so they share one runner+ // (issue #3517). Swallowing the rejection is what clears `schedulingBusy` on a+ // failed request — without it the buttons latch on "Scheduling..." forever and+ // the only recovery is a full page reload. No custom toast here on purpose:+ // `request()` already toasts the failure, so this stays a single-layer error UI.+ // The refresh runs either way, because a failed schedule/reschedule can still+ // have written some blocks before erroring and the panel should show reality.+ const runSchedulingAction = async (action) => {setSchedulingBusy(true);- await api.scheduleGoalTimeBlocks(goal.id);+ await action(goal.id).catch(() => null);setSchedulingBusy(false);onRefresh();};- const handleRemoveSchedule = async () => {- setSchedulingBusy(true);- await api.removeGoalSchedule(goal.id);- setSchedulingBusy(false);- onRefresh();- };+ const handleSchedule = () => runSchedulingAction(api.scheduleGoalTimeBlocks);- const handleReschedule = async () => {- setSchedulingBusy(true);- await api.rescheduleGoalTimeBlocks(goal.id);- setSchedulingBusy(false);- onRefresh();- };+ const handleRemoveSchedule = () => runSchedulingAction(api.removeGoalSchedule);++ const handleReschedule = () => runSchedulingAction(api.rescheduleGoalTimeBlocks);const handleDelete = async () => {await api.deleteGoal(goal.id);diff --git a/client/src/hooks/useGoalDetail.test.jsx b/client/src/hooks/useGoalDetail.test.jsxnew file mode 100644index 0000000000..6d66ff774e--- /dev/null+++ b/client/src/hooks/useGoalDetail.test.jsx@@ -0,0 +1,101 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { renderHook, act } from '@testing-library/react';++const getActivities = vi.fn(() => Promise.resolve([]));+const getCalendarAccounts = vi.fn(() => Promise.resolve([]));+const scheduleGoalTimeBlocks = vi.fn(() => Promise.resolve({}));+const removeGoalSchedule = vi.fn(() => Promise.resolve({}));+const rescheduleGoalTimeBlocks = vi.fn(() => Promise.resolve({}));++vi.mock('../services/api', () => ({+ getActivities: (...args) => getActivities(...args),+ getCalendarAccounts: (...args) => getCalendarAccounts(...args),+ scheduleGoalTimeBlocks: (...args) => scheduleGoalTimeBlocks(...args),+ removeGoalSchedule: (...args) => removeGoalSchedule(...args),+ rescheduleGoalTimeBlocks: (...args) => rescheduleGoalTimeBlocks(...args)+}));++const { useGoalDetail } = await import('./useGoalDetail');++const GOAL = { id: 'goal-1', title: 'Example Goal', horizon: 'quarter', category: 'health' };++const renderGoalDetail = (onRefresh = vi.fn()) => ({+ onRefresh,+ ...renderHook(() => useGoalDetail({ goal: GOAL, allGoals: [GOAL], onClose: vi.fn(), onRefresh }))+});++// Each row is [handler name, the mocked api fn it must call].+const SCHEDULING_ACTIONS = [+ ['handleSchedule', () => scheduleGoalTimeBlocks],+ ['handleRemoveSchedule', () => removeGoalSchedule],+ ['handleReschedule', () => rescheduleGoalTimeBlocks]+];++describe('useGoalDetail scheduling actions', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ getActivities.mockResolvedValue([]);+ getCalendarAccounts.mockResolvedValue([]);+ scheduleGoalTimeBlocks.mockResolvedValue({});+ removeGoalSchedule.mockResolvedValue({});+ rescheduleGoalTimeBlocks.mockResolvedValue({});+ });++ it.each(SCHEDULING_ACTIONS)('%s calls its endpoint with the goal id and clears busy on success', async (handler, apiFn) => {+ const { result, onRefresh } = renderGoalDetail();++ await act(async () => { await result.current[handler](); });++ expect(apiFn()).toHaveBeenCalledWith(GOAL.id);+ expect(result.current.schedulingBusy).toBe(false);+ expect(onRefresh).toHaveBeenCalledTimes(1);+ });++ it.each(SCHEDULING_ACTIONS)('%s flips schedulingBusy true while the request is in flight', async (handler, apiFn) => {+ let release;+ apiFn().mockReturnValue(new Promise((resolve) => { release = resolve; }));+ const { result } = renderGoalDetail();++ let pending;+ act(() => { pending = result.current[handler](); });+ expect(result.current.schedulingBusy).toBe(true);++ await act(async () => { release({}); await pending; });+ expect(result.current.schedulingBusy).toBe(false);+ });++ // Issue #3517: a rejected request used to abort before setSchedulingBusy(false),+ // latching every scheduling button on "Scheduling..." until a full page reload.+ it.each(SCHEDULING_ACTIONS)('%s clears schedulingBusy when the request rejects', async (handler, apiFn) => {+ apiFn().mockRejectedValue(new Error('server exploded'));+ const { result, onRefresh } = renderGoalDetail();++ await act(async () => { await result.current[handler](); });++ expect(result.current.schedulingBusy).toBe(false);+ // The panel still refreshes so a partially-written schedule shows real state.+ expect(onRefresh).toHaveBeenCalledTimes(1);+ });++ it.each(SCHEDULING_ACTIONS)('%s can be retried after a failure', async (handler, apiFn) => {+ apiFn().mockRejectedValueOnce(new Error('server exploded'));+ const { result } = renderGoalDetail();++ await act(async () => { await result.current[handler](); });+ expect(result.current.schedulingBusy).toBe(false);++ // The retry is the click that was impossible while the flag stayed latched.+ await act(async () => { await result.current[handler](); });+ expect(apiFn()).toHaveBeenCalledTimes(2);+ expect(result.current.schedulingBusy).toBe(false);+ });++ it('does not surface a rejection to the caller as an unhandled promise', async () => {+ scheduleGoalTimeBlocks.mockRejectedValue(new Error('server exploded'));+ const { result } = renderGoalDetail();++ await act(async () => {+ await expect(result.current.handleSchedule()).resolves.toBeUndefined();+ });+ });+});