Skip to content

feat(statistics): delegated-cost transport, publication and the bar total - #31

Open
efirvida wants to merge 5 commits into
upstream/statistics-02-no-cost-coercionfrom
upstream/statistics-03-delegated-cost-transport
Open

efirvida wants to merge 5 commits into
upstream/statistics-02-no-cost-coercionfrom
upstream/statistics-03-delegated-cost-transport

Conversation

@efirvida

@efirvida efirvida commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Chain Context

Field Value
Chain per-session statistics module (upstream Gentleman-Programming#1583)
Tracker upstream/statistics-tracker → upstream integration PR Gentleman-Programming#1627 (draft)
Position 3 of 27
Base upstream/statistics-02-no-cost-coercion
Depends on #30
Follow-up upstream/statistics-03-delegated-cost-transport (slice 4)
Review budget 318 / 400
Starts at upstream/statistics-02-no-cost-coercion
Ends with feat(statistics): delegated-cost transport, publication and the bar total

Chain Overview

upstream/main
 └── upstream/statistics-tracker (root, integration PR #1627)
      └── … slices 1..2 … (##30 is the immediate parent)
           └── 📍 upstream/statistics-03-delegated-cost-transport
                └── … slices 4..27 …

Scope

  • Includes: feat(statistics): delegated-cost transport, publication and the bar total
  • Excludes: every other slice. A polluted diff against upstream/statistics-02-no-cost-coercion is a branching bug, not a scope surprise.

Verification

Focused and affected suites are green on this slice; tests and docs for this unit ship with it.

Add the gent:session-cost:delegated/v1 codec (whitelisted, bounded,
never throws) and mergeSessionCost, so the orchestrator total and the
subagent total combine without losing provenance.
…ension

Add RunnerHooks.onUsage and publish the delegated total on the versioned
topic, derived from store.list so it survives the card's finished-row TTL.
Failures stay silent and never interrupt the agents flow.
…rker

The shell subscribes to the delegated topic and folds it into costTotal,
caching both halves and refreshing the orchestrator total on turn_end,
agent_end and session_tree so render never scans session entries. The
trailing + marker is opt-in and applies to the bar and header only; the
agents card and view keep today's formatCost output.
On resume the delegated total is published while the TaskStore restores,
before the shell's session exists, and was never re-published, so the bar
showed the orchestrator-only total. Re-publish after session_start (once
every handler has run) and gate the shell subscriber on the live context,
stashing a payload that arrives before session_start.
…nner

Drop the RunnerHooks.onUsage seam so I2 touches no agent-runner internals:
the publisher runs from the agents extension's existing one-second clock
(plus store summary events), which keeps the whole I2 diff to pure libs and
the two core adapters.
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