Skip to content

Add conditional S3 log offload and extend retention to 100 years in gateway - #1663

Open
gonzaloaune wants to merge 38 commits into
mainfrom
feature/cmtrm56ir0001i804lwrukrfc-conditional-s3-log-offload-retention-1788811143
Open

gonzaloaune wants to merge 38 commits into
mainfrom
feature/cmtrm56ir0001i804lwrukrfc-conditional-s3-log-offload-retention-1788811143

Conversation

@gonzaloaune

Copy link
Copy Markdown
Contributor

Generated with Hive: Add conditional S3 log offload and extend retention to 100 years in gateway

pitoi and others added 26 commits September 7, 2026 15:20
…dels (#1673)

Providers are now anthropic / openai / openrouter / xai. Gemini is
dropped from the seed config, compose env, plan docs, and the
mcp/docs/gateway seed copy; xai reads env.XAI_API_KEY.

Pricing: the accumulator looked up the bare wire model only, but
bifrost's datasheet keys xAI and OpenRouter rows as
"<provider>/<model>" ("xai/grok-4.3", "openrouter/moonshotai/…"), so
every Grok and OpenRouter call accumulated at $0 while logs.db priced
it. pricing.Keys now yields bare → provider-prefixed → prefix-stripped
candidates, shared by the catalog and the operator model_pricing
table; the posthook passes RoutingInfo.Provider (falling back to the
deprecated ExtraFields.Provider).

Also: xai entry in the canvas provider table + a stand-in glyph, an
xai call in smoke-test.sh, and Makefile BIFROST_VERSION / GO_VERSION
pins brought in line with the Dockerfile (transports/v1.6.2, 1.26.4) —
`make docker-build` was overriding the Dockerfile default with 1.5.2.

Verified live against the rebuilt image: grok-4.3 non-streaming and
streaming calls under a shadow-mode macaroon accumulate 0.00025625 and
0.000285 in Redis, matching the datasheet rate to the cent.
…caroons (#1674)

config.json is baked into the image and re-seeded on every boot, so
the only way to move a swarm from shadow to enforce mode was a new
image. The env var now overrides the plugin config block's
enforce_macaroons when set (1/true/yes/on, 0/false/no/off); unset
keeps the config.json value. The boot line names the winner:
`auth: macaroon adapter wired enforce=<bool> source=env|config|default`.

An unparseable value is deliberately not fatal. A plugin Init error
does not stop bifrost-http — the wrapper waits 5s and then serves
inference without the plugin, i.e. with no macaroon verification, no
dim canonicalization, and /_plugin/* down, which is worse than either
mode. So a typo logs at ERROR, the boot line reports
source=env-invalid, and the config.json value stands.

Verified live on the rebuilt image: enforce=true via env rejects a
missing macaroon (401 "x-macaroon header is required") and a garbage
one, and passes a valid one with mode=enforce; unset falls back to
source=config; "ture" keeps the plugin active with the ERROR line.
…1.37 (#1675)

Sibling of the web_search shim (#1637). Anthropic keeps its native,
server-executed web_fetch tool; every other provider gets a
client-executed tool of the same name and result shape backed by a
guarded HTTP GET plus a dependency-free HTML-to-text pass.

The HTTP path runs in our process, so every URL and every redirect hop
is validated before connecting: http(s) only, no embedded credentials,
localhost refused, and the host must resolve exclusively to public
unicast addresses (loopback, RFC 1918, link-local incl. cloud metadata,
CGNAT, ULA, NAT64/6to4 and v4-mapped v6 all refused; a mixed answer is
refused). allowedDomains/blockedDomains match the host and subdomains.
Bodies are capped at 4 MiB and text at maxCharacters (default 40k);
maxUses is enforced in-process on the shim and passed through as
max_uses to Anthropic. Failures come back to the model as a readable
tool error, with undici's transport cause surfaced.

getProviderTool gains "webFetch"; createWebFetch returns the same
handle shape as createWebSearch (tool / backend / native / results /
capture). 16 unit tests cover the guard, redirects, extraction,
budgets and native-result capture; try-fetch exercises both backends.
PR #1673 added the xai entry to PROVIDER_DISPLAY / the icon table in
canvasTheme.ts, but Canvas.tsx's hardcoded PROVIDERS list (which
drives both the provider cards and the gateway→provider edges) was
never updated, so the canvas drew no xAI card and any xai spend the
matrix endpoint returned was dropped from the column.

Add xai as the fifth provider, keeping gemini: the list is now
deliberately a superset of the seed config's providers map so a
provider absent from config.json still shows a $0 card instead of
having its historical spend vanish. Refresh the stale header
comment (it still said "google" and claimed per-provider spend was
pending a matrix-endpoint change that already landed).
PR #1673 swapped gemini for xai in the seed config, compose env, plan
docs, and the mcp/docs/gateway seed copy. The intent was to add xAI,
not to drop Gemini: put the gemini provider back in every one of
those spots, reading env.GOOGLE_API_KEY as before, so the gateway
targets anthropic / openai / openrouter / gemini / xai.

Provider order in both config.json files matches the admin UI's
canvas column (PR #1676), which already renders all five. No Go
changes: nothing server-side hardcodes the provider list, and the
x-goog-api-key transport tests never stopped covering Gemini.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants