Aggregate Workflow run logs in postmortem.py — workflow sessions read as zero subagent spend #28
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
postmortem/scripts/postmortem.pyaggregates subagent spend from<session>/subagents/agent-*.jsonlonly (single-level glob inanalyze_subagents(), ~line 272). Runs on the Workflow substrate write their per-agent transcripts elsewhere: raw usage under<session>/subagents/workflows/wf_*/agent-*.jsonlplus a per-agent summary (label, model, token counter) in<session>/workflows/wf_*.json. Neither path is read.The implement execution loop moved onto the Workflow substrate on 2026-06-17 (
7a58a53). Since then a session that ranimplement-loopgrades as near-zero subagent spend — the tool built to grade token spend cannot see the pipeline's own dispatches. Measured over local workflow-run telemetry, 2026-06-17..2026-07-17: 206 implement-loop runs, 2,883 agent instances, ~164.5M non-cache-read tokens, all invisible topostmortem.py.Fix scope
workflows/wf_*.jsonfor per-agent stage labels/models, and the matchingsubagents/workflows/wf_*/agent-*.jsonlfor raw usage, deduplicated byrequestIdwith max-per-field within a request — the same methodaggregate_transcript()already applies.impl,spec,qual,mini-verify), so per-stage spend becomes visible next to the existing per-subagent table.wf_*.jsontokensfield under-tracks vs. the deduplicated raw usage (~11% in the corpus above); the raw-transcript number is authoritative, the summary supplies labels/models.Relation to #27
#27 proposes removing the postmortem skill on a no-consumers premise. This change gives the skill a structural consumer: before/after verification for pipeline token-cost changes. The removal decision is unaffected by this issue's scope but its premise changes once this lands.