Repository navigation
feat(fix): experimental --agent sdk executor on the Claude Agent SDK - #89
Merged
Merged
Conversation
Hidden flag. Assisted fixes run as one Agent SDK session per pack rule over its files in the temporary clone: read/edit tools, Uptide's own type-check, lint and tests as in-process tools, no shell. One gate at the end of each task (file scope, compiler escape hatches, types matched across line shifts, lint and tests no worse than baseline); a rejected task is reset and its sites stay manual. Anthropic only; the patch agent stays the default. The SDK is an optional peer, never bundled. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…int gate The guard denied StructuredOutput, so no summary came back; lint judged unformatted edits where settle formats first. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
A React 19 RefObject<T | null> error is fixed in the prop type the compiler links it to, in another file; the task's scope had only the site files, so the agent stopped and said so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…ites by their own error An upgrade can fail tests until every site is migrated: comparing each task with the pre-upgrade baseline rejected every zod task. A site fixed in another file (a prop type) now counts as fixed. The cost of a session stopped by its budget is kept: the SDK emits the result, then throws. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…l back when the related run cannot start Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…repository Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
…o in the period context and decisions Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
… data and distribution - typeChecker(): one TypeScript builder program per workspace across checks, re-checking only workspaces whose repository files changed (PATH monorepo: 7.1s fresh, 2.3s after a one-file edit, 41ms unchanged). diagnostics() is a one-shot of it. - Each task's edit rules run right after its session; single-site rules share one gate, retried one task at a time when it fails. - Tests per batch are those related to its files; the start-of-batch run happens only to explain a failure. settle still runs the full selected suite. - The session also sets DISABLE_FEEDBACK_COMMAND and CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL. docs/privacy.md says what it sends; the decision record has the dependency-vs-optional-peer finding. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
A workspace whose test script is just the runner, with no config file, ran its whole suite on every check, and the root's pnpm -r test ran every workspace's again. With related: the owning workspaces and their direct dependents, the root only for its own files, and a bare runner script in related-tests mode. Verification's selection is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
#87 fixed the jest argument order and the related-tests fallback on main, and matches diagnostics across line moves (gitLineMoves). Main's versions are kept; this branch's duplicate jest fix and its changeset are dropped. The SDK gate now uses gitLineMoves too, so a task that passes its gate is judged the same way by the final verdict; newDiagnosticsAcrossShifts is gone. The incremental typeChecker and the related-tests mode for the SDK gates are kept on top of main's verify.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
marked this pull request as ready for review
October 12, 2026 18:24
Merged
7 tasks done
lucasbraum
added a commit
that referenced
this pull request
Oct 13, 2026
## What and why Implements [UPT-23](https://linear.app/uptide/issue/UPT-23/make-the-agent-sdk-executor-the-default-for-anthropic). Authenticated Anthropic CLI fixes now use the Agent SDK by default when it is installed; without it they fall back to the patch executor with a one-line hint in the fix output. `--agent patch` opts out; OpenAI, Gemini and callers supplying a fixer retain the patch executor. `--no-llm` still disables assistance. One session handles the package's remaining manual sites with shared rule knowledge. It reuses the post-install TypeScript program, scopes and caches session tests, and runs the full selected suite once at final verification. Confirmed compiler findings already resolved by mechanical edits are skipped by both executors. Undeclared scratch additions are removed before revalidating the remaining edits; path checks reject symlink escapes. Stripe's shared period helper and both executors' guidance accept legacy subscription-level and modern item-level webhook fields. Endpoint API versions determine the payload shape. The SDK stays an optional peer, external to both bundles: as a dependency it would add about 270 MB to every `npx uptide`, `--no-llm` and other providers included. The Uptide Action installs it. ADR 0016 records the size decision, our reading of the published terms, and three questions for Anthropic that remain open. Privacy docs and CLI disclosure describe repository reads, check output and the SDK traffic/settings/persistence switches. ## Benchmark Three trials × three public repositories × two executors: all 18 sequential runs completed with Sonnet 5.5, medium effort and a $1 per-package budget. SDK trials omit `--agent`, testing the new default; controls explicitly select patch. Times, costs and counts are medians (ranges); cost per agent fix is total spend / total agent-fixed sites across the three runs. Final lockfiles match across all trials for each repository. | Repository / upgrade | Executor | Time, median (range) | USD, median (range) | USD / agent fix | Fixed: mechanical + agent; manual | Types before → after | Verified | | --- | --- | --- | --- | --- | --- | --- | --- | | boxyhq / Stripe | patch | 2m58s (2m41s–3m18s) | $0.031 ($0.031–$0.072) | $0.011 | 2 + 4; 1 | 4 → 0 | 3/3 | | boxyhq / Stripe | sdk | 2m29s (2m27s–2m58s) | $0.188 ($0.186–$0.191) | $0.044 | 2 + 4 (4–5); 1 (0–1) | 4 → 0 | 3/3 | | alanagoyal / React | patch | 4m56s (4m06s–5m00s) | $0.103 ($0.100–$0.105) | $0.010 | 1 + 10; 2 | 13 → 2 | 0/3 | | alanagoyal / React | sdk | 1m47s (1m45s–1m48s) | $0.077 ($0.076–$0.079) | $0.006 | 1 + 12; 0 | 13 → 0 | 3/3 | | PATH / zod | patch | 7m36s (7m09s–7m37s) | $0.122 ($0.119–$0.144) | $0.035 | 17 + 4 (3–4); 2 (2–3) | 27 → 6 (6–7) | 0/3 | | PATH / zod | sdk | 6m59s (6m43s–8m30s) | $0.221 ($0.217–$0.239) | $0.038 | 17 + 6; 0 | 27 → 2 | 0/3 | [Method, exact revisions, individual trials and excluded development runs](https://github.com/uptide-dev/uptide/blob/c8da53e6b67e1c5f8b354fe4b2f8357a758df127/docs/agent-sdk-evaluation.md). - PATH meets the speed target on median, with all 23 planned fixes retained in every SDK run; one run still takes 8m30s. A new engine diagnostic and failing designer tests keep all PATH results unverified. - React verifies 3/3 with SDK versus 0/3 with patch, which leaves two ref-type errors in every trial. - Stripe verifies 3/3 with both executors. Shared knowledge improves patch too; patch is substantially cheaper here. The previous one-third-cost-per-fixed-site claim does not hold in this rerun. - Seven PATH sites are now correctly counted as mechanically resolved for both executors. Compare total fixes and remaining diagnostics, not agent-only totals, with PR #89. - Synthetic checks of all six generated Stripe migrations confirmed that both handlers accept legacy and item-based payloads. Two SDK and all three patch trials retain the standalone sync script's API pin as a manual decision. The measured executor sources are in `cf5682b`; the later merge of `main` adds 0.8.0 metadata and `uptide.yml` support without changing the measured executor, pack or verifier. Fixture roots have no `uptide.yml`. Explicit configured executors are covered by additional tests. SDK uses full baseline/final suites and scoped session checks; patch retains its existing test selection/retry behavior. The test scopes are not identical. ## How it was verified - [Implementation CI](https://github.com/uptide-dev/uptide/actions/runs/38334848211) passed lint, build, typecheck, full tests and clean-container npm/pnpm/Yarn smoke tests on Node 20 and 22. - Node 20: 1,724 tests passed, 34 skipped. Node 22: 1,726 passed, 32 skipped, plus 18 passing package-manager/bot-loop network tests. - [Every migration pack passed](https://github.com/uptide-dev/uptide/actions/runs/38334848243). - Clean npm installation of the packed CLI automatically installed and resolved the SDK. - A real recursive pnpm check confirmed `--no-bail` runs later workspaces while preserving failure status. - Final documentation links and `git diff --check` passed locally. The last commit changes documentation and a build-config comment only. ## Limits and tradeoffs One session is accepted or reverted atomically. Users who want the SDK executor install the optional peer (roughly 270 MB unpacked, with native/peer packages) next to Uptide. ADR 0016's license finding is our reading of the published conditions, not confirmation from Anthropic; its three questions for Anthropic are open. Live Stripe events and service-dependent application integration tests were not run for this benchmark. PATH is not ready to publish, and the under-eight-minute result is a median rather than a per-run guarantee. ## Checklist - [x] Tests for the change - [x] `pnpm lint`, `pnpm typecheck` and `pnpm test` pass in implementation CI - [x] README, privacy, config and executor docs updated - [x] New changeset for the default after the 0.8.0 release - [x] Dependency decision requested by UPT-23 and recorded in ADR 0016 - [x] No private source or local paths added to fixtures, tests or docs - [x] CONTRIBUTING.md invariants retained --------- Signed-off-by: Lucas Braum <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Experiment behind a hidden flag:
uptide fix <pkg> --agent sdkruns assisted fixes as Claude Agent SDK sessions instead of the single-shot patch agent. The default path does not change. Non-Anthropic providers are refused and keep the patch agent. Design, terms and the dependency finding are indocs/decisions/0016-agent-sdk-executor.md; what a session sends to Anthropic is indocs/privacy.md.What's in it
packages/core/src/fix/sdk-agent.ts. One Agent SDK session per pack rule over its file group, withcwdset to the temporary clone.Read,Grep,Glob,EditandWrite, plus three in-process tools:check_types,run_lintandrun_tests. These run Uptide's own type-check, lint and tests throughcommand(), which strips secrets from the environment.permissionMode: 'dontAsk',settingSources: [],persistSession: false, and a minimal environment.PreToolUseguard refuses reads outside the clone,.git, symlink escapes, edits outside the task's files, and every other tool.{changed, newFiles, decisions, assumptions, couldNotDo}.@ts-ignore,@ts-expect-error,as anyoras unknown as. Otherwise its edits become one commit.typeChecker(): one TypeScript builder program per workspace across checks, re-checking only what a change can affect). Diagnostics are matched through main'sgitLineMoves. Lint runs on the changed files after formatting.vitest run/jestscript run in related mode. They are compared with the start only when one fails. If one fails, the batches are replayed from the start and the one that broke it is dropped.settle, the full selected suite, the pre-upgrade baseline throughgitLineMoves, the tree hash and the export.report.jsonunderllm.tasks[]: turns, tokens, cost, wall time, tool calls, gate verdict, rejection, and summary.as numberthat would store an Invalid Date.--agent sdkrefuses OpenAI and Gemini.Results (round 2)
All runs used
claude-sonnet-5-5on public repos, 3 runs per agent, with no--pr,--max-costat $1, on the same build (0f7a9e7, after merging #87). Each value is the median, with the range in parentheses. Wall time is the wholeuptide fixrun. "Rejections" counts reverted attempts for the patch agent and rejected tasks for the SDK agent.fix stripefix zod --target 4.6.5¹ No test in boxyhq imports the migrated files, so the related run finds none and the repository's suite runs instead (main's fallback from #87).
²
fix react @radix-ui/react-tabs @radix-ui/react-tooltip react-resizable-panels --target 19.3.0 --allow-peer @emoji-mart/react.³ The Mac slept during one patch run (wall clock 13,579s). Its own report measured 270s, so it counts as about 290s.
boxyhq checks, all 3 runs per agent:
sync-stripe.jsCost per fixed site, pooled over the 3 runs:
Speed, against the PATH target of under 8 minutes
Not met: the median is 10m57s. Round 1 took 28 minutes; the first change in this round brought it to 18m50s and the gates to 10m32s, with the same fixes.
Where the 10m32s goes (
--verbose):settle: full suite 1m38s, types 23s)The patch agent takes the same time on this build (652s). The rest is Uptide's own verification, which neither agent can shorten. On this repo the root
testscript ispnpm -r run test, so the baseline and final suites run every workspace twice: once from the root and once per workspace. Removing that duplication would save about 1.5–2 minutes for both agents. It changes the default path's test selection, though, so it is not in this PR.The round's speed changes:
vitest runscript and the root'spnpm -rran the whole monorepo on every check;run_testslimited to the owning workspaces;Failure modes seen this round
notes-app.tsxsites now go out as one task, but their fixes are in two different presenter files. The agent answers "No patch submitted" 3/3 times, although it describes the right fix. Before fix(fix): assisted Stripe fixes on real repositories #87 it fixed 12/12. I'm flagging it as a separate fix.ZodRawShapeandZodErrorMap: "no edit needed" or "needs a product decision").Distribution (finding, not acted on)
The terms allow a normal
dependenciesentry: npm installs Anthropic's unmodified bytes, and Uptide redistributes nothing. The install size rules it out. The SDK is 5.5 MB, but its platform binary is 240.7 MB on macOS arm64 and 257.1 MB on Linux x64, plus about 24 MB of peers. That is about 270 MB on everynpx uptide, against Uptide's 11 MB, including for users who never pass the flag. Keep the optional peer.Three questions to confirm with Anthropic before a default ships:
The links are in the decision record.
Recommendation
Go for Anthropic, as the default when the SDK is installed; otherwise the patch agent, with a one-line hint.
uptide fixoutput that suggests installing the SDK when it's absent.🤖 Generated with Claude Code