feat: configurable custom env vars in settings panel - #119
Merged
Conversation
Add a "Custom Environment Variables" section to the dashboard settings panel. Users can define arbitrary key-value pairs that get injected into every spawned session's environment via buildEnv(). - Add customEnvVars field to AppSettings schema (Record<string, string>) - Spread custom vars into buildEnv() with a reserved-keys blocklist (PATH, CLAUDECODE, AUTONOMOS_SESSION_ID, etc. cannot be overridden) - Server-side validation: POSIX env var name format, string values only - Settings panel UI: key-value rows with add/remove, integrated into existing save flow with memoized React state for stable rendering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
NO_FLICKER=1,OPENAI_API_KEY=sk-...) that get injected into every newly spawned session~/.autonomos/settings.json) and save flowChanges
Server
settings.ts: AddedcustomEnvVars: Record<string, string>toAppSettingsinterfacesessions.ts:buildEnv()spreads custom vars into session environment, with aRESERVED_ENV_KEYSblocklist (PATH,CLAUDECODE,PORT,HOME,AUTONOMOS_SERVER,AUTONOMOS_SESSION_ID) to prevent overriding internal varsroutes/settings.ts: API validation — accepts only valid POSIX env var names (/^[A-Za-z_][A-Za-z0-9_]*$/), string values onlyDashboard
SettingsStatusBarItem.tsx: NewEnvVarSectionandEnvVarRowcomponents — key-value pair list with add/remove buttons, integrated into existing batch-save flow. UsesuseMemofor stable React keys across re-renders.Design decisions
buildEnv()so they can overrideANTHROPIC_BASE_URLetc., but reserved internal keys are blocklisted=, etc.)anthropicAuthToken, these values need to be visible for editing. Tradeoff documented.Test plan
NO_FLICKER=1) in settings, saveecho $NO_FLICKER)MY VAR,123KEY)🤖 Generated with Claude Code