π OpenHands: AI-Driven Development
F14 β Secrets
Secrets are named values the agent can use during conversations. A user lists, adds, edits and deletes them under Settings β Secrets; saved values are never shown again, and every new conversation receives them as environment variables.
Source: src/routes/secrets-settings.tsx, src/components/features/settings/secrets-settings/, src/api/secrets-service.ts, src/components/features/conversation/secret-request-card.tsx, src/services/secret-request.ts, src/stores/secret-request-store.ts, src/constants/secret-request.ts, src/api/request-secret-client-tool.ts.
Sub-features
F14.list: the Secrets page lists each secret's name and description with Edit and Delete actions; the launcher-seededOPENHANDS_AUTOMATION_API_KEYis always present.F14.create: adding a secret persists it; it is listed after a reload.F14.create-validation: duplicate names, names that break^[a-zA-Z][a-zA-Z0-9_]{0,63}$and empty values are refused with a message.F14.edit: editing the description with the value left blank keeps the stored value; Save stays disabled until something changes.F14.delete: deleting asks for confirmation; Cancel keeps the row, Confirm removes it for good.F14.agent-access: a conversation started after the secret was saved sees it as an environment variable.F14.phone: the page and its forms fit a 390 px viewport without horizontal overflow.F14.form-back: the Add and Edit forms replace the list with an Add a Secret / Edit a Secret title and a Back button; Back (like Cancel) returns to the list and discards the draft.F14.rename: the Edit form's name is editable; renaming with the value left blank keeps the stored value under the new name, and renaming onto an existing name is refused withSecret already exists.F14.edit-value: typing a value in the Edit form (labelled "Secret Value (leave blank to preserve the existing value)") replaces the stored value for new conversations.F14.delete-escape: Escape closes the delete confirmation without deleting.F14.agent-request: in a local conversation the agent'srequest_secrettool adds a The agent needs a secret card in the chat, right after the tool call, with its reason and the name prefilled; it does not block the conversation, so the agent can keep working and the user answers when ready. Add secret saves it, attaches it to the running conversation and reportssavedto the agent, Cancel reportsnot_saved, and a name that is already saved is attached without a card. The value never reaches the agent's events.
How to get to it (user POV)
- Sidebar settings gear (
backend-selector-settings-link), then Secrets in the settings navigation (sidebar-settings-/settings/secrets). - Direct URL
/settings/secrets. - Command menu (
Control+korMeta+k, orcommand-menu-triggerin the sidebar): search "Secrets", choose Secrets settings. - The agent itself, in a conversation: its
request_secretclient tool adds the request card (testid=secret-request-card) to the chat on/conversations/<id>(F14.agent-request).
Driving it with control-openhands
Preconditions:
Baseline state (launched, doctored,
onboard --skipdone).No secret named
QA_TMP_SECRET,QA_AGENT_SECRET,QA_RENAMED_SECRETorQA_BACK_SECRETexists (control-openhands api GET /api/settings/secrets).F14.agent-access,F14.rename,F14.edit-valueandF14.agent-requestneed an active LLM profile (control-openhands llm preset deepseek).No secret named
QA_REQ_SECRETorQA_REQ_CANCELexists, forF14.agent-request.Open the list (
F14.list). Navigate from the sidebar. Runcontrol-openhands browser click 'testid=backend-selector-settings-link',control-openhands browser click 'testid=sidebar-settings-/settings/secrets', thencontrol-openhands browser count 'testid=secret-item >> has-text=OPENHANDS_AUTOMATION_API_KEY'. The count is1and the URL is/settings/secrets.Command-menu entry (
F14.list). Runcontrol-openhands browser goto /(the previous bullet left/settings/secrets, which would make the URL check pass vacuously), thencontrol-openhands browser press Control+k,control-openhands browser type 'testid=command-menu >> role=combobox' Secrets,control-openhands browser press Enter, thencontrol-openhands browser url. The URL ends in/settings/secrets.Create (
F14.create). Runcontrol-openhands browser click 'testid=add-secret-button',control-openhands browser fill 'testid=add-secret-form >> testid=name-input' QA_TMP_SECRET,control-openhands browser fill 'testid=add-secret-form >> testid=value-input' dummy-value-123,control-openhands browser fill 'testid=add-secret-form >> testid=description-input' 'QA dummy',control-openhands browser click 'testid=add-secret-form >> testid=submit-button', thencontrol-openhands browser reloadandcontrol-openhands browser count 'testid=secret-item >> has-text=QA_TMP_SECRET'. The count is1after the reload.Duplicate name (
F14.create-validation). Runcontrol-openhands browser click 'testid=add-secret-button', fillname-inputwithQA_TMP_SECRETandvalue-inputwithotheras above, clicktestid=add-secret-form >> testid=submit-button, thencontrol-openhands browser snapshot 'testid=add-secret-form'. The snapshot shows the paragraphSecret already existsand the form stays open. The paragraph uses the theme's danger colour (#18199):control-openhands browser eval "getComputedStyle([...document.querySelectorAll('[data-testid=add-secret-form] p')].find(e=>e.innerText==='Secret already exists')).color"isrgb(231, 106, 94)on OpenHands-Neutral andrgb(209, 52, 56)on Light+ (F16.color-theme).Invalid name (
F14.create-validation). In the same form runcontrol-openhands browser fill 'testid=add-secret-form >> testid=name-input' 'bad name!', click submit, thencontrol-openhands browser eval "document.querySelector('[data-testid=add-secret-form] [data-testid=name-input]').validationMessage". The value is the browser's pattern message (Please match the requested format.in Chromium) and no secret is created (api GET /api/settings/secrets). Close withcontrol-openhands browser click 'testid=add-secret-form >> testid=cancel-button'.Empty value (
F14.create-validation). Runcontrol-openhands browser click 'testid=add-secret-button', filltestid=add-secret-form >> testid=name-inputwithQA_EMPTY_VALUEand leavevalue-inputempty.control-openhands browser enabled 'testid=add-secret-form >> testid=submit-button'isfalse, andcontrol-openhands browser eval "document.querySelector('[data-testid=add-secret-form] [data-testid=value-input]').validationMessage"isPlease fill out this field.Close withtestid=add-secret-form >> testid=cancel-button;api GET /api/settings/secretslists noQA_EMPTY_VALUE.Edit keeps the value (
F14.edit). Runcontrol-openhands browser click 'testid=secret-item >> has-text=QA_TMP_SECRET >> testid=edit-secret-button',control-openhands browser value 'testid=edit-secret-form >> testid=value-input'(empty) andcontrol-openhands browser enabled 'testid=edit-secret-form >> testid=submit-button'(false). Filltestid=edit-secret-form >> testid=description-inputwithQA dummy edited;enabledturnstrue. Clicktestid=edit-secret-form >> testid=submit-button,control-openhands browser reload, thencontrol-openhands browser text 'testid=secret-item >> has-text=QA_TMP_SECRET'. The row text isQA_TMP_SECRETandQA dummy editedseparated by a tab ("QA_TMP_SECRET\tQA dummy edited"in the JSON output).Delete with confirmation (
F14.delete). Runcontrol-openhands browser click 'testid=secret-item >> has-text=QA_TMP_SECRET >> testid=delete-secret-button'; the dialogtestid=confirmation-modalreadsAre you sure you want to delete this key?. Runcontrol-openhands browser click 'testid=confirmation-modal >> testid=cancel-button'; the row count stays1. Repeat the delete click, thencontrol-openhands browser click 'testid=confirmation-modal >> testid=confirm-button',control-openhands browser reloadandcontrol-openhands browser count 'testid=secret-item >> has-text=QA_TMP_SECRET'. The count is0.Agent receives the secret (
F14.agent-access). CreateQA_AGENT_SECRETwith valueqa-dummy-4821through the form as in Create. Runcontrol-openhands conversation start --prompt "Run exactly this command and reply with only its output: python3 -c \"import os; print(os.environ.get('QA_AGENT_SECRET') == 'qa-dummy-4821')\"" --wait --timeout 240, thencontrol-openhands conversation events <id> --kinds ObservationEvent. The terminal observation's text isTrue. Assert the observation, not the agent's reply: deepseek-flash often declines to echo anything about a secret (see Gotchas). KeepQA_AGENT_SECRETfor Rename and Replace value below; they delete it.Phone layout (
F14.phone). Runcontrol-openhands browser goto /settings/secrets(conversation startleft the browser on the conversation),control-openhands browser viewport phone,control-openhands browser bbox 'testid=secrets-settings-screen'andcontrol-openhands browser screenshot --feature F14.phone --name list.insideViewportistrueandpageHorizontalOverflowisfalse; the screenshot shows the table with Edit and Delete icons. Thencontrol-openhands browser click 'testid=add-secret-button',control-openhands browser bbox 'testid=add-secret-form'(insideViewporttrue, no page overflow) andcontrol-openhands browser screenshot --feature F14.phone --name add-form; cancel the form. Return withcontrol-openhands browser viewport desktop.Back discards the draft (
F14.form-back). On/settings/secretsruncontrol-openhands browser click 'testid=add-secret-button'andcontrol-openhands browser text 'testid=secret-editor-title'(Add a Secret). Filltestid=add-secret-form >> testid=name-inputwithQA_BACK_SECRETandvalue-inputwithdummy, thencontrol-openhands browser click 'testid=back-to-secrets'.control-openhands browser count 'testid=add-secret-form'is0, the list is back (browser count 'testid=secret-item'>0) andcontrol-openhands api GET /api/settings/secretslists noQA_BACK_SECRET. Reopening Add shows an emptyname-input(browser value); leave withtestid=back-to-secrets. The Edit form showsEdit a Secretin the samesecret-editor-title.Rename keeps the value (
F14.rename). NeedsQA_AGENT_SECRETfrom Agent receives the secret. Runcontrol-openhands browser goto /settings/secrets,control-openhands browser click 'testid=secret-item >> has-text=QA_AGENT_SECRET >> testid=edit-secret-button', filltestid=edit-secret-form >> testid=name-inputwithOPENHANDS_AUTOMATION_API_KEYand clicktestid=edit-secret-form >> testid=submit-button:control-openhands browser snapshot 'testid=edit-secret-form'shows the paragraphSecret already existsand the form stays open. Fillname-inputwithQA_RENAMED_SECRET(value left blank), click submit,control-openhands browser reload;browser count 'testid=secret-item >> has-text=QA_RENAMED_SECRET'is1, theQA_AGENT_SECRETcount is0, andapi GET /api/settings/secretslists only the new name. Then runcontrol-openhands conversation start --prompt "Run exactly this command and reply with only its output: python3 -c \"import os; print(os.environ.get('QA_RENAMED_SECRET') == 'qa-dummy-4821', 'QA_AGENT_SECRET' in os.environ)\"" --wait --timeout 240andcontrol-openhands conversation events <id> --kinds ObservationEvent: the observation isTrue False.Replace the value (
F14.edit-value). Runcontrol-openhands browser goto /settings/secrets,control-openhands browser click 'testid=secret-item >> has-text=QA_RENAMED_SECRET >> testid=edit-secret-button'andcontrol-openhands browser snapshot 'testid=edit-secret-form'(the value textbox is namedSecret Value (leave blank to preserve the existing value)). Filltestid=edit-secret-form >> testid=value-inputwithqa-dummy-7350;browser enabled 'testid=edit-secret-form >> testid=submit-button'istrue. Click submit;browser count 'testid=edit-secret-form'is0. Start a conversation with the promptRun exactly this command and reply with only its output: python3 -c "import os; print(os.environ.get('QA_RENAMED_SECRET') == 'qa-dummy-7350')"(quoted as above) and read itsObservationEvent:True.Agent requests a secret (
F14.agent-request). Runcontrol-openhands browser goto /, thencontrol-openhands conversation start --prompt "Call the request_secret tool with name QA_REQ_SECRET and reason 'QA check: a dummy token for verification.' Do not run any other tools. After calling it, end your turn and wait." --wait --timeout 240(prints<req-id>; it leaves the browser on the conversation).control-openhands conversation events <req-id> --kinds ActionEvent,ObservationEventshows therequest_secretaction and the observationTool call dispatched to client.;control-openhands browser snapshot 'testid=secret-request-card'readsregion "The agent needs a secret", the reasonQA check: a dummy token for verification., textboxNameholdingQA_REQ_SECRET,Value,Description Optional,CancelandAdd secret [disabled](browser screenshot --feature F14.agent-request --name card). The chat input stays usable while the card is pending, andcontrol-openhands browser reloadkeeps the card with the name still prefilled. Runcontrol-openhands browser fill 'testid=secret-request-card >> testid=value-input' qa-dummy-5190andcontrol-openhands browser click 'testid=secret-request-card >> testid=submit-button': the card disappears,control-openhands api GET /api/settings/secretslistsQA_REQ_SECRET, and aftercontrol-openhands conversation wait <req-id> --fresh --timeout 180control-openhands conversation events <req-id> --kinds MessageEventholds the user message[secret-request] {"status":"saved","name":"QA_REQ_SECRET"}, which the chat does not show (browser count 'text=[secret-request]'is0). The running conversation now has the value:control-openhands conversation send <req-id> --prompt "Run exactly this command and reply with only its output: python3 -c \"import os; print(os.environ.get('QA_REQ_SECRET') == 'qa-dummy-5190')\"" --wait --timeout 240, then the last terminalObservationEventisTrue. Cancel:browser goto /, start a second conversation with the same prompt namingQA_REQ_CANCELand reasonQA cancel check., fillvalue-inputwithshould-not-saveandcontrol-openhands browser click 'testid=secret-request-card >> testid=cancel-button': the card disappears,api GET /api/settings/secretslists noQA_REQ_CANCEL, the agent receives[secret-request] {"status":"not_saved","name":"QA_REQ_CANCEL","guidance":...}, and a reload does not bring the card back. Already saved: a third conversation asking forQA_REQ_SECRETagain shows no card (browser count 'testid=secret-request-card'0) and its events hold[secret-request] {"status":"saved","name":"QA_REQ_SECRET"}. At phone width the card fits the chat column (insideViewporttrue,x16 andwidth358 at 390 px, no page overflow) with the title, every field and both buttons; the block below checks it. Return withbrowser viewport desktop.QA_REQ_SECRETis deleted in the cleanup below.control-openhands browser viewport desktop control-openhands browser goto / control-openhands conversation start --prompt "Call the request_secret tool with name QA_REQ_PHONE and reason 'QA phone check.' Do not run any other tools. After calling it, end your turn and wait." --wait --timeout 240 control-openhands browser wait 'testid=secret-request-card' control-openhands browser viewport phone control-openhands browser screenshot --feature F14.agent-request --name phone-width control-openhands assert --field insideViewport --equals true -- browser bbox 'testid=secret-request-card' control-openhands browser click 'testid=secret-request-card >> role=button[name="Cancel"]' control-openhands browser wait 'testid=secret-request-card' --state detachedEscape cancels delete (
F14.delete-escape). Runcontrol-openhands browser goto /settings/secrets,control-openhands browser click 'testid=secret-item >> has-text=QA_RENAMED_SECRET >> testid=delete-secret-button',control-openhands browser press Escape, thencontrol-openhands browser count 'testid=confirmation-modal'(0) andbrowser count 'testid=secret-item >> has-text=QA_RENAMED_SECRET'(1). Clean up: deleteQA_RENAMED_SECRETand thenQA_REQ_SECRET(fromF14.agent-request), each withdelete-secret-buttonβtestid=confirmation-modal >> testid=confirm-button,browser reload;api GET /api/settings/secretslists onlyOPENHANDS_AUTOMATION_API_KEY.Cipher mismatch refuses mutation (
F14.create,F14.edit,F14.delete). This is an external-state fixture, not a credential test. Arrange two own dummy secrets and a dummy loopback LLM key; privately back up the run-ownedencryption-key,settings.jsonandsecrets.json. Replace only the own cipher file with a newly generated value (never display it), restart and doctor. After bootstrap, restore the old encrypted store bytes under the replacement cipher to isolate the UI write. Add a new dummy secret through the real Secrets form, and inspect only boolean preservation metadata / availability of the old dummy value privately. Independently restore the encrypted settings baseline and change Sound Notifications through Application β Save. Expected: reject writes when existing encrypted state cannot decrypt, preserving it. Known failure, reproduced 2026-10-12 (OpenHands/software-agent-sdk#5622): the secret create succeeds and rewrites an old entry while its dummy value is unavailable (getter 404, name still listed); two unrelated settings saves persist the old LLM key as null. Repeat with a fresh replacement cipher. Immediately restore the original cipher and both stores infinally, restart and doctor; original state must be readable again. This drives secret creation and settings Save, not every edit/delete permutation. Keep all cipher bytes, values and raw store snapshots private.
Gotchas
Settings nav test ids embed the route, slashes included:
sidebar-settings-/settings/secrets. Quote the selector as written.The value editor is a plain
textarea, not a password field: use dummy values only, and never ask the agent to print a real secret.Edit forms intentionally show an empty value; that is not data loss.
The invalid-name check is native browser validation. It shows a tooltip that screenshots do not capture, and it leaves any earlier
Secret already existsparagraph on screen. Assert withvalidationMessageand the API, not the paragraph.The model is the weak link in the agent checks, not the product: asked to print a secret's length or last characters, deepseek-flash replies "I can't run that one" and runs nothing, and even for the equality check it may refuse to repeat
Truein its reply. Use the equality prompt and read the terminalObservationEvent;conversation eventstruncates message text to about 160 characters.The conversation Overview has no Secrets entry point: its "..." menu (
conversation-overview-ellipsis) offers Workspace and Git sections only.There is no empty state to reach safely:
secrets-emptyrenders only with zero secrets, which means deleting the launcher-seeded key (see below).Secrets saved in Settings reach only conversations started after the save. Reuse an older conversation and the variable is missing. Only
request_secret(F14.agent-request) attaches a secret to a running conversation, and only on a local backend.request_secretis registered on every new OpenHands-agent conversation this frontend launches (not on ACP agents or older conversations) and appears in Show Agent Tools & Metadata (seeF07.agent-tools-modal). The agent learns the outcome from a hidden[secret-request] ...user message; read it withconversation events <id> --kinds MessageEvent, not from the chat.At 390 px the name column truncates long names (
OPENβ¦); usebrowser texton the row rather than the screenshot to read a name.OPENHANDS_AUTOMATION_API_KEYis seeded by the launcher for automations; deleting it breaks F18/F19 runs in the same stack.Known issue #17710: On the Cloud backend, deleting a secret reportedly adds a suffixed duplicate and leaves the original. Reproduction needs a disposable writable OpenHands Cloud account at the affected service; Local secret CRUD exercises a different transport. (
F14.delete,F14.edit).