Repository navigation
feat(fix): estimate agent cost before spending, time each phase (UPT-14) - #203
Merged
lucasbraum merged 3 commits intoOct 17, 2026
Merged
Conversation
…T-14) Before the first agent call, fix estimates what the sites left to the agent will cost (20k input and 2k output tokens per site at the selected model's rates; assumed, not yet calibrated against stored runs) and prints the limit and where it came from. Without --max-cost or maxCost in uptide.yml, the limit is twice the estimate, from $1 up to $10. The stop message names the estimate and the --max-cost that continues. The report records wall time and agent spend per phase (analyze, baseline, install, rules, agent, verify, feedback); the terminal summary and the PR's run details show them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…T-14)
The limit no longer scales with the estimate. Without --max-cost or
maxCost the limit stays $1. The estimate is shown before the first
agent call, and when it exceeds the limit fix stops before spending
anything ("estimated $X for N sites; limit $Y. Run again with
--max-cost X"), exit 2 like the other preflight stops.
Action and App runs pass --max-cost-from-config with the remaining
maxCost, so the estimate and stop messages point to maxCost in
uptide.yml instead of the flag. A test pins the per-site price to the
pricing table entry for the default model (claude-sonnet-5-5, $2/$10).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
… (UPT-14) The preflight cost stop no longer applies when --max-cost-from-config is set. Nobody reruns an Action or App run with a higher limit, and an uncalibrated estimate would leave any upgrade above about 16 agent sites with no pull request under the default maxCost: 1. These runs spend within the limit as before. The PR body and summary name the estimate, the sites left and "Raise maxCost in uptide.yml to X to finish". Local runs keep the stop before spending. The SDK executor enforces the limit inside its session and never set llm.costLimit. Sites it leaves after a budget stop are now counted there, so the message appears on the default executor too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
deleted the
lucasbraum/upt-14-performance-and-budget-on-large-repos
branch
October 17, 2026 20:22
Merged
lucasbraum
pushed a commit
that referenced
this pull request
Oct 17, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Minor Changes - [#203](#203) [`19dd649`](19dd649) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` estimates what the agent's sites will cost and prints the estimate before its first call. When the estimate is above the limit (`--max-cost`, default $1), it stops before spending anything and exits 2: `estimated $3.00 for 50 sites; limit $1.00. Run again with --max-cost 3.00`. Action and App runs never stop on the estimate: they work within `maxCost`, and the summary and the pull request name the sites left and the `maxCost` in `uptide.yml` that finishes them. When the agent stops at the limit, the summary and the pull request name the estimate and the limit that continues. The summary (`Phases`), the pull request's run details and `report.json` (`phases`) give wall time and agent spend per phase. - [#207](#207) [`4a90e9f`](4a90e9f) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` names the first major of a peer blocker that accepts the target (`no 1.x accepts react 19; 2.2.0 does`) and suggests adding it to the command instead of `--allow-peer`. When a verified pack covers that major, the blocker moves as a companion and its pack runs in the same fix: its rules, its detect-based findings and its inventory, each at the companion's own versions. When no pack covers it, the PR says the major needs its own migration and the risk is High. `--allow-peer` stays the suggestion only when no release accepts the target. A group member that the target's own range already accepts (`@casl/ability` under `@casl/react` 5) is no longer reported as a conflict. ### Patch Changes - [#208](#208) [`5fdb60e`](5fdb60e) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The express pack reports the `const { id } = req.params` line as a site when the compiler reports a `string | string[]` error on one of its names, because that line is where the guide types the values once. - [#211](#211) [`213e1a5`](213e1a5) Thanks [@lucasbraum](https://github.com/lucasbraum)! - fix runs prisma generate / graphql-codegen in its verification clone before the baseline and after the upgrade; check names the missing generator step - [#204](#204) [`65b7edb`](65b7edb) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `check` and `fix` now measure how many of the files that use the upgraded package the repository actually type-checks (TypeScript, plus JavaScript under `checkJs` or `// @ts-check`). When that is under half, the summaries say `types cover N of M affected files` and no longer present a clean compile as proof: `fix` passes only when a test run or a build passed, and says the verdict rests on them. - [#205](#205) [`c0332eb`](c0332eb) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` no longer fails on npm repositories whose lockfile carries optional platform packages such as sharp's `@emnapi/*`. npm 11.6 drops them on the first lock-only install and writes a lockfile its own `npm ci` rejects; `fix` now runs the lock-only install twice, at the upgrade and at the parent commit alike, so the lockfile it validates is one `npm ci` accepts. - [#201](#201) [`4550da5`](4550da5) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The react pack now reports `RefObject<HTMLElement>` annotations that need `| null` at the declaration, including in files that type a prop with the global `React.RefObject` and never import react. The compiler reports these where a ref is passed in, so the declaration to edit was missed. - [#216](#216) [`95a3bf5`](95a3bf5) Thanks [@lucasbraum](https://github.com/lucasbraum)! - setup PRs pin Action v0.14.3 - [#209](#209) [`48df030`](48df030) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The zod pack reports `.refine(check, { message })`, the type names zod 4 marks deprecated (`ZodTypeAny`, `ZodIssue`, `ZodSchema`, `ZodErrorMap` and the others, including `import('zod').ZodTypeAny`) and `errorMap` options with `ctx.defaultError`, as deprecated findings. - [#200](#200) [`4e4cc3e`](4e4cc3e) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The zod pack reports names zod 3 exported from its root and zod 4 exports only from `zod/v3` (`SafeParseReturnType`, `ZodTypeDef`, `ZodEffects`, the `Zod*Def` interfaces), which the surface diff counted as unchanged, and `fix` now rewrites `z.string().uuid()` to `z.guid()` instead of `z.uuid()`, so ids that zod 3 accepted still validate. Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
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.
Part of UPT-14 (HN slice). Install caching and analysis memory are out of scope (UPT-82, #196).
What changes
report.jsongetsphases, which records wall time and agent spend for analyze, baseline, install, rules, agent, verify and feedback. The terminal summary shows aPhasesrow, and the PR's run details show aPhases:line.fixcounts the sites left to the agent, prices them at the selected model's listed rates and prints the estimate with the limit. The estimate is kept inllm.estimate.--max-cost/maxCost, and is never raised for the estimate. When the estimate exceeds the limit,fixstops before spending anything, with exit 2 like other preflight stops:estimated $3.00 for 50 sites; limit $1.00. Run again with --max-cost 3.00.--max-cost-from-config, passed by the action): no preflight stop, because nobody can rerun them and the estimate is uncalibrated. They spend withinmaxCostas before. The PR body and summary name the estimate, the sites left andRaise maxCost in uptide.yml to X to finish. The SDK executor now records the sites it leaves after a budget stop (llm.costLimit), so the message also appears on the default executor. Local runs keep the stop before spending.Calibration: no UPT-76/78 run reports with spend exist, so the estimate rests on stated assumptions: 20k input and 2k output tokens per site, uncached. A test pins this to the pricing table entry for the default model (
claude-sonnet-5-5, $2/$10 per million), which comes to $0.06 per site. The issue's "within 2×" criterion is not yet shown.Tests: estimate and table price, stop messages for both settings (
llm/cost-estimate.test.ts); estimate shown before the first call, preflight stop with no agent call, phase order and spend (fix/generic.test.ts); exit 2,$1default,--max-cost-from-config(cli.test.ts); action args (action/run.test.ts); Action runs on the patch and SDK executors work within the limit and report what is left (fix/generic.test.ts).pnpm test,pnpm typecheckand lint pass.🤖 Generated with Claude Code