Repository navigation
fix(ui): scheduled tasks run on the installed GAIA agent and show their failures - #5539
Conversation
…lures On a desktop install every scheduled task failed in under a second with a "not installed" error naming an install command that did not work: the scheduler imported the in-process flagship package, which a desktop install does not ship, while chats relay to the daemon-supervised sidecar binary. - Scheduled runs now pick the agent the way chats do: relay to the flagship sidecar when that is how it is installed, run in process for a wheel or source install. The relay stays fresh per run (no history, no sidecar session), keeps the 5-step cap and memory setting, and a timeout closes the relayed stream so the run stops promptly. - An unattended relayed run denies a tool confirmation at once instead of parking the sidecar until it times out, matching in-process background runs. - A genuinely missing flagship now says to run `gaia init`. - The last run's error is stored on the schedule, exposed as `last_error` by the schedules API, shown on the schedule card, and raised as an error notification (the app polls schedules every 30 s for this).
|
Verdict: Approve with suggestions On a desktop install, scheduled tasks always failed because they tried to load an agent package that only wheel installs ship. They now pick the agent the same way chats do, so they reach the daemon sidecar, and a failed run shows its error on the schedule card and as a notification. I found no correctness problems. The relay path fails loudly in every case I traced: agent error, model failure, no answer, and a stop before or during the run. An unattended tool prompt is denied at once instead of waiting for the timeout. The one gap is the evidence. The PR says a live run on a desktop-style install returned PONG, but it doesn't show that output or a screenshot of the new error line and notification. Pasting the run's result (or the Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on reading the code and the new unit and vitest tests. The relay path, the schedules API and the Agent UI card/notification were not exercised here. 🔍 Technical detailsIssues 🟡 Missing surface evidence: The schedule card error and the Errors-tab notification are visible in the Agent UI, and 🟢 Error card border uses the accent colour ( 🟢 Relay results are read only after the turn ends ( Checked and fine
Strengths
|
A scheduled run on a wheel install that could not reach the model was recorded as a success, so its card showed no error. It now fails like a relayed run does, and last_error carries the message. - The flagship-runs test pins an in-process registration instead of depending on gaia_agent being installed, which CI's core-only install lacks. - The schedule error card's border uses --danger. - Note that the relay drain relies on the unbounded event queue.
|
Addressed all three: the error card's border is now red, the relay drain notes it relies on the unbounded queue, and the PR body now shows a live 🔍 Technical detailsReview suggestions
Found while gathering evidence
CI
Tests run locally
|
|
Merge note: #5538, #5539 and #5569 all touch the schedule form, so the second and third to merge need two small test updates (no product-code conflict beyond one message). 🔍 Technical detailsFound while building all three together:
|
|
Ran this branch (2dabfdf) live on a v0.25.1-rc5 desktop install on a 16 GB Mac, chats on DeepSeek V4.1 Flash (Fireworks). The relay part works: a schedule created through the UI API now reaches the installed sidecar agent instead of failing with "not installed". It still fails, though, because the scheduled run uses the local default model rather than the one the user picked: Next step: run scheduled prompts on the chat's active model (the one |
…5610) Four timing-sensitive unit tests failed 8 unrelated PRs this week (#5537, #5539, #5562, #5563, #5564, #5565, #5566, #5568) and one of main's last 11 completed runs. Each still guards the same bug, but no longer races the clock on a busy runner. Every rewritten test was checked by breaking the code: it fails on the real bug and passes 50/50 runs, including under full CPU load. The PR also keeps three tests out of the developer's real `~/.gaia`. ## Test plan - [x] `pytest tests/unit/mcp/client/test_stdio_hung_server.py tests/unit/test_file_lock.py tests/unit/test_mcp_bridge_concurrency.py tests/unit/chat/ui/test_agent_model_override.py tests/integration/test_folder_indexing.py -n 4`: 316 passed, 3 skipped - [x] The four de-flaked tests, run 50x each: 250/250 serial, and 250/250 under xdist (32 workers) with all 32 cores also running busy loops. Main's versions in that same loaded run: redaction failed 10/50. - [x] Each test fails when its bug is put back in the code (see details) - [x] `tests/integration/test_folder_indexing.py -n 4`, 5 runs: all pass. Main's version fails 7 to 9 tests per run. - [x] Test 841 passes with `GAIA_HOME` set to a temp dir. Main's version fails. - [x] Electron `npx jest`: 1098 passed. The one failure, `test_electron_chat_installer.js` (component size 103,725 > 102,400), also fails on main and is unrelated. - [ ] CI green on Linux, macOS and Windows unit lanes <details> <summary>🔍 Technical details</summary> **`test_redaction_stays_fast_on_dense_escapes`** (Linux, 2.01 to 2.03 s against a 2 s limit) - Cause: an absolute 2 s bound. Locally the worst text takes 0.19 s. On a 4-worker, coverage-traced runner it took about 10x that. - Fix: time one 1M-char text against eight 125K texts with the same total length, on the same machine. Linear code scores about 1.0 and a quadratic scan scores 8, so the test asserts < 3. It takes the best of up to three paired runs, and uses the lower of the wall-clock and CPU (`thread_time`) ratios. Contention inflates wall time, and Windows samples CPU time on ticks. The test also fails if the 1M text takes more than 15 s of CPU, which catches a per-position rescan: that is linear but takes minutes. - Break checks: a quadratic prefix copy in `_candidate_windows` (`len(text[:start].rstrip("\\"))`) gives a ratio of 5.9x and the test fails. Main's 2 s test passed that same regression locally (1.57 s). A per-anchor rescan without merging takes 56 s and hits the 15 s ceiling. **`test_children_of_an_exited_server_are_still_stopped`** (Linux) - Cause: the test slept a fixed 2 s for the child watcher. The watcher backs off (0.5, 1, 2, 4 s…), so on a slow start its next scan came after the launcher had exited and the child was never recorded. - Fix: poll until `child_pid in transport._children`, with a deadline of 3 × `_CHILD_SCAN_MAX_S`. - Break checks: never recording children fails with "never recorded". Clearing `_children` before stopping fails with "kept running". Delaying the watcher's first scan by 2.5 s reproduces the CI failure on main's test, and the new test passes. - Note for the product side: a launcher that spawns a child and exits inside a backoff window still orphans that child. Real `npx`/`uvx` launchers outlive the window. **`test_the_next_waiter_takes_the_lock_within_milliseconds`** (macOS, median 6.5 to 8.1 ms against 5 ms) - Cause: macOS stretches `sleep(0.001)` under load, and the 5 ms median left no headroom. - Fix: the test wraps `_poll_interval`, which records each interval and signals the moment the waiter starts a poll's sleep. The lock is released right then, so the whole interval stands between the waiter and the lock. - Assertions: every interval the front waiter asks for is ≤ 2 ms, and the median hand-off is < 15 ms. A 20 ms poll always waits at least 20 ms, so it fails the median even with the bound widened. - Break checks: `_NEXT_POLL_SECONDS = 0.02` or `0.1` fails the interval assertion. Sleeping `_POLL_SECONDS` directly, so `_poll_interval` is bypassed, fails the median (20.8 ms). **`test_a_dropped_idle_connection_is_logged[True]`** (Linux) - Cause: the test asserted that `"Traceback"` was absent from the stderr captured by `capsys`. The traceback in that run came from a fake Lemonade server that `test_lemonade_shared_server.py` left running on the same xdist worker (`BrokenPipeError`). - Fix: the `serve` fixture records the bridge server's own `handle_error` calls, and the test asserts that list is empty. socketserver calls `handle_error` before it closes the connection, so the check doesn't race. A plugin that writes a traceback to stderr during the test fails main's version and passes the new one. - Break check: making `log_error` also call the base `log_error`, and reverting `str(args[0])`, raises `TypeError` in the handler, and the test fails. **Isolation fixes** - `test_folder_indexing.py`: `temp_folder` now lives in `isolated_gaia_home`, a per-test fake home, so `ensure_within_home` still admits it. Parallel workers no longer share or delete `~/.gaia/test_temp`. - `test_issue_841…`: the test now sets `GAIA_HOME` itself, so an inherited value can't override the patched `Path.home`. - `tests/electron/setup.js`: `os.homedir()` points at a per-file temp dir. It is assigned rather than spied, so `jest.restoreAllMocks()` can't undo it. Setting `HOME` would not work, because Jest's sandboxed `process.env` never reaches `os.homedir()`. - The "Ignoring invalid agents section in …\.gaia\tray-config.json" log came from `crash-loop-notification.test.cjs`, which mocks `fs` with a config the validator rejects. The real file was never read, but the path now names the temp home. </details>
…-on-sidecar # Conflicts: # src/gaia/ui/_chat_helpers.py
A scheduled run built the agent with no model, so it ran the local default even when the user had chosen another model, typically a cloud one because the local default does not fit. On a 16 GB Mac every scheduled task then failed with "not enough free memory to load Gemma-4-E4B". Both the relayed and the in-process run now use the user's chosen model (the custom_model setting new chats run), and fall back to the agent's default only when none is chosen.
|
Scheduled runs now use the model the user picked, the same one a new chat starts on, instead of the local default. That fixes the "not enough free memory to load Gemma-4-E4B" failure from the rc5 desktop run above. With no model picked they still use the agent's default. 🔍 Technical details
|
Main failed its unit tests on every OS and its frontend typecheck after two PRs landed together: #5539 and #5634 each passed on their own. The scheduled-run test expected "ended unexpectedly" where #5634 now says "GAIA stopped unexpectedly while answering", and the schedule-form test fixture lacked the `last_error` field #5539 made required. Both tests now match the code. ## Test plan - [x] `pytest tests/unit/chat/ui/test_scheduled_run_agent_path.py`: 15 passed (was 1 failed) - [x] `npx tsc --noEmit` in `src/gaia/apps/webui`: clean (was 1 error) - [x] `npx vitest run`: 156 files, 1611 tests pass
On a desktop install every scheduled task failed in under a second with a "not installed" error that named an install command that didn't work, and the failure showed nowhere in the app. Scheduled runs now use the installed GAIA agent the same way chats do, and a run that fails says why on its schedule card and as a notification.
gaia init.Test plan
pytest tests/unit/chat tests/unit/chat/ui/test_scheduled_run_agent_path.py: 2174 passednpx vitest runinsrc/gaia/apps/webui: 1529 passedlast_error, shows it on the card and raises an error notificationGET /api/scheduleswitherror_count: 1and the reason inlast_error(response below)🔍 Technical details
last_erroris stored on the schedule and exposed by the schedules API; the app polls schedules every 30 s to raise the notification.Failing schedule:
GET /api/schedules(trimmed to the relevant fields){ "schedules": [ { "name": "pong-check", "status": "active", "last_run_at": "2026-10-22T19:44:54.564767+00:00", "run_count": 1, "error_count": 1, "last_error": "The model call failed at step 1, so this request is unfinished. Lemonade on this machine: Couldn't reach the local LLM.\n\nNothing had run yet.\n\nIt may be loading or briefly busy — try sending the message again." } ], "total": 1 }The garbled dash in the message is an existing encoding issue on the model-error path, not part of this change.