Repository navigation
Save a model key added in the Vault where the Bots read it - #1524
Merged
Merged
Conversation
The Personal Assistant and the other built-in Bots read one vault entry for their model key: the provider they run on, under the tenant package's key name (openai-api-key). The Vault's Add key form asked for a free-text provider and key ID with "OpenAI" and "production" as placeholders, so a person who followed them saved a key nothing read, and Setup still said OpenBot couldn't answer. - Add key asks a model key only which provider it is for, starting on the one the Bots run on, and says whether they will use it. It sends no name. - The server files a model key that arrives without a name under the name the Bots read, and tells the form which provider and name that is. - Setup's "add the key in Vault" link opens the Add key form directly. - A key sent with a name (the exact one, or a connector's) is saved as before.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 12, 2026 21:20
6 tasks done
davidmckayv
added a commit
that referenced
this pull request
Nov 12, 2026
These carry the server half of #1524 and #1531. The desktop's two cross-writer lock tests take the server's own lock as their other writer, which now runs in the server image, so they are ignored here and say why. The release rerun tests package a chart with helm and archive a tree more than once, which takes longer than five seconds on a shared runner.
davidmckayv
added a commit
that referenced
this pull request
Nov 13, 2026
These carry the server half of #1524 and #1531. The desktop's two cross-writer lock tests take the server's own lock as their other writer, which now runs in the server image, so they are ignored here and say why. The release rerun tests package a chart with helm and archive a tree more than once, which takes longer than five seconds on a shared runner.
davidmckayv
added a commit
that referenced
this pull request
Nov 13, 2026
These carry the server half of #1524 and #1531. The desktop's two cross-writer lock tests take the server's own lock as their other writer, which now runs in the server image, so they are ignored here and say why. The release rerun tests package a chart with helm and archive a tree more than once, which takes longer than five seconds on a shared runner.
davidmckayv
added a commit
that referenced
this pull request
Nov 13, 2026
These carry the server half of #1524 and #1531. The desktop's two cross-writer lock tests take the server's own lock as their other writer, which now runs in the server image, so they are ignored here and say why. The release rerun tests package a chart with helm and archive a tree more than once, which takes longer than five seconds on a shared runner.
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.
What a person saw
Settings > Setup says the AI model needs a key: "Set
OPENAI_API_KEY, then restart OpenBot. Or add the key in Vault." In the Vault's Add key form, someone who follows the placeholders types Provider "OpenAI" and Key ID "production" and saves. The key is stored, the Vault lists it as active, and Setup still says "Needs setup": OpenBot can't answer.Why
The Personal Assistant, and every built-in Bot, reads one vault entry for its model key: a
modelcredential for the provider it runs on (openai), under the tenant package'smodel.credential_secret_ref(openai-api-key).resolveModelApiKeyand the Setup checklist both match that exactly. The form asked for both as free text and said nothing about either, so the only way to get it right was to already know the internal name. The end-to-end core loop (#1521) worked around it by typing the exact name.The fix
Take the names off the form for a model key, so there is nothing to get wrong:
GET /api/admin/credentialsalso returnsmodelKey(the provider the Bots run on and that name), which the form uses for its starting provider and for the existing "saving replaces it" notice./settings/vault/new, or/admin/credentials/newin a team), instead of the Vault list.Why this one instead of the alternatives:
Nothing is renamed or migrated. A key already saved under the exact name keeps working, and a client that still sends a key ID (the exact name, or a connector's) is saved as before.
Tests (red, then green)
server/tests/credentials.test.ts, "a model key added in the Vault" (real Postgres, real route): posts what the form now sends (provider and secret, no name) and resolves the Personal Assistant's key the way every built-in Bot's run does, with the name read fromexamples/personal. Red on main: the post is refused (400) and the list has nomodelKey. Green after. A third case pins that a client sending the exact name still works.app/tests/new-credential-page.test.tsx: the form starts on the Bots' provider (OpenAI, and Anthropic when that's what they run on), offers no Key ID, and posts{ kind, provider, plaintext, metadata }with no name. Red with main's form: there is no Provider choice.e2e/journeys/core-loop.journey.ts: the core loop now adds the key the way a person does. Setup's link opens Add key, Provider already reads OpenAI, the person pastes the key and types nothing else, Setup moves off "Needs setup", and the Personal Assistant answers. Red on main (the link opens the Vault list, not the form); green on this branch, with 0 strict-replay misses. The aimock fixtures are unchanged.server/tests/setup-checklist.test.tsandapp/tests/setup-checklist-editions.test.tsx.Checked by looking
Screenshots before (main) and after (this branch): Setup, the Add key form, the Vault list, Setup after saving, the answer, the other-provider line, the replace notice, a connector key, and the form at phone width. On main, following the placeholders leaves Setup at "Needs setup". On this branch the form is Type, Provider, Secret, and Setup reads "The key is set". Spacing, alignment and wrapping match the rest of Settings.