mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-27 17:58:07 +00:00
The Nous Portal profile publishes a top-level `session_id` that the Portal uses as its sticky routing key, pinning a conversation to one upstream endpoint so explicit Anthropic `cache_control` breakpoints stay warm (those caches are instance-local, so a reroute cold-writes instead of reads). `NousProfile.build_extra_body` sourced that key only from the explicit `session_id` argument. Auxiliary call sites — compression, title generation, vision, web_extract, session_search, MoA slots — funnel through `agent.auxiliary_client`, which has no session handle and never passes one. They carried the `conversation=` tag but NO sticky key at all, so each one routed independently of the conversation it belonged to. Resolve the key the way `nous_portal_tags` already resolves that tag: ambient lineage-ROOT contextvar first, explicit argument as fallback. Fixes every aux call site at once with no per-call-site plumbing. Also publish the root in the `_compress_context` forwarder when nothing is ambient. Out-of-turn entry points (`/compact`, the gateway `/compress` command and its hygiene sweep, partial head compression) call it outside `run_conversation`'s scope, so the summarizer's aux call ran untagged and unkeyed; the caller's value is restored in `finally` so a compaction never leaks its tag. Scope note: this does NOT keep the compaction turn's own prompt cache warm. Compaction replaces the history with a summary and rebuilds the system prompt, so that request is a cold write on any endpoint — what a stable key buys is the turns AFTER compaction reading the cache it wrote. Under the default `compression.in_place: true` (#38763) the session id does not rotate at compaction, so for the main loop the ambient root and the explicit argument already agree; the ambient resolution additionally holds the key stable for installs that opt back into rotating compaction and across delegate-subagent trees. Salvaged from #71747. Subsumes the aux-call half of #70883 (@webtecnica), which threaded `session_id` through `call_llm` to close the same gap. Tests: 4 cases in tests/agent/test_portal_tags.py; both fix halves verified to fail against the pre-fix behavior via sabotage runs. |
||
|---|---|---|
| .. | ||
| browser | ||
| context_engine | ||
| cron_providers | ||
| dashboard_auth | ||
| disk-cleanup | ||
| google_meet | ||
| hermes-achievements | ||
| image_gen | ||
| kanban | ||
| memory | ||
| model-providers | ||
| observability | ||
| platforms | ||
| security-guidance | ||
| spotify | ||
| teams_pipeline | ||
| video_gen | ||
| web | ||
| __init__.py | ||
| plugin_utils.py | ||