Skip to content

fix(s3): honor custom Anthropic base URLs - #239

Open
Ricardo-M-L wants to merge 1 commit into
simular-ai:mainfrom
Ricardo-M-L:fix/anthropic-base-url
Open

Ricardo-M-L wants to merge 1 commit into
simular-ai:mainfrom
Ricardo-M-L:fix/anthropic-base-url

Conversation

@Ricardo-M-L

Copy link
Copy Markdown

Problem

The S3 Anthropic engine accepts base_url, and the CLI forwards --model_url into that parameter, but both generation methods construct Anthropic(api_key=...) without the supplied endpoint. Requests silently use the SDK's environment/default endpoint instead of the explicitly configured gateway.

Change

  • Store the supplied base URL and pass it to both Anthropic client construction paths.
  • Normalize the CLI's empty string to None, preserving the SDK's existing environment/default endpoint resolution.
  • Keep client lifecycle, retries, temperature, token budgets and response handling unchanged.

Scope is the current S3 engine, which is the installed CLI entry point; older S1/S2/S2.5 implementations are unchanged. No new dependencies or public parameters.

Regression coverage

  • Plain generation, thinking=True, and generate_with_thinking.
  • Actual LMMAgent parameter forwarding.
  • Default URL, environment URL, explicit URL precedence, and empty-string behavior using the real SDK.
  • Real SDK + offline MockTransport requests, including custom path prefixes and request/response JSON. With the old engine, all three wire cases use the wrong endpoint; with the fix, all use the explicit endpoint.

Validation

  • Python 3.10 / Anthropic 0.109.0: python -m unittest discover -s tests -v — 10 passed.
  • Python 3.11 / Anthropic 1.15.0: same command — 9 passed, 1 explicitly skipped.
  • black --check gui_agents tests — 77 files unchanged.
  • git diff --check — passed.
  • CLI construction smoke through the real S3/worker/grounding/code-agent classes: endpoint reaches eight mocked SDK calls. The GUI execution loop is mocked, not an actual desktop task.

The skip is an existing compatibility issue: Anthropic 1.15 removes temperature, so the existing plain-generation method cannot call that SDK version unchanged. This is separate from endpoint routing and already has related work in #205; this PR does not claim to fix it or change production dependency pins. The compatible SDK was used only in an isolated test environment. Both thinking wire paths also pass on 1.15.

No paid model calls, live gateways or real GUI interactions were used in verification.

@Ricardo-M-L

Copy link
Copy Markdown
Author

Fresh validation against current main 0fff0e6: the S3 engine still does not forward the constructor's base_url into either Anthropic client, so this fix remains applicable. The affected S3 implementation is unchanged from the PR base.

Independently reran the regression suite on this head with Python 3.11.13 and Anthropic 1.15.0: 9 passed, 1 skipped. This includes actual SDK MockTransport requests for both thinking paths, confirming the requested gateway wins over ANTHROPIC_BASE_URL; constructor precedence and LMMAgent forwarding also pass. The plain-generation wire case is explicitly skipped because of the existing SDK temperature incompatibility (#205), not claimed as covered. Black across gui_agents and tests and git diff --check pass.

The fork lint workflow is action_required with no jobs started, rather than a reported test failure. Could a maintainer authorize the fork workflow and review the two client-constructor changes when convenient? No empty commit, unrelated SDK compatibility change or workflow bypass was added.

Validation and this follow-up were AI-assisted; no full integration-suite or hosted-CI success is implied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant