Skip to content

FIX-2398: a task's and a harness turn's spend, with the vendor's charge (package slice) - #4423

Merged
jhoffner merged 35 commits into
claude/project-thread-2ksmgsfrom
claude/project-thread-t857lk
Nov 1, 2026
Merged

jhoffner merged 35 commits into
claude/project-thread-2ksmgsfrom
claude/project-thread-t857lk

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

Stacked on FIX-2387's branch (claude/project-thread-2ksmgs, which carries FIX-2384). Retarget to main when it merges. Spec: #4398 (not merged yet; its commits are merged into this branch).

This is PR 1 of the spec's plan, the package slice. The four app PRs (Kitchen Sink, Shift Manager, Teammates, Claude Code-style) follow in their waves.

Someone who… Before After this PR
works a Kitchen Sink harness session No turn records what it spent Each turn's record carries spend (model, tokens, vendor charge) and endedAt, however the turn ended. It is stored before the request says it is done
hears a Claude Code window warning mid-session Dropped Recorded in the user's usage record, read through the flow's harnessUsage action
reads a task's spend Tokens only Tokens plus costUsd: the vendor's charge, or null. Never $0.00 for a subscription run
builds an app that shows spend Copies Claude Code-style's Spend.tsx Runs fsdev ui add spend: one line for a task or a turn

What changed

  • orchestration: taskSpendView gains costUsd, the sum of the non-null charges that sources reported (D3). requestSpendView reads one request's spend the same way.
  • harness-manager: harnessSessionFlow writes the turn's spend and endedAt inside the turn (D2). The spend is requestSpendView of the request's total spend. The write happens:
    • in a turn-spend step after the harness step, or in recordFailure's write when the turn threw or was stopped;
    • never at onFinished, which runs after the terminal status is published (Codex, spec round 1).
  • engine / core: a request keeps its whole spend across a suspension, an interruption or a crash. Changeset: engine and core, minor.
    • The record carries spentHarnessRuns beside spentByModel. A resumed ledger's total starts from them and never hands them on again.
    • A run recovered from the log under a carried run's id replaces it, and only its change is handed on. While an interrupted ending is still live, the continuation carries the log's runs.
    • readRequestTotalSpend(ctx) reads that total.
    • A harness run reported without a runId gets a settled_… id, so a run recovered from the log keeps the same identity.
  • The session feeds gain onUsage, which calls recordHarnessUsage. The flow carries harnessUsage: harnessUsageAction({ readers: usageReaders ?? {} }).
  • ui registry: a new spend item, lifted from Claude Code-style. It takes a structural summary plus optional attempts and durationMs.
    • Kitchen Sink installs the byte copy, plus the current run-changes.tsx (FIX-2384) and run-checks.tsx (FIX-2387). Without them its drift check is red on the parent branch (count now 40).
    • Fallow ignores the copy until the KS adoption PR uses it.
  • Docs: harness-manager, orchestration, ui and core READMEs, plus a Spend section on the docs site's flow-aware components page. Changeset: orchestration and harness-manager, minor.
  • CI: Kitchen-sink E2E is pinned to ubuntu-24.04, ported from FIX-2438 (fix(ci): pin Kitchen-sink E2E job to ubuntu-24.04 (FIX-2438) #4431).

Goal verdict

goals/harness-manager/a-turn-records-what-it-spent/, real Claude Code (claude-haiku-4-5, API key), on this branch:

  • PASS. t: 17,482 in · 59 out · $0.0087, 2.8 s. s: a turn stopped mid-run still recorded 17,485 in · 4 out.
  • Control: today's main (675f614) in a worktree FAILS t (no spend, no endedAt) and s (no spend).

Verification

  • Tests: harness-manager 387, orchestration 2203, engine 4223 (8 skipped), workforce 1727, integration-tests 152, ui 258, Kitchen Sink 396 (2 skipped). CI is green at ed81590.
  • Typecheck clean across core, engine, workforce, orchestration, harness-manager and kitchen-sink. Pre-push checks pass: lint, retired terms, vocabulary sweep.
  • Red states produced:
    • writing at onFinished fails the "stored before the request publishes that it completed" test;
    • no turn-spend step fails 4 spend tests;
    • no onUsage call fails the usage-query test;
    • counting a null cost as 0 breaks the view test;
    • not subtracting a recovered charge reads $0.30 for $0.20; dropping a charge-only residual reads $0.10 for $0.20;
    • without the engine carrying harness runs, a turn resumed after a suspension reads null;
    • keying a recovered report apart from its carried run, or dropping the log's runs while an interrupted ending is live, each fail an engine test;
    • reading the pending slice instead of the total, a turn continued after a disconnect loses its first run's model calls;
    • without the engine naming id-less runs, the crash test's recovered run lacks the id the dead run read;
    • showing $0.00 for a null cost breaks the registry test, and so does dropping the attempts guard.

Not here

  • App adoption (PRs 2–5).
  • Codex and Cursor onUsage: neither wire carries a window event (D1).
  • Task elapsed time: FIX-2394.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

claude added 13 commits October 31, 2026 23:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
…t (FIX-2398)

- taskSpendView gains costUsd: the sum of vendor-reported charges, null when
  none (a subscription run reports none; never an estimate).
- harnessSessionFlow records each turn's spend (taskSpendView's shape) and
  endedAt at turn end, however the turn ended; hands harnesses an onUsage
  feed into the usage record; carries a harnessUsage action (usageReaders).
- ui registry gains a spend item, lifted from Claude Code-style's Spend;
  Kitchen Sink installs its byte copy.
- Goal check goals/harness-manager/a-turn-records-what-it-spent: PASS on real
  Claude Code; GOAL_CONTROL=no-turn-spend FAILs t and s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Turn spend joins FIX-2384's turn-end sequencer as one more step; the
flow keeps one onFinished. Kitchen Sink installs run-changes.tsx so its
registry drift check passes on the stacked branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
…e request publishes its end (FIX-2398)

onFinished runs after runAction emits the terminal status, so a page that
refreshes on the end could read the turn before its spend landed (Codex,
spec PR #4398). The spend now lands in a tap after the harness step, or in
recordFailure's write for a turn that threw. A test captures session state
when request.completed is persisted. The goal's control is now main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Codex: onFinished runs after the terminal status is published, so D2's
write moves inside the turn and the goal's control becomes main. Cursor's
scope notes answered in DECISIONS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
…to claude/project-thread-t857lk

# Conflicts:
#	apps/kitchen-sink/test/harness-turn.test.ts
…updated run-changes

The parent branch moved both registry files without updating the byte copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Nov 1, 2026 1:22pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Nov 1, 2026 1:22pm UTC
flow-state-dev-ui Ignored Ignored Preview Nov 1, 2026 1:22pm UTC
flow-state-dev-build-site Skipped Skipped Nov 1, 2026 1:22pm UTC

Request Review

@jhoffner jhoffner self-assigned this Oct 31, 2026
@linear-code

linear-code Bot commented Oct 31, 2026

Copy link
Copy Markdown

FIX-2398

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T13:24:26.449066Z 8353940 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second look + architecture pass. The direction is sound: writing spend inside the turn (not onFinished) is the right call, and reusing taskSpendView keeps turns and tasks reading alike. One refactor is worth taking now, while this PR is already touching the seam:

  1. Add requestSpendView(spend, requestId) in orchestration and have both taskSpendView and turnSpendOf use it, instead of fabricating a fake completed Task with ten nulls in harness-manager (inline comment on turnSpendOf).
  2. Remove the ctx as never cast in onUsage.
  3. Make turnSpend and recordFailure idempotent on endedAt.
  4. Check costUsd consumers use == null, since the field is optional on stored views.

I did not run the suites; this review is a read of the diff. Not flagged: the byte-copied spend.tsx (ui registry and Kitchen Sink) is the registry's intended drift-checked model, and the stacked run-changes/run-checks copies are justified by the red drift check.


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/simplify review (FIX-2398 package slice)

Verdict on approach: The spec’s direction looks like the right simplification for this epic: extend the existing taskSpendView fold (plus costUsd), store the same shape on a turn record via the request ledger at turn end (D2), and expose one registry Spend line for the four app PRs. That beats the rejected alternatives (per-harness callback spend, item sums, or another lab-local formatter). Reusing recordHarnessUsage / harnessUsageAction for session onUsage matches the manager and session door — no second usage writer.

Where complexity crept in anyway

  1. Stacked work in one diff — This PR merges FIX-2387/FIX-2384 kitchen-sink registry copies (run-changes, run-checks) plus turn spend, harnessUsage, and the goal script. The commits explain why (base branch + drift count), but the review surface is ~1.2k lines where the spend mechanism is a few hundred. Worth calling out in the PR description so reviewers don’t treat the run-review UI as FIX-2398 scope.

  2. turnSpendOf as an inline adapter — Building a synthetic one-request TaskSpend inside session-flow.ts duplicates orchestration’s entry shape and leans on casts / “last harness run / last model key” heuristics. A small exported helper in orchestration (e.g. fold request spend for a single request id) would shrink harness-manager and give workforce/tests one place to anchor — optional for this PR, but it’s the main “could be cleaner” refactor I’d consider.

  3. SpendSummary vs TaskSpendView — The registry component re-declares the fold type. Importing TaskSpendView (and declaring orchestration as a registry dependency if needed) would avoid drift when the schema grows; the byte-identical kitchen-sink copy + drift test is the right enforcer either way.

  4. Error handling asymmetry on turn end — turnSpend swallows state-write failures and emits status (“never fail the turn on spend write”), but recordFailure applies the same turnEndOf payload inside an unguarded changeState. If that write throws, behavior diverges from the comment and may interfere with rethrowing the harness error. Worth aligning (shared helper or the same try/catch + status emit on both paths).

Performance: Nothing alarming for FIX-2398 — costUsd is O(sources) on once-per-turn paths. Tail latency is still dominated by harness runs and optional verify / git reads (pre-existing or FIX-2387), not the fold or Spend UI.

Third-party libs: Custom costAmount is appropriate (subscription runs must show no dollar figure; generic currency formatters don’t encode D3). No npm win here.

Follow-ups (spec already plans): CC lab Spend.tsx stays duplicated until PR 5; app PRs 2–4 should install registry Spend rather than formatting again.

Tests / goal: turn-spend.spec.ts and the goal script encode D2 ordering well (spend before terminal status). Nice anti-game choice.

I’m not approving yet mainly because of the recordFailure vs turnSpend write invariant; everything else reads as nits or follow-up extractions. Happy to approve after that path is consistent or you document why a throw path should propagate store errors.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b7e8281a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… requestSpendView

Review on #4423: the session flow no longer hand-builds a task spend entry;
orchestration owns the request-to-view step. The turn-end write happens once
(a record that already ended keeps its end), and onUsage needs no cast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Turn spend stays a step inside the turn, before 2384's in-turn head write.
Kitchen Sink takes the parent's run-changes and run-checks copies; the
drift count is 40 with spend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob

turnSpendOf builds a one-request task row by hand (last harness run, last model key, blank writer / admittedAt / recovered), then folds it with taskSpendView. spendAfterWrite on a blank row with part: "settle" is that row. The fold stays taskSpendView with status: "completed", so a turn still reads like a finished task. No new export.

Fold that subtraction in from #4425 (poc/shorter-turn-spend, draft, base claude/project-thread-2ksmgs). Diff vs 7b7e828 is packages/harness-manager/src/session-flow.ts +4/−16.

What still passes: pnpm --filter @flow-state-dev/harness-manager exec vitest run --root . test/turn-spend.spec.ts (6 passed). The hand-built row and this fold return the same view for an empty ledger, an API-key run, a subscription run, model calls only, a harness run mixed with model calls, and two api-key runs of one harness plus a subscription run.

Agent on this PR: fold the subtraction into this branch, then close #4425 unmerged after this PR lands. The POC does not merge.

Left alone: the registry Spend component and its Kitchen Sink byte copy, onUsage / harnessUsage, the two write sites (turnSpend notes a failed write; recordFailure rethrows), and the parent-branch run-checks / run-changes installs. Did not re-litigate D1–D3.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

Codex on #4423: unrecovered() subtracted the recovered tokens and runs but
kept the source's full costUsd, so the continuation's report of the logged
run's charge counted twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob

requestSpendView builds a one-request task row by hand (sources, namesOf, blank writer / admittedAt / recovered), then folds it with taskSpendView. A blank row plus spendAfterWrite (part: "settle") is that row. The export stays. turnEndOnce stays.

The equality assert next to it compared the function to that spendAfterWrite call. Once the function is that call, the assert cannot fail, so it comes out. The view match and the empty-ledger null stay.

Fold that from #4425 (poc/shorter-turn-spend @ 78a103c73, draft, base claude/project-thread-2ksmgs). The commit is the subtraction: packages/orchestration/src/tasks/spend.ts and record-spend.test.ts, +6/−22 vs 7dc52024. The PR title still names turnSpendOf; read the commit.

What still passes: pnpm --filter @flow-state-dev/orchestration exec vitest run --root . test/collection/record-spend.test.ts (28 passed) and pnpm --filter @flow-state-dev/harness-manager exec vitest run --root . test/turn-spend.spec.ts (6 passed).

Agent on this PR: fold the subtraction into this branch, then close #4425 unmerged after this PR lands. The POC does not merge.

Left alone: turnEndOnce, onUsage / harnessUsage, the registry Spend byte copy, and the run-checks / run-changes installs. Did not re-litigate D1–D3.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

Cursor on #4423: the hand-built entry duplicated spendAfterWrite's; a
request's view is now the settle write and fold a task's row gets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fac9196b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Codex on #4423: the once-only guard kept the interrupted run's end and
dropped the continuation's spend, and a continued request's ledger holds
only its own runs. The turn record now keeps the runs it counts (spentRuns),
each once by runId, and every write takes the latest end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5378fad9cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Mechanism check (advisory, never blocks)

Rows from docs/mechanisms/mechanisms.yaml · labels: new-mechanism, mechanism-overlap

New export Package Mechanism
readRequestTotalSpend @flow-state-dev/core none (nearest: scope, resource, collection, suspension, wait-gate, dispatch, webhook, coding-harness)
requestSpendView @flow-state-dev/orchestration none (nearest: task, task-notice, task-flow-policy)
  • readRequestTotalSpend reads like worker-loader (read). Is it one of those jobs?

If an export is a new mechanism, add a row. CI filled the mechanical fields; job, builtOn and overlaps are yours. If it belongs to an existing row, say which in the PR.

  - id: TODO
    job: TODO
    package: "@flow-state-dev/core"
    anchor: readRequestTotalSpend
    file: packages/core/src/types/request-end.ts
    builtOn: []  # TODO
    overlaps: []  # TODO
    status: canonical
    doc: TODO
  - id: TODO
    job: TODO
    package: "@flow-state-dev/orchestration"
    anchor: requestSpendView
    file: packages/orchestration/src/tasks/spend.ts
    builtOn: []  # TODO
    overlaps: []  # TODO
    status: canonical
    doc: TODO

@github-actions github-actions Bot added the new-mechanism A new public export matches no row of docs/mechanisms/mechanisms.yaml (advisory) label Nov 1, 2026
A turn that wrote its spend and then lost its process before its step's
trace was stored replays that write on continuation, while the ledger
recovers the same id-less run from the harness step's trace. The turn
record kept every id-less earlier run, so that run counted twice. The
engine now gives an id-less report a settled_ id as it counts it, so the
ledger, the trace and what a continuation recovers all name the run the
same, and the turn dedupes it by id like any other run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

jhoffner commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

Kitchen-sink E2E (Playwright) failed on 7d92efe during setup, before any test ran. The error was Playwright does not support chromium-headless-shell on ubuntu26.04-x64. The failure isn't this PR's: ubuntu-latest is rolling to 26.04, and every PR hits it. The fix already exists in FIX-2438 (#4431), which pins the job to ubuntu-24.04. I ported that one change here in 7e9add2 so this PR doesn't stay red until #4431 merges. The two are identical, so the merge will be clean.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be2089d02a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A disconnect ends the request's first run, whose ending hands its model
calls on; the continuation replays the finished calls without making them
again, so the pending slice no longer holds them and the turn's spend lost
them. The turn now reads the request's whole model count
(ctx.request.tokenUsage.byModel), which carries what earlier endings
handed on and counts recovered calls once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62a28169fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…eads its total

A run reported before a suspension (or an interruption) was settled by that
ending and never seen again: the resumed ledger carried only model calls,
and the turn's spentRuns only covered a write that the failure path made.
The request record now carries spentHarnessRuns beside spentByModel, the
ledger starts its total from them (never handing them on again), and core's
readRequestTotalSpend reads the whole request's spend. The harness turn reads
that total, so its spentRuns carry is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
@github-actions github-actions Bot added the mechanism-overlap Touches overlapping mechanisms, or a new name reads like an existing job (advisory) label Nov 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12b1a3e917

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…pted ending's logged runs are carried

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4675799a1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ly its charge changed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
@jhoffner
jhoffner added this pull request to stack #4439 November 1, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mechanism-overlap Touches overlapping mechanisms, or a new name reads like an existing job (advisory) new-mechanism A new public export matches no row of docs/mechanisms/mechanisms.yaml (advisory)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants