Skip to content

The agent that grows with you

docs: explain manual demotion, dead Codex pools and launchd credential reload

teknium16992af19072b
diff --git a/website/docs/user-guide/features/credential-pools.md b/website/docs/user-guide/features/credential-pools.md
index d18ce29beaf..c2bccadb023 100644
--- a/website/docs/user-guide/features/credential-pools.md
+++ b/website/docs/user-guide/features/credential-pools.md
@@ -169,6 +169,27 @@ credential_pool_strategies:
| `least_used` | Always pick the key with the lowest request count |
| `random` | Random selection among healthy keys |
+### Demoting a healthy credential {#demoting-a-healthy-credential}
+
+The pool only benches a credential *after* the provider rejects it (429/402/401). To keep a
+credential you are actively using elsewhere — for example a Codex login whose weekly window
+you want to save for interactive work — out of the gateway's first pick *before* it runs dry,
+move it to the back of the `fill_first` order instead of removing it:
+
+```bash
+hermes auth list openai-codex # find the index, id or label
+hermes auth priority openai-codex 1 99 # 1-based index, entry id, or exact label; large n = last
+hermes auth priority openai-codex work-seat 0 # ...and back to the front later
+```
+
+`hermes auth priority <provider> <target> <priority>` reorders one credential and renumbers the
+others, then persists the new order to `auth.json`. The demoted entry stays healthy: it is not
+exhausted, so it is never touched by the Codex quota-reset probe and there is nothing for
+`hermes auth reset` to clear; it is not refreshed on a timer, and it is still used once every
+credential ahead of it is benched.
+Sessions that already hold a credential keep it until they rotate; new sessions (and the next
+gateway start) follow the new order.
+
## Error Recovery
The pool handles different errors differently:
@@ -206,6 +227,16 @@ when it only mirrored a token file the pool has just cleared — until you sign
and Nous OAuth logins alike. A dead credential never re-enters rotation on a timer, so a lost login
shows up once in the log instead of failing quietly every hour.
+**Every Codex login in an always-on home is dead: sign in again, do not wait for adoption.** Hermes
+imports the Codex CLI's `~/.codex/auth.json` automatically only to *repair a login it already has*
+— when its own refresh of the `openai-codex` entry fails and `auth.adopt_external_logins` is on
+(see [Borrowed CLI logins](../security.md#borrowed-cli-logins)). A pool whose Codex entries are
+all `dead` (or removed) has nothing left to repair, so a headless gateway or cron profile stays
+without a Codex credential until you run `hermes auth add openai-codex` in *that* home
+(`hermes -p <profile> auth add openai-codex` for a named profile), which offers the Codex CLI import
+interactively. Profiles that should share one login can point at the same `HERMES_HOME` instead of
+each holding a copy of a single-use refresh token.
+
**A cooling-down or dead credential is not a blank install.** When a configured profile starts the
CLI while its only credential is benched or quarantined, startup prints the failure and, for a bench,
the remaining cooldown (or the `hermes auth add <provider>` re-login for a dead one) — the first-run
diff --git a/website/docs/user-guide/messaging/index.md b/website/docs/user-guide/messaging/index.md
index b69cd35b399..e8a15e8c171 100644
--- a/website/docs/user-guide/messaging/index.md
+++ b/website/docs/user-guide/messaging/index.md
@@ -651,6 +651,13 @@ The generated plist lives at `~/Library/LaunchAgents/ai.hermes.gateway.plist`. I
launchd plists are static — if you install new tools (e.g. a new Node.js version via nvm, or ffmpeg via Homebrew) after setting up the gateway, run `hermes gateway install` again to capture the updated PATH. The gateway will detect the stale plist and reload automatically.
:::
+:::tip Picking up new credentials after `hermes auth add` / `hermes auth reset`
+Agents run as threads inside the one gateway process; the only child processes are tool subprocesses (terminal commands, browsers), which never hold provider credentials. A running gateway also re-reads the `openai-codex` login it seeded from `auth.json` the next time its pool selects that entry after it had gone `exhausted` or `dead` (entries added with `hermes auth add openai-codex` are independent accounts and are not resynced). When you want every session on the fresh login at once, restart the gateway — but prefer the drain-aware path over a bare kill:
+
+- `hermes gateway restart` asks the gateway (SIGUSR1) to refuse new turns, waits up to `agent.restart_after_turn_timeout` (default 1800 s) for in-flight turns to finish, exits, and lets launchd's `KeepAlive` relaunch it; the new process reads `auth.json` from scratch.
+- `launchctl kickstart -k gui/$UID/ai.hermes.gateway` sends SIGTERM instead: the gateway interrupts in-flight chat turns after `agent.restart_drain_timeout` (default `0` — immediately; the user is told and the turn resumes on their next message), gives cron runs `agent.cron_drain_timeout` (default 30 s), kills tool subprocesses and exits, then launchd relaunches it. Nothing from the old process survives, so a session that still fails with `401` after the relaunch is talking to a different gateway process — check `hermes gateway status` (and `launchctl list | grep hermes`) for a second PID, such as a manually started `hermes gateway run`, and stop that one too.
+:::
+
:::info Multiple installations
Like the Linux systemd service, each `HERMES_HOME` directory gets its own launchd label. The default `~/.hermes` uses `ai.hermes.gateway`; other installations use `ai.hermes.gateway-<suffix>`.
:::