Delegate cost reporting: use canonical cumulative format#627
Merged
Conversation
…e aggregate Per the design discussion: delegate should look like calling the individual steps in sequence. Per-step cost on Stage 1, 3, 3a, 3c already worked. What was wrong was the trailing "Delegate Stages 1-3c Aggregate Cost" block, which: 1. Used a bespoke label format different from individual /agent-* invocations. 2. Contained a per-step-format cost table (with bold **$X.XX**) that the cumulative-cost scanner would have picked up as a prior step cost — guaranteeing quadratic double-counting on any later /agent-* on the same issue. Replaced with: each per-step cost block in delegate now carries a canonical cumulative table appended (via compute_cumulative_table from lib/cumulative_cost.py — the same code individual invocations use). Cumulative is empty on Stage 1 (no prior cost markers); from Stage 3 onward it includes all prior delegate stages. The cumulative on the last reported stage IS the running total, no aggregate block needed. Council reviewer comments (Stage 2, 3b) intentionally remain cost-table-less — those costs are small and the user has decided they would just be noise. Their costs won't appear in the cumulative, which matches the "what shows in the cumulative is exactly what was reported per-step" rule. No new cost-reporting code; this just routes delegate through the existing per-step + cumulative path that resolve/design/review already use. The `_build_stage_cost_block` helper added in workshop.py is a thin wrapper that calls _build_cost_table + compute_cumulative_table. run_delegate gains two parameters (github_repo, issue_number) so the cumulative scanner can fetch prior comments. The workflow passes them in from the same env vars it already uses elsewhere. 662 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the design discussion in chat: delegate should look like calling the individual steps in sequence. Per-step cost on Stage 1, 3, 3a, 3c already worked. What was wrong was the trailing "Delegate Stages 1-3c Aggregate Cost" block.
Two problems with the old aggregate block
Fix
Each per-step cost block in delegate now carries a canonical cumulative table appended (via `compute_cumulative_table` from `lib/cumulative_cost.py` — the same code individual invocations use). Cumulative is empty on Stage 1 (no prior cost markers); from Stage 3 onward it includes all prior delegate stages. The cumulative on the last reported stage IS the running total — no aggregate block needed.
Council reviewer comments (Stage 2, 3b) intentionally remain cost-table-less per the existing decision: their costs are small and reporting them would just be noise. Their costs won't appear in the cumulative, which matches the "what shows in the cumulative is exactly what was reported per-step" rule.
No new cost-reporting code paths — this just routes delegate through the existing per-step + cumulative formatting that resolve/design/review already use. The `_build_stage_cost_block` helper added in `workshop.py` is a thin wrapper that calls `_build_cost_table` + `compute_cumulative_table`.
`run_delegate` gains two parameters (`github_repo`, `issue_number`) so the cumulative scanner can fetch prior comments. The workflow passes them in from the same env vars it already uses.
Test plan
🤖 Generated with Claude Code