Repository navigation
fix(desktop): make the tasks badge and rows mirror live work - #2634
Conversation
vastsa
left a comment
There was a problem hiding this comment.
I confirmed the underlying issue on main: the badge counts unseen arrivals and never decrements when tasks finish. Deriving it from running tasks removes that cause. One acceptance case still needs resolving before landing: #2632 says a completed row should disappear immediately. The stated exception is for output the user is actively reading, but selectVisibleTasks(sessionTasks, expandedId) keeps the row even if the dock was collapsed or switched to Todo before the task ended (setCollapsed / openTodoTab leave expandedId unchanged). That leaves a finished row that can reappear later despite no output being on screen. Please preserve the pin while the preview is visible, keep cancellation accessible for continuation-pending rows, and add a start → open output → collapse or switch to Todo → finish → reopen regression alongside the visible-preview case. If the existing spec intentionally preserves hidden previews too, please agree on that exception in #2632 rather than closing it with different acceptance rules.
The pin on a row being read kept the row alive while its preview was not even on screen: collapsing the container or switching to Todo left the preview id in place, so a finished row could reappear when the panel came back. The preview now closes as soon as the tasks panel leaves the screen (collapse, Todo tab, or a session switch), and the row leaves with it. Addresses the review on vastsa#2634.
4afd909 to
af7535e
Compare
|
Thanks for the precise review — the hidden-preview gap is fixed in
One pre-existing edge I want to flag rather than quietly keep: a user who never chose a tab (auto tab rule) with in-progress todos can still have the panel auto-switch to Todo when the last running task ends, which closes the preview mid-read. The tab rule itself is unchanged from main, so this behavior exists there today; the acceptance in #2632 doesn't cover it. Happy to pin the panel while reading in a follow-up if that's the intended rule. (Posted via an AI assistant at my direction; I own the content.) |
The tasks tab badge counted tasks that appeared while the panel was not on screen and only cleared when the user re-entered the tab, so ended tasks kept it raised; finished rows also lingered for a 10-second grace window. Both now share one rule: the badge is the session's running-task count, derived from the rows, and a finished task's row leaves as soon as its end state arrives — only the row whose output is open stays, so a log being read cannot vanish underneath it. fixes vastsa#2632
The pin on a row being read kept the row alive while its preview was not even on screen: collapsing the container or switching to Todo left the preview id in place, so a finished row could reappear when the panel came back. The preview now closes as soon as the tasks panel leaves the screen (collapse, Todo tab, or a session switch), and the row leaves with it. Addresses the review on vastsa#2634.
af7535e to
c274574
Compare
Two edges of the preview-pin rule. The auto tab rule could switch the panel to Todo when the last running task ended mid-read, taking the panel — and the row being read — away; an open read now keeps the tasks panel on screen. And a running task's preview survived nothing: it now survives a collapse or a Todo switch, so returning to the tasks tab picks up the same read, while a task that ends while hidden takes its pin with it, so a finished row still cannot reappear.
|
Follow-up in
This also reconciles the E2E scenario Validation: 45 + 11 targeted node --test pass, typecheck and lint clean; Electron probe not run on this host (no unpacked Electron binary under (Posted via an AI assistant at my direction; I own the content.) |
|
Thanks for the two follow-ups. I verified the current merge candidate ( |
A remembered Todo choice ended a read even while the panel actually on screen was Tasks: clearing every todo makes the dock fall back to Tasks without changing the choice, and a log opened on that panel was dropped mid-read when its task ended, because the pin rule looked at the remembered choice instead of the panel that resolves. The rule moves into dock-state as `isReading`, which decides from the resolved panel while keeping the no-interruption guarantee for automatic tab selection. The e2e tab scenario now covers remembered Todo → no todos → open log → finish, and the spec wording follows the resolved-panel semantics. Closes the follow-up case from the vastsa#2634 review.
|
Fixed in
Validation: 58 targeted (Posted via an AI assistant at my direction; I own the content.) |
|
Thanks for the follow-up. I rechecked |
vastsa
left a comment
There was a problem hiding this comment.
Verified the current GitHub integration candidate 86bc56f04 (ecc643916 on cb68af0d0). All 58 targeted tests and all three isolated Electron task-dock scenarios pass, including the remembered-Todo fallback. The badge now follows the live rows instead of accumulating arrivals, and the read pin does not retain hidden finished work. The prior changes request is resolved.
Ported from vastsa/PI-Desktop v0.24.0-beta.7 (bug fixes only; the release's features were left for a later rebase): vastsa#2625 quarantine rejected outbox appends instead of retrying them forever vastsa#2574 settle live turns and tool rows when the sidecar dies mid-stream vastsa#2578 native Pi turns stay stoppable after a reload vastsa#2634 the task badge mirrors work that is still running vastsa#2639 let Arabic and Hebrew paragraphs choose their own side vastsa#2640 stop a renderer crash loop with one GPU-less relaunch, then a dialog vastsa#2642 reject differing spellings of one tool argument vastsa#2655 compaction summaries open on demand in the transcript
Summary / 概要
The tasks tab badge counted tasks that appeared while the panel was not on
screen and only cleared when the user re-entered the tab, so ended tasks kept
it raised; finished rows also lingered for a 10-second grace window. Both now
share one rule (#2632):
container can render: it rises when a task starts and falls as tasks end,
hiding at zero. Entering a tab, collapsing the container, or switching to
Todo never changes it. The old
newCountbookkeeping(
observeSessionTasks/clearBadge) is removed;taskDock.newTasksisreplaced by the existing
taskDock.runningCountlabel (9 locales).arrives — no grace window. The one kept row is the task whose output preview
is open, and the preview pin lives only while the panel on screen shows the
tasks side: collapsing the container, the visible panel becoming Todo
(including todos coming back after a fallback), or switching sessions closes
the preview, so a finished row cannot reappear later with no output on
screen (fix(desktop): make the tasks badge and rows mirror live work #2634 review). The panel that resolves decides, not the remembered
choice: a remembered Todo whose side emptied has already fallen back to
Tasks, and a read opened there survives the task ending.
can be removed — in practice the expanded row of a task that just ended.
are untouched; only panel display changed.
Deviation from the acceptance criteria, stated up front: a row being actively
read stays while its preview is on screen, and a running task's preview
survives a hidden panel and picks the same read back up on return. Every
other ended row disappears immediately.
Also updated the spec sections that documented the old badge and grace
window (
docs/spec/03-runtime/03-tools-and-permissions.md,docs/spec/04-ux/09-interaction-patterns.md,docs/spec/06-delivery/e2e/tools-and-workspace.md) and rewrote the fouraffected node --test suites for the new rule.
Requirement link / 需求关联
Closes #2632UI checkbox note: this is a state-derivation change behind the existing
markup (one aria-label key swap); no visual layout changed, so no screenshots
were taken. I can attach them on request by running the app with seeded
tasks.
Validation / 验证
Task candidate:
e78627803(branchfix/background-tasks-running-badge,containing origin/main
cc972c3d1;git merge-base --is-ancestor origin/main HEADpasses)Run in the task worktree (deps via
pnpm install --ignore-scripts --frozen-lockfile):pnpm build:js— passpnpm --filter @pi-desktop/desktop typecheck— passpnpm lint— pass (style tokens OK)node --teston the six targeted suites(
background-tasks.test.mjs,background-tasks-bar-visibility.test.mjs,background-tasks-dock-state.test.mjs,background-tasks-dock-render.test.mjs,background-tasks-row-toggle.test.mjs,todo-dock-rendering.test.mjs) —58 pass / 0 fail
Regressions added across the review rounds on #2634: the visible-preview
case, the start → open output → collapse / switch to Todo → finish → reopen
case, the auto-tab no-interruption case
(
background-tasks-bar-visibility.test.mjs); unit tests forresolveDockTab/sidesFor/visibleDockTab/isReading(
background-tasks-dock-state.test.mjs), including the remembered Todo →no todos → open log → finish chain from the maintainer review; and a third
scenario in the isolated Electron tab scenario
(
scripts/e2e/task-dock-tabs.tsx) that clears all todos after a rememberedTodo choice, opens the log on the fallback Tasks panel, ends the task, and
asserts the log survives.
NOT RUN, with reasons:
pnpm test/ fullnode --test test/*.test.mjssuite — ~26 knownenvironment failures on this host (Electron binary not downloaded because
of
--ignore-scripts; Host RPC unavailable). Targeted suites above coverthe changed surface.
scripts/e2e-task-dock-tabs.mjsand the other isolatedscenarios) — needs a runnable Electron build, not available in the
--ignore-scriptsinstall. The tab scenario script was reviewed by traceand bundles cleanly (esbuild); the maintainer has run both scenarios
against earlier merge candidates.
Independent CR (subagent review) returned APPROVE across all rounds; the
final round's one P2 (a stale private copy of the reading rule in
background-tasks-bar-visibility.test.mjsasserting the rejected semantics)and all P3 notes were fixed in
e78627803. Remaining recorded non-blockingnote: pre-existing dead e2e probe
scripts/e2e/background-tasks.tsxreferencing a deleted component (out of scope, left for cleanup).
Rollback / 回滚
Renderer-layer commits only; revert the branch to restore the old badge and
grace-window behavior. No persisted data, protocol, or host-side change, so
rollback needs no migration.
(Posted via an AI assistant at my direction; I own the content.)