Skip to content

emrg: refresh GUI task table immediately after trigger (rant 2026-08-21T17:41:23) - #923

Merged
argszero merged 1 commit into
masterfrom
feature/gui-task-trigger-refresh
Aug 21, 2026
Merged

emrg: refresh GUI task table immediately after trigger (rant 2026-08-21T17:41:23)#923
argszero merged 1 commit into
masterfrom
feature/gui-task-trigger-refresh

Conversation

@argszero

Copy link
Copy Markdown
Owner

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) called window.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.js doTrigger) had the same gap when the tasks panel was open.

Changes

  1. emrg/gui/renderer/js/dialogs.js — trigger button handler now calls await renderTaskList() after a successful trigger (both triggered and running outcomes; error path unchanged). The re-render re-fetches status/last-run/next-run from the daemon and re-syncs the countdown timer.
  2. emrg/gui/renderer/js/dialogs.js — new refreshTaskListIfOpen() 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.
  3. emrg/gui/renderer/js/app.jsdoTrigger (chat /trigger <name>) calls Dialogs.refreshTaskListIfOpen() after success so an already-open panel updates.

Verification

  • Test (test/renderer.smoke.test.js): the existing trigger test now uses a stateful listTasks mock (trigger flips nightly to running) and asserts listTasks is re-fetched after trigger, the nightly row shows the running badge, and its trigger button becomes disabled; the error path asserts no re-fetch.
  • GUI suite: npm test → 249 passed + 8 skipped (257); renderer.smoke: 128/128.
  • Python suite unchanged: uv run pytest tests/ → 1000 passed + 1 skipped (doc-count guard green); import + CLI OK; node --check on both edited JS files OK.

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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@argszero
argszero merged commit cbf046a into master Aug 21, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 21, 2026
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant