Originally created by: kumaakh
provision_auth with api_key parameter fails to make the key visible to subsequent execute_prompt / execute_command calls on all three platforms (macOS, Windows, Linux). The env var is written to shell profiles that are never sourced in non-interactive SSH sessions.
Found during multi-provider testing with Gemini CLI on macOS (192.168.1.13), Windows (192.168.1.25), and Linux (192.168.1.102).
setEnv() in the OS command layer writes to the wrong shell profiles per platform:
src/os/macos.ts:20-29)Writes to .bashrc, .zshrc, .profile — but not .zshenv.
macOS defaults to zsh. SSH non-interactive sessions (ssh user@host 'command') only source ~/.zshenv, not ~/.zshrc or ~/.profile. So any env var set via provision_auth is invisible to fleet commands.
src/os/windows.ts)Writes bash-style export VAR=val >> ~/.bashrc commands — but Windows OpenSSH server runs PowerShell, not bash. These profiles are never read. The correct approach is [System.Environment]::SetEnvironmentVariable("NAME", "VALUE", "User") and/or writing to the PowerShell $PROFILE.
src/os/linux.ts)Writes to .bashrc and .profile — but non-interactive SSH sessions on many Linux systems (e.g. Ubuntu) do not source any user dotfiles. Confirmed: env vars set in .bashrc and .profile are not visible via env | grep GEMINI in SSH command execution. /etc/environment is the only file read, but requires root. ~/.ssh/rc runs in a subshell so exports don't propagate.
The problem is not just setEnv() — it's that buildAgentPromptCommand() and execute_command don't inject provisioned env vars into the command. Even if setEnv() writes to every possible dotfile, non-interactive SSH sessions may not source any of them depending on OS and SSH server configuration.
Recommended fix: Rather than relying on shell profiles, fleet should store provisioned env vars in its own member config and inject them (e.g. export GEMINI_API_KEY="..." &&) into every command built by buildAgentPromptCommand(), similar to how CLAUDE_PATH already injects export PATH="$HOME/.local/bin:$PATH" &&.
This would make auth work reliably regardless of which dotfiles the SSH session sources.
provision_auth with api_key — reports successexecute_prompt with any prompt — fails with:Please set an Auth method in your ~/.gemini/settings.json or specify one of the following environment variables before running: GEMINI_API_KEY
| Platform | Workaround |
|---|---|
| macOS | echo 'export GEMINI_API_KEY="..."' >> ~/.zshenv |
| Windows | [System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "...", "User") |
| Linux | Inline export GEMINI_API_KEY="..." && before gemini command |
SyntaxError: Invalid regular expression flags. Fleet's update_agent_cli or install docs should note this.apiKey, auth.apiKey, GEMINI_API_KEY as JSON keys — all rejected.CLAUDE_PATH is Claude-specific (src/os/linux.ts:6): Only adds ~/.local/bin to PATH. Works for Gemini if the user installs gemini there, but the constant name and intent are provider-specific. Consider renaming to CLI_PATH and including common npm global paths.
Originally posted by: kumaakh
Bug: OOB API key terminal doesn't support paste
Found during integration testing. The OOB terminal window that opens for API key entry does not support clipboard paste (Ctrl+V / right-click paste). API keys are long random strings that cannot be typed manually — paste is essential.
The SSH password OOB may have the same limitation but it's less noticeable since passwords can be typed from memory.
Fix needed: The terminal input mode must allow paste. Check if the input is using raw/secure mode that blocks paste, and switch to a mode that allows it while still hiding the input (like
read -swith paste support).Originally posted by: kumaakh
Fixed: src/utils/auth-env.ts implements buildAuthEnvPrefix() which decrypts provisioned env vars and injects them inline before every command (export VAR=val && on Linux/macOS; $env:VAR='val'; on Windows). Used in execute-prompt.ts:122 and execute-command.ts:133. No longer relies on shell profiles that non-interactive SSH sessions don't source.
Ticket changed by: kumaakh