Repository navigation
feat(settings): keep secrets once and assign them in a Secrets tab - #479
Merged
Merged
Conversation
A secret has a label, the variable it becomes and a masked value kept in auth.yaml under secret/<label>. Several secrets may share a variable as long as no computer gets two of them, so each agent's computer can mail as its own inbox through AGENTMAIL_API_KEY. Assigned to this computer, a secret reaches every infer process the app starts. Assigned to a Kubernetes workspace, it is written into the Secret infer-secret-<label> in the workspace's namespace through kubectl on stdin and listed under the workspace's secrets in daemon.yaml. A secret assigned nowhere reaches no process. The agent editor mints a key scoped to the agent's inbox with the owner key and keeps it as a secret, so the owner key never reaches a worker. Saving the API Keys no longer rewrites auth.yaml with the provider keys alone, which dropped every agent's AgentMail owner key.
edenreich
marked this pull request as ready for review
November 8, 2026 17:58
This was referenced Nov 8, 2026
Closed
Contributor
|
🎉 This PR is included in version 0.60.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Resolves #475
Summary
Settings gets a Secrets tab. A secret is kept once and given to the computers that need it: this computer, and any Kubernetes workspace. The agent editor can save an inbox-scoped AgentMail key as a secret, so an agent's computer mails as its own inbox and the owner key never reaches a worker.
A secret has a unique label, the variable it becomes, and a masked value. This differs from #475 as filed, where the name was the variable. Several secrets may share a variable as long as no computer gets two of them. With 12 agents on 12 computers, each computer gets its own
AGENTMAIL_API_KEYand onemcp.yamlheader${AGENTMAIL_API_KEY}works on all of them.Changes
backend/src/secrets.rs(new):~/.infer/auth.yaml(0600) undersecret/<label>. That is no environment variable name, so neither the CLI norauth_envever reads one as a provider key.~/.infer/secrets.yamlkeeps the label, the variable and whether this computer gets it. It holds no values.secretslist indaemon.yaml, which names the Kubernetes Secretinfer-secret-<label>. The tab reads assignments from there, so they move with a workspace rename.kubectl apply --server-sidewith the manifest on stdin. Only then is it listed indaemon.yaml, because the CLI refuses an Orchestrator whose listed Secret is missing.mcp.yamlservers whose headers expand its variable as${NAME}or$NAME.auth.yaml,secrets.yamlanddaemon.yaml.backend/src/env.rs:infer_envadds the secrets assigned to this computer, so everyinferprocess the app starts gets them, the local daemon's workers too. The gateway keeps getting the API keys alone.backend/src/config.rs:auth_envleaves secrets out, so a secret assigned nowhere reaches no process.auth.yamlwith the provider keys alone and dropped every agent's AgentMail owner key. It now saves the keys it shows and keeps every other entry.backend/src/agent_mail.rs:save_inbox_secretmints a key scoped to the agent's inbox with the owner key and saves it as the secret<agent>-inboxforAGENTMAIL_API_KEY. A new one is assigned to the agent's Kubernetes workspace when it has one. An existing one keeps its assignments and gets the new key. The checks run before minting, so a refused save never mints a key.backend/src/workspace_settings.rs:WorkspaceConfigreadssecretswithout the Workspaces tab ever writing it,list_secretedits the lists, andkubectl_with_inputpipes a manifest on stdin.backend/src/local_cluster.rs: the local cluster's kubectl runs asdocker exec -i, so it can read a manifest on stdin.frontend/components/SecretsTab.tsx(new): the list, the form and the restart notice. A change to a secret that goes anywhere asks for a CLI restart and says that running sessions keep the old values until they get a new machine.frontend/components/AgentEditor.tsx: Save inbox key as secret in the Email section, for an agent saved with its address.AGENTS.md: the DOM contract gains the secret form ids,New secret,Save secret,Save inbox key as secret,Edit secret <label>andDelete secret <label>.e2e/tests/secrets-settings.yaml: a secret saved under Secrets lands insecrets.yamlby variable and inauth.yamlby value.Acceptance criteria of #475
auth.yamlwith mode 0600, never in an export: done. A value is never sent back to the frontend. On edit a blank value keeps the saved one. The export never readsauth.yamlorsecrets.yaml.Verification
cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo testpass inbackend/. That is 255 tests, through the pre-commit hook. New tests cover the label and variable rules, every refusal, MCP header matching, which workspaces get listed when a cluster is down, namespace cleanup and the manifest. They also cover that only secrets assigned to this computer reach its processes, and that saving the API Keys keeps agent keys and secrets.bun run buildpasses andbun testpasses 224 tests.cargo test -p desktop-e2evalidates the e2e YAML.infer-k3scluster, in a throwaway namespace since deleted, I checked that re-applying the Secret without a key drops that key, that it gets no last-applied annotation, and that a second delete with--ignore-not-foundsucceeds.keypressclicks the first text area, so it cannot tick the checkboxes.Known gaps
infer-secret-*in the namespace when no other workspace lists it.Cross-repo impact
docs:desktop.mdneeds a Secrets section and the inbox key in the agent editor. Docs follow-up: [DOCS] Desktop Secrets tab: secrets kept once and assigned to computers docs#1133.cli: none. Workspacesecretsshipped in feat(workspaces): give a kubernetes workspace its own Secrets cli#1758.