Skip to content

Add session work-unit grouping and the Models By-agent lens to the desktop app - #1351

Closed
ozymandiashh wants to merge 4 commits into
getagentseal:mainfrom
ozymandiashh:zcode/goal-7-session-groups
Closed

ozymandiashh wants to merge 4 commits into
getagentseal:mainfrom
ozymandiashh:zcode/goal-7-session-groups

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

What

Desktop: one orchestration root together with the subagents it spawned — the whole group's cost and each member's contribution — plus a By agent lens in Models fed by the CLI's existing models --by-agent.

  • Sessions → Group by work units: a third list view beside the existing list/provider grouping. A group row aggregates the whole unit (root's cost split explicitly from the descendants'), members expand with their recorded agent type (Explore, general-purpose, …) and contribution, cost sorting ranks whole units, and the summary counts sessions and groups separately without re-summing member detail. Search surfaces the whole group when any member matches (agent types included) and flags only the matches. A period/provider/refresh switch closes any open group or member detail.
  • Strict lineage only: provider-recorded links fold under the top root (a grandchild counts once, no intermediate parent invented); out-of-window parents, cycles, and ambiguous duplicates stay visible standalone per the resolver's fail-closed rules — no invented links, no lost spend.
  • Models → By agent: one row per (provider, model, agent) under its model group; ordinary sessions and agent-type-less providers stay in the CLI's (main) bucket — nothing fabricated.

How

  • CLI (additive): WorkUnit gains rootProvider + members[{sessionId, provider, role}] so JSON consumers can separate same-id sessions across providers; SessionRow gains agentType (null when the provider records none). serve --stdio now routes sessions --by-work-unit like the other read commands.
  • Desktop (additive): typed IPC channels codeburn:getWorkUnits / codeburn:getModelsByAgent mapping to the existing CLI commands, same arg validation as neighbors; presentation logic lives in the new app/renderer/lib/workUnits.ts.
  • Dev isolation for parallel checkouts (defaults unchanged): CODEBURN_DEV_PORT (Vite + dev launcher), CODEBURN_USER_DATA_DIR (Electron profile incl. serve.pid), and the existing browser-demo harness learns the two new channels (CODEBURN_DEMO_BRIDGE=1, dev-serve only).

Tests

  • New: work-unit JSON wire-contract suite (acceptance fixture root 2 + children 3/5 + solo 7 → 17/10/8; grandchild counted once; out-of-window parent; parent cycle; ambiguous duplicates; same id across providers), renderer grouping/sort/search suite, Sessions work-unit view component tests, Models By-agent lens tests, IPC argv cases, serve --stdio routing cases.
  • Updated existing pinned shapes for agentType.
  • App suite on this branch: 900 passed / 1 failing (Sessions > caps a large list, a timeout that also fails on a clean main checkout — verified via stash). Root npm test failures are unchanged load-flaky serve-stdio/menubar cases that pass in isolation.
  • Typecheck (root + app), npm run build:cli, and npm --prefix app run build all clean.
  • Verified end-to-end against a reproducible synthetic-HOME fixture (scripts/goal7-fixture.mjs) through the real CLI and serve --stdio, and clicked through the full flow in the real app: grouping → expand → member detail → cost sort → period switch → By agent, with totals reconciling at $17/$10/$8 and the CLI by-agent report ((main) 9 / Explore 3 / general-purpose 5).

Docs

docs/desktop-session-groups.md covers the UI behavior, the never-does rules, the CLI counterparts, and the dev-isolation variables.

…ession rows

Work units now carry rootProvider and a members[{sessionId, provider, role}]
twin so JSON consumers can separate two sessions sharing an id across
providers without guessing. Session rows gain agentType (null when the
provider records none; never synthesized). serve --stdio routes
sessions --by-work-unit like the CLI table already did.
… models

codeburn:getWorkUnits maps to the existing sessions --by-work-unit JSON
command and codeburn:getModelsByAgent to models --by-agent, with the same
period/provider/range validation as the neighboring read channels. The
renderer bridge types carry the WorkUnitReport envelope and ModelReportRow
agentType; both new methods are optional-degrading on older preloads.
Sessions gains a Group by work units view beside the existing list: group
rows aggregate the whole unit (root cost split from descendants'), members
expand with their recorded agent type and contribution, cost sort ranks
whole units, and the summary counts sessions and groups separately without
re-summing member detail. Search surfaces a group when any member matches
(agent types included) and flags only the matches; a population switch
closes open details. Models gains a By agent lens fed by the CLI's
--by-agent rows under their model groups.
…and user docs

CODEBURN_DEV_PORT drives one Vite port through the new dev launcher
(defaults to 5173 unchanged); CODEBURN_USER_DATA_DIR redirects the Electron
profile (serve.pid, telemetry, tray). The browser demo harness serves the
two new read channels, and docs/desktop-session-groups.md documents the
feature end to end, including the reproducible acceptance fixture.
@ozymandiashh

Copy link
Copy Markdown
Collaborator Author

Closing for now — main gained the CLI half of this through #1145 (CB-2 slice 1), so this branch now conflicts semantically with the landed resolver. The desktop grouping view and By-agent lens remain valuable; I plan to re-submit just the renderer half rebased on the landed CLI foundation once the CB-2 slices settle. Branch stays on the fork.

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