Run Brain synthesis on the helper model; make Memory a settings toggle - #1771
Merged
Conversation
Contributor
Synthesis no longer needs a Brain provider key: gbrain's gateway-mode chat defaults to the roomote/helper sentinel, which the inference gateway answers with the deployment's helper (small) model through the tracked non-task path — any configured provider works, usage lands under the brain_synthesis surface. An operator's R_BRAIN_MODEL still wins: the sentinel is rewritten to it and forwarded normally. Memory on/off becomes a database-backed deployment setting with an admin toggle on the Memory settings page. A null flag falls back to the legacy provider-key signal so existing Brains stay enabled untouched; collectors, outbox drain, MCP exposure, and agent tools all flow through the same gate they always did.
mrubens
force-pushed
the
feat/brain-helper-model
branch
from
August 28, 2026 06:32
bbf9514 to
645ea97
Compare
| // Not JSON we understand; the provider path forwards it untouched. | ||
| } | ||
|
|
||
| if (parsedBody?.model === BRAIN_HELPER_MODEL_ID) { |
Contributor
There was a problem hiding this comment.
The entrypoint configures gateway chat with a provider-qualified sentinel (${BRAIN_PROVIDER}:roomote/helper), but this only recognizes the bare roomote/helper. When gbrain sends its configured model, the request falls through to provider resolution and forwards the nonexistent helper model instead of calling the deployment helper. Normalize or accept the qualified sentinel here, and cover the gateway-configured value in this test suite.
Contributor
There was a problem hiding this comment.
Dismissed: gbrain parses the configured provider:model value and sends the bare model ID to its OpenAI-compatible client, so this gateway receives roomote/helper as expected.
The synthesis model is the deployment helper model now and the embedding pair is create-time infrastructure; neither is a per-page setting worth displaying, and the section's static model text was already wrong for gateway-mode brains.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two coupled changes that remove the Brain's provider-key requirement and make Memory self-serve.
Synthesis via the deployment helper model
gbrain's gateway-mode chat now defaults to a
roomote/helpersentinel model. The Brain inference gateway answers it before provider resolution: OpenAI-style messages are converted and run throughgenerateTrackedNonTaskTextwithmodelRole: 'small'(newbrain_synthesisusage surface), so synthesis works with whatever providers the deployment already has — including Anthropic-only and trial inference — with usage tracked like every other non-task call. Details:stream: true→ 400 (gbrain's gateway chat is non-streaming by design);response_formatjson_object/json_schema honored via a strict-JSON instruction (schema inlined).R_BRAIN_MODELstill wins: the sentinel body is rewritten to it and forwarded through the ordinary provider path.Memory becomes a settings toggle
New nullable
deployment_settings.brain_enabled(migration 0063).isBrainEnabled()is the Brain gate now: an explicit choice wins;nullfalls back to the legacy provider-key signal, so existing Brains stay enabled with zero backfill. All formerisBrainProviderConfigured()gate sites (brain connection resolution — which covers collectors/outbox/MCP proxy — MCP delivery, fast-agent saveMemory tool, saveTaskMemory, web commands) now flow through it; the provider-key check survives only where it genuinely means "which key serves this request" and in the run-completion outbox insert (deliberately env-only, no DB read in that transaction).Settings → Memory gains an admin-gated enable toggle (with a note when the enabled state comes from the legacy key); disabled state collapses the page to the toggle + explanation. The Settings nav shows Memory when either the wiring or the flag is present, so a wired-but-disabled Brain can be turned on.
Known limitations (called out on purpose)
/v1/responsesdoes not answer the sentinel (gbrain's gateway chat uses chat-completions).brain_synthesis.Testing
brain-inference 20/20, db model-runtime-config 56/56, sdk mcp-connections 36/36, cloud-agents fast-agent 79/79, web server 21/21 + client 23/23; typecheck clean across all touched packages; entrypoint
bash -nclean.