emrg: refresh GUI task table immediately after trigger (rant 2026-08-21T17:41:23) - #923
Conversation
Rant 2026-08-21T17:41:23: clicking a task row's trigger button in the tasks panel only shows a toast — the table's status/last-run/next-run countdown stay stale until the panel is reopened, even though the daemon scheduler starts the task. Fix: re-render the task list right after a successful trigger. - dialogs.js trigger button: await renderTaskList() after 'triggered' and 'running' outcomes (error path unchanged; delete handler already refreshed, this closes the gap). - dialogs.js: new refreshTaskListIfOpen() helper — re-renders only when the tasks view is active (avoids a pointless re-fetch + countdown timer when the panel is hidden). - app.js doTrigger (/trigger <name> from chat): call Dialogs.refreshTaskListIfOpen() after success so an open panel updates. Test: renderer.smoke.test.js trigger test now uses a stateful listTasks mock (trigger flips nightly to running) and asserts listTasks is re-fetched and the nightly row shows the running badge + disabled button after trigger; error path asserts no re-fetch.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 1216. Fixes rant 2026-08-21T17:41:23 (tasks-panel trigger leaves table stale): trigger button now re-renders the list after both 'triggered' and 'running' outcomes via await renderTaskList() (mirrors the delete handler's refresh), and the new refreshTaskListIfOpen() helper keeps the chat /trigger path from re-fetching unless the tasks view is active. The stateful-mock test asserts the positive (re-fetch + running badge + disabled button) and negative (error → no re-fetch) states. Local: GUI npm test 249+8, renderer.smoke 128/128, pytest 1000+1, import/CLI OK, node --check clean. CI test + test-windows PASS.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle R2166. Independent verification on head 55e4231 (MERGEABLE/CLEAN; CI test + test-windows PASS):
- Fix audit (rant 2026-08-21T17:41:23): tasks-panel trigger button now awaits renderTaskList() after both 'triggered' and 'running' outcomes (mirrors the delete handler's refresh); chat /trigger path reuses the new refreshTaskListIfOpen() guard so an open panel refreshes while a hidden one avoids the pointless re-fetch + countdown restart. App.state.activeView gate is correct.
- Test quality: the smoke test's stateful listTasks mock (nightly flips to running after trigger) genuinely asserts the fix — re-fetch happens, running badge renders, trigger button disables; error path explicitly asserts NO re-fetch (no regression to the error UX).
- Local verification: node --check OK on both edited JS files; GUI 249 pass / 0 fail / 8 skipped (257); pytest 1000 passed + 1 skipped (doc-count guard green); import + CLI OK.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 1219. Re-verified on unchanged head 55e4231 (MERGEABLE, CI test + test-windows PASS): trigger button re-renders the task table after both 'triggered' and 'running' outcomes, refreshTaskListIfOpen() gates the chat path to the active tasks view, and the stateful-mock test covers positive (re-fetch + running badge) and negative (error → no re-fetch). Local pytest 1000+1 + import OK + GUI 249+8. 3rd consecutive LGTM (1216/R2166/1219) → merging.
Summary
Fix host rant
2026-08-21T17:41:23— after clicking a task row's 触发 (trigger) button in the GUI tasks panel, only a toast appears; the table's status / last-run time / next-run countdown stay stale even though the daemon scheduler has started the task.Root cause
The trigger button handler (
emrg/gui/renderer/js/dialogs.js) calledwindow.emrg.triggerTask()and showed a toast, but never re-rendered the task list. The delete handler already refreshed (await renderTaskList()after delete); the trigger path was missing the same step. The chat/trigger <name>path (app.jsdoTrigger) had the same gap when the tasks panel was open.Changes
emrg/gui/renderer/js/dialogs.js— trigger button handler now callsawait renderTaskList()after a successful trigger (bothtriggeredandrunningoutcomes; error path unchanged). The re-render re-fetches status/last-run/next-run from the daemon and re-syncs the countdown timer.emrg/gui/renderer/js/dialogs.js— newrefreshTaskListIfOpen()helper: re-renders only when the tasks view is active (App.state.activeView === "tasks"), avoiding a pointless re-fetch + countdown timer when the panel is hidden. Exported for the chat path and tests.emrg/gui/renderer/js/app.js—doTrigger(chat/trigger <name>) callsDialogs.refreshTaskListIfOpen()after success so an already-open panel updates.Verification
test/renderer.smoke.test.js): the existing trigger test now uses a statefullistTasksmock (trigger flipsnightlytorunning) and assertslistTasksis re-fetched after trigger, thenightlyrow shows the running badge, and its trigger button becomes disabled; the error path asserts no re-fetch.npm test→ 249 passed + 8 skipped (257); renderer.smoke: 128/128.uv run pytest tests/→ 1000 passed + 1 skipped (doc-count guard green); import + CLI OK;node --checkon both edited JS files OK.