Skip to content

✨ feat: Per-provider endpoints for cross-provider ladder rungs - #32

Merged
bdougie merged 3 commits into
mainfrom
worktree-issue-27-ladder-rung-endpoint
Jul 5, 2026
Merged

bdougie merged 3 commits into
mainfrom
worktree-issue-27-ladder-rung-endpoint

Conversation

@bdougie

@bdougie bdougie commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Closes #27

Problem

A ladder rung on a provider other than the worker's was always constructed with provider.Config{APIBase: ""} — there was no way to point e.g. an ollama/qwen2.5-coder:32b rung under a claude worker at anything but the provider default (localhost:11434).

Solution

The per-provider endpoint section shape from the issue (the one noted to compose better if more per-provider settings appear later):

[worker.escalation]
ladder = ["ollama/qwen2.5-coder:32b", "claude/claude-sonnet-5"]

[providers.ollama]
api_base = "http://gpu-box:11434"

At rung construction, a rung on the worker's own provider still inherits worker.api_base; when that doesn't apply (cross-provider rung, or own-provider with no api_base set), the endpoint comes from [providers.<name>], falling back to the provider default when no section exists. FromTOML also lets [providers.<worker.name>] serve as the worker's own endpoint when worker.api_base is unset, so the section behaves as one consistent endpoint directory.

Acceptance criteria

  • ✅ A cross-provider rung can be configured with a non-default endpoint via TOML (agent test registers a fake provider and asserts the rung executor receives the [providers.<name>] endpoint).
  • ✅ Existing string-form ladders parse unchanged (no changes to ParseRung or the ladder entry format; all pre-existing ladder tests pass untouched).
  • ✅ README "Model Escalation" and example.config.toml limitation notes replaced with the new syntax.

Also in this PR

Backfilled tests for four pre-existing per-function coverage gaps that blocked the pre-commit hook on any commit: the two warning branches in agent.New (unknown advisor/rung provider), the negative-top clamp in loop.NewEscalation, the retry-with-history hint in advisor.ResolveStrategy, and the read-error/sort-tiebreak paths in observer.AnalyzeModels.

Scoping note: no SWEEPER_PROVIDERS_* env override was added — map-valued keys don't fit the static env-var pattern, and the acceptance criteria only called for TOML.

bdougie added 3 commits July 5, 2026 12:21
Ladder rungs on a provider other than the worker's were always built
with an empty api_base, so e.g. an ollama rung under a claude worker
could only hit the provider default (localhost:11434). Add a
[providers.<name>] TOML section supplying per-provider endpoints,
consulted at rung construction whenever a more specific api_base does
not apply. It also serves as the worker's own endpoint when
worker.api_base is unset. String-form ladders parse unchanged.

Also backfills tests for four pre-existing coverage gaps (agent.New
warning branches, NewEscalation clamp, ResolveStrategy retry hint,
AnalyzeModels error/sort paths) that blocked the pre-commit hook.

Closes #27
- Warn when a [providers.<name>] section matches no registered
  provider (typically a typo like [providers.olama]) instead of
  silently routing rungs to the provider default endpoint.
- Drop the "providers.*.api_base" wildcard from TOMLConfigKeySet: the
  set is exact-match and a starred literal can never match a real key;
  the comment now documents the dynamic section instead.
- Extract registerCapturingProvider test helper to dedupe the two
  ladder endpoint tests.
…der-rung-endpoint

# Conflicts:
#	example.config.toml
#	pkg/agent/agent_test.go
#	pkg/loop/escalation_test.go
#	pkg/observer/observer_test.go
@bdougie
bdougie merged commit bd51561 into main Jul 5, 2026
2 checks passed
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.

Ladder rungs on a different provider can't be pointed at a non-default endpoint

1 participant