Skip to content

A job step's cost is the sum of its rounds - #2294

Merged
santoshkumarradha merged 76 commits into
app/v3from
c52/step-cost-rounds
Nov 3, 2026
Merged

santoshkumarradha merged 76 commits into
app/v3from
c52/step-cost-rounds

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What changes

A job step's cost now shows all its rounds. It used to show only the last round, so a Proof step with two rounds could read $0.0153 when its first round alone cost $0.2025.

  • Each step keeps a table of what each round has cost so far. A worker's report carries the whole table every time, and a step's cost is the table's sum.
  • The factory keeps the larger value for each round. A round's running total only grows, so an old, repeated or out-of-order report can't lose a row or count twice.
  • A retry adds a row and keeps earlier rows. A new run or Run as new starts empty.
  • Job totals count the growth in these tables, so a job's total stays at or above what was spent. Steps plus the manager's own spend equal the job's tagged ledger rows; the manager's spend is not part of any step.

Compatibility

  • A factory says it accepts tables when it hands out a job. Without that, a worker sends the old report with all new spend in its cost.
  • A step reported without a table shows the last round's cost, as before.
  • Old saved jobs keep the costs they stored. A round not saved then can't be recovered, and stored rows are not rewritten.
  • The app wire is unchanged: step.cost is still one number.
  • A chat reopened in the same round, for example after a budget raise, is a new spending segment. Its money adds to the round's saved figure, including after a restart.

Limits

  • A step on an old saved job can read low until it runs again.
  • Not pressed live.

Validation

  • Red: step cost = 0.0153, want 0.2178; retry .0100, want .2100; job .2025, want .2178; stale report job=0.30, want 0.35; step cost=0.20, want 0.01; unknown field "round_costs".
  • A seeded random-sequence test drives start, spend, report, coalesce, drop, reorder, retry, restart and resume: a step's cost equals the sum of its per-round maxima, and the job total is never below spend.
  • internal/factory/..., internal/manual, the job spend tests in cmd/codeaf and TestEveryFieldRoundTrips pass.

🤖 Generated with Claude Code

santoshkumarradha and others added 30 commits November 2, 2026 23:22
Competing manager opens remain owned after Talk selects another journal. Recognize the saved owner for live budget admission and spending. Match receipt rebuilds to the journal identity as well as the cell identity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Validate durable ownership against the candidate store. A local worker mirror must share the owning floor manager path before taking an extra manager charge. Seed journal headers and titles from the session folder metadata in either layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old ownership marks keep their root, job and repository matching.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match call facts across aliases, retaining repeated calls under a single alias and leaving historical rows untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the held-manager fast path and recheck after locking. Network reads no longer hold the floor-wide mint lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub issues supply Created (github/source.go issueItem); Store.Create preserves it and api transport carries it. Independent factories can therefore share ID, Repo, Num and Created. The remote door must use its mirror; owned runners still consult their floor. Remote manager deduplication remains unsupported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assert historical ledger bytes remain unchanged and repeated refresh imports no saved call twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Exercise exported Refresh with separate equal-cost calls, microdollar rounding, and repeated ledger IDs. Normalize Go formatting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match each alias to saved calls in order, using receipt precision for cost and allowing live usage to precede its seal. Count repeated row IDs once and append only missing calls, preserving historical ledger bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record the legacy prefix assumption for calls sharing a seal. Final review retains no blocking findings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live meters persist logical round totals before interruption. Result folds replace the round high-water mark so retries cannot add receipts twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
santoshkumarradha and others added 17 commits November 3, 2026 03:01
…rges

A worker flush between the job charge and result fold classified step dollars as manager spend and later charged the table again. Store both receipts in one annotation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep legacy results in their last-Spent fallback without manufacturing historical table rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ssion

Disable the factory-side receipt transport to demonstrate that the new retry, restart, coalescing and seeded worker tests detect its absence. The next commit restores admission.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The result-only fixture now correctly exercises legacy fallback. Carry the live round table and negotiated capability when simulating a current worker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clarify the retained round receipt behavior in the shipped manual.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
santoshkumarradha and others added 6 commits November 3, 2026 05:45
Newly opened unmetered chats report only their segment spending.
Normalize it against the persisted round receipt before the runner
subtracts acknowledged spending. Keep recorded rows monotonic when
a later result is smaller, without treating float size as segment identity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
santoshkumarradha added a commit that referenced this pull request Nov 3, 2026
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 3, 2026 11:42
@santoshkumarradha
santoshkumarradha merged commit e82f71c into app/v3 Nov 3, 2026
@santoshkumarradha
santoshkumarradha deleted the c52/step-cost-rounds branch November 3, 2026 11:42
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