Skip to content

The agent that grows with you

chore: merge origin/main (resolve agent/opencode_affinity.py, tests/hermes_cli/test_web_server_idle_proof.py)

teknium17f9e1453a3af
diff --cc tests/hermes_cli/test_web_server_idle_proof.py
index f6b9384512b,92acdc5c1ad..424423cec54
--- a/tests/hermes_cli/test_web_server_idle_proof.py
+++ b/tests/hermes_cli/test_web_server_idle_proof.py
@@@ -199,19 -201,13 +213,20 @@@ def test_live_pooled_children_prove_idl
ready_line = next(l for l in lines if "HERMES_BACKEND_READY" in l)
ports[name] = int(ready_line.strip().rsplit("port=", 1)[1])
+ # READY precedes quiescence: the desktop child's cron ticker runs its first tick right at
+ # start and holds retirement admission through the whole scan (``retirement_admission``),
+ # which on a loaded runner outlasts the first probe. A resident is "provably idle" once that
- # startup work drains, so wait for the idle verdict instead of sampling once.
- idle = (200, {"ok": True, "idle": True, "reason": None})
- for name in ("resident-a", "resident-b"):
- verdict, seen = _await_verdict(ports[name], lambda v: v == idle)
- assert verdict == idle, f"{name} never proved idle; observed: {seen}"
- busy = (200, {"ok": True, "idle": False, "reason": "turn_in_flight", "detail": "cron:live-idle-proof-job"})
- verdict, seen = _await_verdict(ports["cron-busy"], lambda v: v == busy)
- assert verdict == busy, f"cron-busy never named its ledger; observed: {seen}"
++ # startup work drains, so poll until the verdict settles instead of sampling once.
+ verdicts = {name: _probe_settled(port, lambda b: b.get("idle") is True)
+ for name, port in ports.items() if name != "cron-busy"}
- verdicts["cron-busy"] = _probe_settled(ports["cron-busy"], lambda b: str(b.get("detail", "")).startswith("cron:"))
++ verdicts["cron-busy"], busy_seen = _await_verdict(
++ ports["cron-busy"], lambda v: str(v[1].get("detail", "")).startswith("cron:"))
+ assert verdicts["resident-a"] == (200, {"ok": True, "idle": True, "reason": None}), verdicts
+ assert verdicts["resident-b"] == (200, {"ok": True, "idle": True, "reason": None}), verdicts
+ assert verdicts["cron-busy"] == (200, {
+ "ok": True, "idle": False, "reason": "turn_in_flight", "detail": "cron:live-idle-proof-job"}), verdicts
+ # Whatever startup work shadowed the cron ledger, the busy child never once claimed idle.
- assert all(body.get("idle") is False for _status, body in seen), seen
++ assert all(body.get("idle") is False for _status, body in busy_seen), busy_seen
status, body = _probe(ports["resident-a"], token=None)
assert status == 401 and "idle" not in body
diff --cc website/docs/user-guide/configuring-models.md
index 645ea368b93,e830d871b8f..bd06b318024
--- a/website/docs/user-guide/configuring-models.md
+++ b/website/docs/user-guide/configuring-models.md
@@@ -192,18 -192,8 +192,18 @@@ providers
CF-Access-Client-Secret: "yyyy"
```
- Header values routinely carry credentials — Hermes never logs them. `extra_headers` applies to OpenAI-compatible routes; the `anthropic_messages` and `bedrock_converse` API modes do not use it.
+ Header values routinely carry credentials — Hermes never logs them. `extra_headers` applies to OpenAI-compatible routes and to `anthropic_messages` routes (the main client, `/model` switches, rebuilds and auxiliary clients alike); `bedrock_converse` does not use it. A relay behind a WAF that rejects the SDK's default `User-Agent` (403 "Your request was blocked" or a browser-challenge page) is the typical reason to set one — Hermes reports such a 403 as a firewall/CDN block rather than an API-key rejection.
+**`session_affinity_header`** — the NAME of a header that carries Hermes' conversation id on every request to that provider (main turn on `chat_completions`, `anthropic_messages` and `codex_responses`, plus auxiliary calls such as compression and titles). Off unless set — Hermes never sends a session identifier to an endpoint that did not ask for one. Session-aware proxies fronting a stateful backend (LiteLLM's `x-litellm-session-id`, self-hosted Claude/OpenAI gateways) otherwise have nothing to correlate an agent loop on and treat nearly every request as a new conversation, re-sending the whole history upstream on each turn. The value is opaque, stable across the turns of one conversation (including compaction), and different for every conversation:
+
+```yaml
+providers:
+ my-proxy:
+ api: http://127.0.0.1:4000/v1
+ api_key: sk-...
+ session_affinity_header: x-litellm-session-id
+```
+
**`discover_models`** — set to `false` (default `true`) to skip querying the endpoint's `/models` listing and use only the `models` you configured on the entry. Handy for gateways whose model listing is slow, unreliable, or noisy:
```yaml