Skip to content

Multi-gateway providers: named, typed OpenAI-compatible gateways#762

Open
maciej-makowski wants to merge 1 commit into
G-Research:masterfrom
maciej-makowski:feat/multi-gateway-providers
Open

Multi-gateway providers: named, typed OpenAI-compatible gateways#762
maciej-makowski wants to merge 1 commit into
G-Research:masterfrom
maciej-makowski:feat/multi-gateway-providers

Conversation

@maciej-makowski

Copy link
Copy Markdown
Contributor

Summary

Generalises Bobbit's single hardcoded AI Gateway integration into an ordered list of named, typed OpenAI-compatible gateways. This lets you point Bobbit at one or more OpenAI-style endpoints — for example a local model server (llama.cpp / llama-swap, LM Studio, Ollama, vLLM) — alongside (or instead of) the existing AI Gateway.

Draft for review/testing. Opening this so the feature can be exercised against both local models and an AI Gateway before it's marked ready.

Motivation

Today the gateway integration assumes a single aigw.url that is Bedrock-routed for Claude ids. There's no first-class way to register a plain OpenAI-compatible endpoint, which is what most local model servers expose. This PR makes the gateway list a proper, typed, user-editable concept.

What's included

  • Typed gateway model. Each gateway is { id, name, url, type, enabled }. Two types:
    • aigw — Bedrock-routed Claude ids (singleton; name pinned to "aigw" so default.sessionModel still resolves).
    • openai-compatible — raw OpenAI-style endpoints; ids passed through untouched (never Bedrock-routed).
  • Persistence + migration. Gateways persist under a new modelGateways preference. An idempotent boot-time migration upgrades the legacy single aigw.url (+ aigw.exclusive) pref into the list with no user action.
  • Type-driven writers / discovery. models.json writers and model discovery dispatch on gateway type via dispatch tables. The aigw Bedrock+headers block is preserved byte-for-byte.
  • Derived exclusivity. "Exclusive mode" is derived (any enabled aigw-type gateway ⇒ exclusive) rather than stored as a separate flag.
  • REST surface. Per-gateway refresh/status endpoints, plus backward-compatible configure/refresh/status/DELETE shims for the legacy single-gateway API.
  • Settings UI. A list editor under Settings → Models to add/edit/enable/remove gateways, with an exclusivity warning.
  • Model-picker filter. A display-only, persisted, default-off "hide unconfigured / Has key" toggle that hides built-in models with no API key (never hides the currently-selected model; never affects /api/models or server-side resolution).

Behaviour & compatibility

  • Existing single-gateway setups migrate automatically and keep working through the legacy shims.
  • openai-compatible gateways are never Bedrock-routed, even for claude-* ids.

Testing

Built on the latest master. All feature tests green locally:

  • Unit (node): 32 multi-gateway/aigw logic tests (exclusivity, migration, validation, type-driven writers, pricing).
  • API E2E: 25 multi-gateway provider API tests (CRUD, per-gateway refresh/status by name, legacy shims, exclusivity transitions). Full api E2E project also green (893 passed / 2 skipped).
  • Browser E2E: gateways list editor (add/save, exclusivity warning, picker providers, persistence, removal) and the model-picker hide filter (hide/show, current-model preservation, persistence across reload, server-request invariance).

Docs included: docs/multi-gateway-providers.md (reference) and docs/design/multi-gateway-providers.md (design), plus thinking-levels.md / internals.md / rest-api.md / debugging.md updates.

🤖 Generated with Bobbit

Generalize the single hardcoded AI Gateway integration into an ordered
list of named, typed OpenAI-compatible gateways. Each gateway has
{id, name, url, type, enabled}; two types are supported:

- aigw — Bedrock-routed Claude ids (singleton, name pinned to "aigw")
- openai-compatible — raw OpenAI-style endpoints for local models
  (llama.cpp/llama-swap, LM Studio, Ollama, vLLM, etc.)

Gateways persist under the new `modelGateways` preference. A boot-time,
idempotent migration upgrades the legacy single `aigw.url` (+exclusive)
pref into the list. Type-driven models.json writers and model discovery
dispatch on gateway type; exclusivity is derived (any enabled aigw-type
gateway implies exclusive mode).

Includes the REST surface, a settings list editor, and a display-only
'hide unconfigured / Has key' model-picker filter, plus design docs,
reference docs, and unit + API + browser E2E coverage.

Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-Authored-By: Bobbit (Claude Opus 4 8) <bobbit@bobbit.ai>
maciej-makowski referenced this pull request in maciej-makowski/bobbit Jun 12, 2026
Document the per-file hybrid port technique used to offer the
multi-gateway-providers feature to upstream (SuuBro/bobbit#762):
classify touched files, take drift-free feature-exclusive files
verbatim, 3-way merge only the feature's hunks into shared files,
and prove residual test failures are pre-existing/environmental.

Detailed recipe + env caveats in docs/dev-workflow.md; tight step
list pointer in AGENTS.md.

Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
@maciej-makowski
maciej-makowski marked this pull request as ready for review June 12, 2026 16:30
maciej-makowski added a commit to maciej-makowski/bobbit that referenced this pull request Jun 12, 2026
⚠️ **THIS PR SHOULD BE MERGE-COMMITTED TO PRESERVE LINEAGE**

---

## Summary of Upstream Changes

### 1. Pack PR walkthrough tools
([G-Research#763](https://github.com/SuuBro/bobbit/pull/763))
**Author:** Joshua Subramaniam | **31 files changed**, +1891/-600

Major refactor of the PR Walkthrough feature:
- Migrated `extension.ts` from `defaults/tools/pr-walkthrough/` into the
market-pack at `market-packs/pr-walkthrough/tools/pr-walkthrough/`
- Added shared gateway utilities (`tools/_shared/gateway.ts`) for
pack-level reuse
- Updated all related design docs, marketplace docs, and
extension-host-authoring guide
- Added new tests: `marketplace-activation-tool-catalogue.test.ts`,
`rpc-bridge-pack-path-remap.test.ts`
- Updated Docker args, RPC bridge path remapping, and server routes to
support pack-based tools

### 2. Update mock review prompt
**Author:** Josh S. | **1 file changed**

Updated the mock review prompt configuration in
`.bobbit/config/project.yaml`.

### 3. Polish built-in pack activation UI
([G-Research#762](https://github.com/SuuBro/bobbit/pull/762))
**Author:** Josh S. | **7 files changed**, +247/-58

UI improvements for the marketplace page:
- Enhanced built-in pack activation experience with polished styling
- Added new CSS classes and improved marketplace page layout
- Updated AGENTS.md and server routes to reflect UI changes
- Added e2e test coverage for pack activation flow

---

**Upstream PRs:**
- [G-Research#763](https://github.com/SuuBro/bobbit/pull/763) — Pack PR
walkthrough tools
- [G-Research#762](https://github.com/SuuBro/bobbit/pull/762) — Polish built-in
pack activation UI

🤖 Generated with [Bobbit](https://github.com/SuuBro/bobbit)
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