Repository navigation
Conversation
… and Claude on Anthropic Messages ug configure --agents vscode takes --provider <catalog.schema.name> or --model-location <catalog.schema>, picking the models the way ug copilot does. The extension sends a provider's header, uses the gateway's OpenAI route for its OpenAI models, and calls every Claude model through Anthropic Messages with prompt-cache points. Co-authored-by: Isaac <no-reply@databricks.com>
…s, retry a refused output limit A model's real output limit can be below the one ug configures, which Anthropic Messages rejects; the gateway names the limit it allows, so retry once with it. --provider and --model-location now refuse any other model agent in the same run, and the per-model api picks its route through a lookup. Co-authored-by: Isaac <no-reply@databricks.com>
| if agent is not None and agents is not None: | ||
| raise RuntimeError("Use either --agent or --agents, not both.") | ||
| if provider is not None or model_location is not None: | ||
| requested_agents = [a.strip().lower() for a in (agents or "").split(",") if a.strip()] |
| } else if (last?.role === role) { | ||
| last.content.push(...content); |
There was a problem hiding this comment.
| if (!allowed) { | ||
| throw new Error(`AI Gateway returned ${response.status}: ${detail}`); | ||
| } | ||
| response = await post(token, { ...body, max_tokens: allowed }); |
Polly AI ReviewBlocking issuesNone confirmed. Security vulnerabilitiesNo confirmed vulnerability found. The live job excludes fork PRs and merge-queue events and disables checkout credential persistence. Secret scoping can still be tightened as noted below. Non-blocking notes
ApproachThe approach is sound: reuse production authentication, request builders and stream parsers, test format details offline, and reserve live tests for actual gateway acceptance, routing and image interpretation. No materially simpler replacement is evident. SummaryDiff size (computed): 16 files; +990 / -123 lines (1113 changed text lines); 0 binary files.
Shares use additions + deletions, including generated text and lockfiles. Binary files have no line count. Tests include fixtures/helpers under test paths and colocated test/spec files; categories are path-based, not coverage measurements. ChangesThe intended outcome is to verify that requests built by the VS Code extension work against a real gateway, including Model Provider Service routing. The full snapshot includes the inherited provider/location configuration and Anthropic Messages implementation, request retry handling, shared catalog helpers, live harness, CI job, documentation, package metadata and generated extension bundle. The breadth is justified by exercising those production paths. No concrete implementation removal was identified that preserves the stated outcome. Keeping the existing MPS foundation separate in the stack remains useful for review and reversion. TestsTest-by-test assessmentAn isolated, in-memory runner executed the frozen-head Python tests, extension component tests, typecheck and live gateway tests were not executed during this review. The PR reports local live results but explicitly leaves MPS cases and negative controls unverified locally.
Existing authentication tests cover token caching, concurrent acquisition, forced renewal and command failure. Existing Chat Completions format coverage remains; the new live Chat Completions case is not enabled in CI. No separate browser or native VS Code E2E setup is needed for these HTTP-format contracts. To verify in an authorized environment, run ScopeAll changes plausibly support the stated outcome, including the inherited configuration/routing foundation and generated bundle. No clearly unrelated changes were found. The absence of a linked issue does not create a scope concern because the description provides a concrete requested outcome. Automated review by Polly · workflow run |
Co-authored-by: Isaac <no-reply@databricks.com>
e678d82 to
b67321a
Compare
…ond set of names Co-authored-by: Isaac <no-reply@databricks.com>
npm run live sends the requests the extension builds to a real AI Gateway: a streamed turn and a tool call on each route, an image inside a tool result, a prompt-cache read, the refused-output-limit retry, and that a Model Provider Service's models are served only with its routing header and not on the mlflow route. A new CI job runs it with the workspace secrets, and skips where those aren't available. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
b67321a to
7c189d1
Compare
🥞 Stacked PR
Use this link to review incremental changes.
Summary
npm run livesends the requests this extension builds to a real AI Gateway and checks the replies. Everything the extension does today is tested against hand-written bodies and a stubbedvscodemodule, so nothing checks that the gateway actually accepts what we send — which is where every bug this extension has had so far came from: a thinking model's content blocks, images inside tool results, and an output limit the gateway refuses.What it covers
tool_result, where the reply has to name the image's colour. This is the part each route builds differently.cache_read_input_tokens > 0.max_tokensmust still produce an answer.mlflow/v1route. Without those a 200 would prove nothing, since the gateway could have answered fromsystem.aiwhile the routing was dead.How it is wired
livenpm script bundlestest/live/requests.live.tswith the same esbuild flags astest, so the live cases run the same sources that ship. The offline suite globstest/*.test.tsand never collects it.UG_LIVE_*variables; a case whose variables are unset isn't registered, so the CI job decides what runs.vscode-extension-livejob runs it with the workspace secrets, using the same services and targets as the integration CUJs. It doesn't run for pull requests from forks, which don't get secrets, or in the merge queue.UG_LIVE_AUTH_COMMANDorUG_LIVE_TOKEN, so the extension's ownauth.tsis exercised rather than bypassed.Each run costs a few cents and takes about 20 seconds.
Testing
npm run liveagainst a staging workspace: 5 cases, all passing in 18.5 s — the Claude turn plus its cache read, the Claude tool call and the image in its tool result, the output-limit retry, the GPT turn and tool call on Responses, and the tool-result image on Responses.chat_completionscase is registered: every OpenAI-type model on the CI workspace is GPT-5 or newer, which ug routes to Responses. Covering that wire needs a GPT-4-class target added to a CI service.tscclean.Stacked on #1358, which adds the Model Provider Service support and the Anthropic Messages route this exercises.
This pull request and its description were written by Isaac.