emrg: show running task elapsed duration + 5s status polling in GUI task panel - #931
Conversation
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 1245. Verified the scheduler status() started_at semantics (epoch while running / None when idle, both asserted in tests), the dialogs.js elapsed-tick + 5s poll lifecycle (start on panel open, stop on both view-leave paths — no leak), and i18n keys in zh/en. CI test+test-windows green (run 32537257426).
argszero
commented
Aug 21, 2026
Found a semantic bug during review: Fix (commit 207dcc6): added a dedicated per-cycle timestamp Tests updated to exercise |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 1245 (re-verified on head 207dcc6 after the per-cycle started_at fix). The scheduler change now reports THIS cycle's elapsed time via _cycle_start_time (set at tick begin, cleared at cycle end) — matching the rant's 本次运行时长 requirement; _start_time (handler uptime) semantics preserved for templates. Full suite 1002 passed + 1 skipped, import + CLI OK; CI test + test-windows green (run 32537919701).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 1247. Fresh diff review vs master e6aa4d4: scheduler exposes per-cycle _cycle_start_time (set at tick begin, cleared at end) as started_at; dialogs.js elapsed tick + 5s poll lifecycle (start on open, stop on both leave paths); i18n zh/en present; tests cover running/idle states. CI test+test-windows green (run 32537919701).
Uh oh!
There was an error while loading. Please reload this page.
Implements the GUI task-panel improvements from rant 2026-08-22T07:18:35: show the running task's elapsed duration, and auto-refresh the running→queued state transition via 5s polling (host-confirmed polling approach — a few seconds of lag is acceptable, no event push).
Changes
emrg/server/scheduler.py—TaskHandler.status()now exposes"started_at": the current cycle's start epoch (self._start_time), valid only whilerunningis true,Nonewhen idle/completed.emrg/gui/renderer/js/dialogs.js"已运行 XXs"(app.taskRunningDurationi18n) that ticks up every second — reuses the existingtaskCountdownsarray mechanism, mirrored:startedAtfixed,nowincreases so the duration grows (vs. the pending countdown which shrinks toward itsdeadline).startTaskPoll()/stopTaskPoll(): a 5s interval re-fetchesloadTaskMeta()+renderTaskList()while the panel is active, so a task that finishes its cycle flips to "待运行" with its next-run countdown within ≤5s. Idempotent start; separate timer from the 1s countdown (the poll never restarts itself).emrg/gui/renderer/js/app.jsopenTasksPanel()starts the poll after the initial render.switchViewto a non-tasks view, and toggle-close of the tasks panel) callstopTaskPoll()alongside the existingstopTaskCountdown()— same lifecycle, no leaks.emrg/gui/renderer/js/i18n.js— newapp.taskRunningDurationkey in zh (已运行 {n}) and en (running for {n}).Verification
uv run pytest tests/: 1002 passed, 1 skipped (new assertions intest_evolution_handler_status_last_run_fieldscover started_at = epoch while running, None while idle)python -c "from emrg.client.app import run_client": OKpython -m emrg --help: OKCSS/JS + one additive daemon field; no protocol breaking changes.