Skip to content

fix(zsh): stop overriding the agentsfleet CLI's API URL - #47

Merged
indykish merged 1 commit into
masterfrom
fix/agentsfleet-cli-api-url
Nov 24, 2026
Merged

indykish merged 1 commit into
masterfrom
fix/agentsfleet-cli-api-url

Conversation

@indykish

Copy link
Copy Markdown
Owner

What

.zshrc exported three AGENTSFLEET_* variables. One of them silently
retargeted the agentsfleet command-line interface away from the deployment
its own credential names.

The CLI resolves its API URL as explicitApi || creds.api_url || DEFAULT_API_URL (cli/src/cli.ts:167), and DEFAULT_API_URL names
production (cli/src/util/url.ts:5). AGENTSFLEET_API_URL is read as the
explicitApi slot (cli/src/program/entry/argv-scan.ts:85), so a global
export beats the stored credential. Every command then ran against whatever
the variable named — here http://localhost:3000, a port nothing listened on.

Change

-export AGENTSFLEET_STATE_DIR=/tmp/agentsfleet-local-test
-export AGENTSFLEET_API_URL=http://localhost:3000
-export AGENTSFLEET_TELEMETRY_DISABLED=1
+unset AGENTSFLEET_API_URL AGENTSFLEET_STATE_DIR AGENTSFLEET_TELEMETRY_DISABLED

The state directory returns to its default, ~/.config/agentsfleet, so the
credential survives a reboot instead of living in /tmp. The unset clears
overrides a parent environment may still export.

Telemetry consent moves from the environment to the config directory
(~/.config/agentsfleet/telemetry.json, consent: "denied"), which is the
persisted path the CLI already reads
(cli/src/services/telemetry/consent.ts:79). Without that, dropping the
variable would have switched telemetry back on.

Verified

$ agentsfleet doctor
All checks passed.
$ agentsfleet whoami
  email · [email protected]   api_url · https://api-dev.agentsfleet.net

Note

This branch carries 97abfbb (mise: bun 1.4.5, rust 1.100.0, cargo-shear
1.14.0), which was committed locally on master and not yet on GitHub.

The command-line interface resolves its API URL as
`explicitApi || creds.api_url || DEFAULT_API_URL` (cli/src/cli.ts:167), and
DEFAULT_API_URL names production. A global AGENTSFLEET_API_URL therefore
retargets every command away from the deployment stored in
~/.config/agentsfleet/credentials.json.

Drop the three AGENTSFLEET_* exports and clear them for inherited
environments, so the stored credential is the only source of truth.
Telemetry consent is persisted in the config directory instead, so the
opt-out survives without the environment variable.
@indykish
indykish merged commit fdefdbe into master Nov 24, 2026
1 check passed
@indykish
indykish deleted the fix/agentsfleet-cli-api-url branch November 24, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant