Repository navigation
Add Anthropic, OpenAI and Gemini assisted fixes with strict budgets - #7
Merged
Merged
Conversation
7 tasks done
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.
Assisted fixes can now use Anthropic, OpenAI or Gemini through direct HTTPS, with the existing scoped prompts,
submit_patch, compiler verification, patch restrictions and publish gate. Every call and retry must fit a worst-case cost reservation before HTTP; the default budget is $1 per package, including migration packs.Selection and privacy
--provider/--model→UPTIDE_PROVIDER/UPTIDE_MODEL→uptide.config.json→ key detection (Anthropic, OpenAI, Gemini). The config permits provider/model strings only and rejects key-like content even when overridden, duplicated or JSON-escaped. Credentials come from environment variables.supportsForcedTool). Sonnet 4.6, OpenAI and Gemini forcesubmit_patch; Sonnet 5.5 uses auto + strict schema, medium effort and a tool-only system prompt. Invalid/missing tool calls are paid failed attempts with “respond only by calling submit_patch” feedback. API/network errors never print bodies or credentials; calls without trustworthy usage retain their full reservation. HTTP 429 is rate limited: wait for Retry-After (60 seconds when absent), then retry only after another budget preflight.OPENAI_BASE_URLnow selects Chat Completions with Bearer authentication and a forced function; compatible, not verified. The official OpenAI endpoint still uses Responses. Protocol fixtures cover both paths. No new SDK or framework dependencies.custom, so deployment names cannot leak. Documentation explains which chosen provider receives snippets.Defaults and pricing sources (checked 2026-10-04)
claude-sonnet-5-5, medium effort, selected by live comparisongpt-6.1-sol, Responses API with forced function callgemini-3.8-flash, generateContent with ANY restricted tosubmit_patchThe dated table includes cache usage, long-context tiers and the scheduled Gemini promotional-price change. Unknown IDs use component-wise maximum listed provider rates with a warning. Input reservation uses serialized UTF-8 bytes plus framing margin, and output is capped at 8,192 tokens. Returned usage settles actual cost; rejected patches are charged too. External endpoints may have different tariffs; accounting is against the documented table. See
docs/model-pricing.md.Validation
pnpm lint: cleanpnpm typecheck: passedpnpm test: 827 passed (620 core, 207 CLI); 15 existing opt-in tests skippedpnpm smoke: local Docker Node 22 plus CI Node 20 and 22, npm / npm workspaces / pnpm / Yarn classic / Yarn Berry; all assertions passedpnpm public:check: clean with the external denylist (no terms or credentials included)Offline tests replay synthetic success protocol fixtures for all adapters and a sanitized live Sonnet 5.5 no-tool response captured with a controlled 16-token output cap. Compiler acceptance, retry feedback/accounting, rate-limit waits, unknown usage, no-key side effects, config precedence/rejection and telemetry allowlisting are covered. CI makes no live LLM calls. The evaluation helper also typechecks independently.
README “Choosing a model” includes measured results. The following measurements are also checked in as
docs/provider-evaluation.md.Live provider evaluation
Measured 2026-10-04 against the public storefront fixture. Each run used a fresh
isolated clone of the same baseline and a $1 package budget. Targets: zod 4.6.5 and
stripe 23.0.0. Dependency installation used lifecycle scripts off. Credentials were
read from process environment only; no keys, request headers or raw API errors are
included here. These are single trials, with some runs concurrent, not a general
model quality or latency benchmark. Wall time includes clone, analysis, install,
agent calls and verification.
“Verified” requires both compiler and fixture tests to pass through the existing
publish gate. Successful zod runs fixed 25 mechanical + 4 agent sites (5 tests);
successful Stripe runs fixed 3 mechanical + 3 agent sites (3 tests). Attempts are
provider requests, including rejected patches and HTTP/transport failures; one accepted patch may
resolve several sites. Cost is calculated from returned usage and the dated standard
price table, not an invoice; this also applies to Gemini's free-tier calls.
Reservation is the sum of individual pre-call worst-case bounds, not actual spend or
a permanently withheld total. Reported usage settles each reservation. “Unknown”
is the retained reservation for calls with no trustworthy usage; it still counts
against the $1 ceiling. No run exceeded its budget.
Storefront runs
claude-sonnet-4-6claude-sonnet-4-6claude-sonnet-5-5claude-sonnet-5-5claude-sonnet-5-5claude-sonnet-5-5gpt-6.1-solgpt-6.1-solgemini-3.8-flashgemini-3.8-flashThe first Gemini zod run received eleven HTTP 503 responses and one HTTP 429; Stripe
received one HTTP 200, four 503s and two 429s. Rate limits honored
Retry-After, defaulting to 60 seconds when absent, beforeretrying. These runs did not verify; the publish gate stayed closed. They demonstrate
service unavailability/rate limiting, not an invalid model ID or failed tool protocol.
The smoke and Stripe's successful call both echoed
gemini-3.8-flash.The serial reruns also failed verification after waiting and retrying:
gemini-3.8-flashgemini-3.8-flashNo model ID or token usage was returned in these serial reruns. The zero confirmed
spend is not a claim of zero possible billing: every failed request kept its full
reservation. Zod retained four compiler errors; Stripe retained three (its three tests
passed, which alone cannot pass verification). Gemini migration quality remains
unmeasured under successful service conditions; a live rerun is needed when the free
tier is available. These are not classified as adapter protocol failures.
Anthropic choice
claude-sonnet-4-6/ API defaultclaude-sonnet-5-5/ API default (high)claude-sonnet-5-5/ mediumSelect Sonnet 5.5 with
mediumeffort: equal sites and verification, no skippedtool calls, one fewer attempt than 4.6, and lower cost/time in this small sample.
The high-effort comparison omitted
output_config, preserving 5.5's documented APIdefault (adaptive thinking, high effort). The medium trial explicitly set
output_config.effort=medium. Thinking itself was left at the API default in both.Sonnet 4.6 remains selectable and retains forced tool use. The sample is too small
to estimate a reliable general no-tool-call rate.
Protocol smokes
Every smoke returned HTTP 200 and exactly one valid
submit_patch, in one attempt.Model IDs below are the exact strings echoed by the APIs (also matching the requested
IDs). No 429 occurred in these minimal calls.
claude-sonnet-4-6claude-sonnet-5-5claude-sonnet-5-5gpt-6.1-solgemini-3.8-flashA separate controlled Sonnet 5.5 call capped output at 16 tokens to capture a real
no-tool response for offline regression testing. It echoed
claude-sonnet-5-5, endedat
max_tokens, and reported 757 input / 16 output tokens ($0.001674). It is excludedfrom the normal no-tool frequency above. CI checks that it consumes an attempt and
budget, adds “respond only by calling submit_patch” feedback, and can recover on a
valid subsequent response. Successful protocol fixtures are synthetic; this truncated
response is a sanitized live capture.
Reproduction and sources
Build core and use
scripts/eval-providers.tswith--smoke, or--repoplus--only=zod|stripe. Provider/model overrides and--effort=high|medium|lowallowcontrolled comparisons. API keys come only from environment variables. See
model pricing for commands and exact budget accounting.
Initial harness setup errors occurred before any API call and cost $0; the helper
was corrected to import built core so worker entry points resolve.
Official documentation checked 2026-10-04:
Custom
OPENAI_BASE_URLuses Chat Completions, tested offline against a protocolfixture. The official OpenAI default uses Responses and was verified live above.
Custom deployments remain compatible, not verified.