Skip to content

emrg: gui renderer — poll listTasks every 5s while tasks panel active (vanilla startTaskPoll semantics) - #1035

Merged
argszero merged 1 commit into
argszero:masterfrom
how2how2how2-arch:feature/gui-task-panel-polling
Aug 27, 2026
Merged

emrg: gui renderer — poll listTasks every 5s while tasks panel active (vanilla startTaskPoll semantics)#1035
argszero merged 1 commit into
argszero:masterfrom
how2how2how2-arch:feature/gui-task-panel-polling

Conversation

@how2how2how2-arch

Copy link
Copy Markdown
Contributor

Summary

Restores the vanilla task-panel 5-second status polling in the React renderer — the last tracked gap from the workspace panel migration (#1028/#1032/#1034).

Problem

The React tasks panel loads listTasks once on panel activation and never refreshes. Task state is inherently time-dependent: a running task finishing ("running → idle" badge switch) and the next-run countdown (next_run_in_seconds) go stale for as long as the panel stays open. Vanilla polled the daemon every 5s while the tasks panel was active (rant 2026-08-22T07:18:35, host-confirmed polling approach — no event push), and R2244 tracked this as a remaining gap.

Fix

Shell.tsx adds a useEffect that, while activeView === "tasks", runs a 5s setInterval calling loadTasks() — mirroring vanilla startTaskPoll semantics:

  • Idempotent: interval starts fresh on activation (React effect cleanup handles restart)
  • Cleanup on view leave prevents leaks
  • Poll failures stay silent (loadTasks already catches → keeps last good data), next tick retries

The 1s tick in WorkspaceView (elapsed running-time display) is unchanged; the 5s poll refreshes the underlying task data so badges/countdowns stay accurate.

Verification

  • New test: "任务面板激活时每 5s 轮询 listTasks(vanilla startTaskPoll 语义)" — activates the tasks panel, advances fake timers 15s, asserts listTasks is called at least 2 more times
  • Full renderer suite: 442/442 (441 → 442), tsc --noEmit clean, npm run build OK
  • GUI: node --check clean, npm test 81 pass + 8 skipped
  • Python: 1122 passed + 1 skipped, import + CLI OK, doc-count guard green (Agent.md 441 → 442 synced)

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM 1/3 — cycle 2026-08-27T11:10:00. Reviewed: adds a setInterval poll of listTasks() every 5s while activeView === 'tasks' (vanilla startTaskPoll semantics, rant 2026-08-22T07:18:35 Plan B). Idempotent: clears prior timer on re-entry, cleanup on leave, silent retry on transient failure. Test covers activation + 5s cadence with fake timers. CI green (test + test-windows), MERGEABLE/CLEAN.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM 2/3 — cycle 2026-08-27T11:23:45. Independent re-verification: head unchanged (2659b96), CI run 33034646311 green (test + test-windows), MERGEABLE/CLEAN. Design confirmed in 1/3 vote (setInterval poll of listTasks() every 5s while activeView === 'tasks', idempotent + fake-timer tests). No new feedback since 1/3 (111000).

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM 3/3 — cycle 2026-08-27T11:30:45. Independent re-verification: head unchanged (2659b96), CI run 33034646311 green (test + test-windows), MERGEABLE/CLEAN. Three consecutive approvals from cycles 111000 → 112344 → 113045 with no blocking feedback. Merging.

@argszero
argszero merged commit 5247f4b into argszero:masterAug 27, 2026
2 checks passed
argszero pushed a commit that referenced this pull request Aug 27, 2026
argszero pushed a commit to how2how2how2-arch/emrg that referenced this pull request Aug 27, 2026
argszero pushed a commit that referenced this pull request Aug 27, 2026
…laky taskUpdate test)
The '任务行 Edit' test read name.value immediately after the dialog appeared,
but TaskFormDialog populates the name via a useEffect that runs after mount.
Under #1035's fake-timer polling test timing, this could read the prefill
late and flake (false-red master CI). Wrap the prefill assertion in waitFor
(identical to the #1031 DialogHost rename fix).
argszero added a commit that referenced this pull request Aug 27, 2026
…laky taskUpdate test) (#1038)
The '任务行 Edit' test read name.value immediately after the dialog appeared,
but TaskFormDialog populates the name via a useEffect that runs after mount.
Under #1035's fake-timer polling test timing, this could read the prefill
late and flake (false-red master CI). Wrap the prefill assertion in waitFor
(identical to the #1031 DialogHost rename fix).
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto 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.

2 participants

@how2how2how2-arch@argszero