Repository navigation
fix(fusion): count worker spend once and where the person sees it - #1130
Draft
sosidudku1 wants to merge 2 commits into
Draft
sosidudku1 wants to merge 2 commits into
sosidudku1 wants to merge 2 commits into
Conversation
- The composer's $ readout now includes Fusion workers: a worker's throwaway session forwards its calls to the session that delegated, priced by the same rules (unpriced stays unpriced, local stays local). Escalation and judge calls, which go straight to the provider, are counted on the delegating session too. (ATO-1388) - A task re-run on the escalation model keeps the local attempt's usage on its row, so the status header and the checkpoint no longer price the re-run a second time on top of its escalation spend. (ATO-1319) - A split's subtask finds its root through the task tree's parent links, so its spend and side effects reach the run checkpoint and the resume budget. (ATO-1320) - The overnight doc and `task create --max-cost-usd` help say that Fusion workers are not in the money cap and point to llm.runMode.fusion.turnBudgetUsd. (ATO-1315)
Move the worker-session forward into forwardWorkerUsage so it is tested, and test that escalation and judge calls name the delegating session and are recorded on it.
This branch has not been deployed
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.
Four money-accounting fixes in Fusion, grouped because they touch the same spend paths.
Worker spend near the composer (ATO-1388). The
$readout only counted the main model. Each worker runs in a throwaway session, so its calls were recorded there and never reached the person's session. NowSessionUsageLedger.forward()links a worker session to its parent when the runtime mints it, and every call recorded under the worker lands on the parent with the usual rules: a model with no known price shows as$0.31+, a local worker counts as local. Escalation advice and the judge call the provider directly, past the seam that feeds the ledger, sofusion.delegatenow passes its session id toescalationCompleteand the runtime records those calls there. Nothing is written toturnUsageMeter, so the per-turn planner cap is unchanged. The re-run on the escalation model goes throughrunTurnin a worker session, so it is counted once by the forward.Re-run counted twice (ATO-1319). After
escalationReplacere-ran a task, the row carried the re-run's usage, which the header and the checkpoint priced again at the worker rate on top of the escalation spend already counted. The row now keeps the local attempt's usage; the re-run's cost stays in escalation spend.Split subtasks on resume (ATO-1320). The checkpoint only had rows for top-level tasks, so a subtask's spend and side-effect tools were dropped. The recorder now walks the task tree's parent links (
useParents) to the root row. It does not cut the id at/, since a root id may contain one. The root's own result is still written when the split closes.Money cap help (ATO-1315).
docs/user/overnight.mdandtask create --max-cost-usdhelp now say that paid Fusion workers are not in the cap and can take a run well over it, and point tollm.runMode.fusion.turnBudgetUsd. Whether to count them in the cap is still an open decision (ATO-1288).Tests added:
usage-meter.test.ts(forwarding),escalation.test.ts(re-run usage),run-checkpoint.test.ts(subtask on root).Merge note. #1139 adds a
describeblock at the same spot insrc/tools/fusion/escalation.test.ts. Whichever merges second: keep both blocks.The production wiring is tested too:
forwardWorkerUsage(used bybootstrap.ts) inusage-meter.test.ts, the escalation/judge record inruntime-tool-catalog.test.ts, and the session id on judge calls injudge.test.ts.Not yet checked on the second Mac.