Review fold on 37f19c9572 (round-2 gate and second-model findings):
- The sweep reclaimed any `owned-*` directory with no owner.lock, so a
directory a user made with that name was deleted. It now reclaims an owned
root only when its owner.lock exists and nobody holds it. A process that
dies between creating its root and locking it now leaks that empty root
instead.
- `hermes uninstall` (data-only) removed runtime/provider-plugins, including
the copies live processes import from, because the removal plan protected
only some runtime files. The snapshot directory is now in the plan's
protected set; dead roots there are still reclaimed by the next process.
- A claim another sweeper is still deleting can be taken again and deleted
twice. That costs only the duplicated work, since both deletes ignore
errors, but the docstring and the previous commit said it could not
happen; the docstring now says what does.
- The module docstring and _new_root now describe the unswept fallback
instead of saying every process holds an owner lock, and the plugin-testing
guide names the Hermes root (not the profile home) as where the copies live.
Part of #156493.
Follow-up on the salvaged move of provider-plugin snapshots to
<home>/runtime/provider-plugins (#156209 by @akinduroifedayo). That keeps the
copies away from the age-based temp cleaners that broke long-running gateways
(#156493). Two gaps remained once the copies no longer live in a cleaned dir:
Crashed and killed processes left their root behind forever, so the directory
grew with every unclean exit. Each process now holds an OS lock on owner.lock
in its own root while it runs (pm.filesystem.lock_path). The next process to
create a root reclaims the ones nobody holds, under one setup lock so a sweep
never sees a root whose owner has made it but not locked it yet. Only
hermes-provider-plugins-* roots are touched. Dead roots are renamed out of the
way under the lock and deleted after it is released, so a large one never
holds up other processes starting; a sweeper killed mid-delete leaves only
.reaping-* names, which the next sweep finishes. A lock file this user cannot
open (a home shared across UIDs) only skips the reclaim, with a warning; the
process still gets a root of its own.
The exit hook now removes the root only in the process that created it. A
forked child inherits the hook and shares the flock, so a normal exit there
deleted its live parent's copy and dropped its lock.
A live root is also process state, not home data: `hermes backup` and
`hermes profile create --clone-all` now leave runtime/provider-plugins out
(PROVIDER_PLUGIN_SNAPSHOT_PARTS in hermes_cli.home_data_layout).
The plugin-testing guide suggested a HERMES_HOME inside ~/.hermes/cache/scratch,
which the scratch pruner cleans by age; it now uses a directory outside it and
says why.
Part of #156493.
On docker, modal, ssh, daytona and vercel_sandbox the cold prune and the compaction
offload kept every result whole (no saving) or dropped it without an archive, because
cache/pruned was not published into the sandbox and the stub named a host-only path.
cache/pruned now joins the cache dirs docker bind-mounts and the synced backends push,
the stub names the path the sandbox reads (to_agent_visible_cache_path), and read_file
forces a sync before opening an archive on a file-synced backend. Plugin backends and a
hosted scope still keep results whole.
install.sh and install.ps1 run `hermes gateway install --if-missing` right
after `hermes setup`. That path only checked whether a service was already
installed, then took the explicit-install route: it asked start-now and
start-on-login (both default Yes), wrote the unit whatever the answers, and
overwrote the recorded `gateway.service_install_choice: decline` with
`install`. A user who said No in setup got a service anyway.
`--if-missing` now goes through setup's own consent seam: an installed
service is a no-op, a recorded decline prints how to opt in later, and an
unanswered question is asked once via ensure_gateway_service. Plain
`hermes gateway install` stays the explicit opt-in.
Fixes#157677
Rebasing onto main: the old session store (hermes_state_runtime, SessionDB's
admission helper) was removed, so bot_delivery.list failed at import and the
gateway handler table could not load. The owner join now reads the target's
admission from its authority's persistence handle, the sidecar's stored state
from a read-only persistence reader, and the sender's home from the authority's
profile_id. bot_mode_probe._handle now takes the roster's names (a real
profiles/hermes keeps @hermes), so the strip and the sidecar resolve handles
the way the rest of Bot Mode does. Regenerated the serve handler ledger.
The workflow README, platform support page, bundle and stable release
guides, desktop README/BUILDING and the install smoke README said the Linux
desktop legs were disabled. They now say what the workflow does: canary
tags build Linux AppImages as diagnostic artifacts that stage to the tag
archive, gate nothing, have no smoke or feed, and are offered by no
release; commit builds skip them. The PM Bundle Linux legs stay listed as
disabled.
Review follow-up. The compat layer now keeps exactly the old imports the
catalog's OpenViking 2.1.2 and Honcho 1.2.0 pins make at load time, and
says so:
- agent.context_compressor_retry is no longer aliased (no catalog plugin
imports it), and agent.skill_commands re-exports only
extract_user_instruction_from_skill_message (neither pin imports
register_auto_load_scaffold).
- moves.py admits a folded module only when a catalog-pinned plugin
imports it.
- plugins/AGENTS.md and the plugin guide record the exception: which
names, where they live now, and that they follow the hermes_state
stand-in's window (removed no earlier than v0.27.0).
alt-glitch's review of 893b54f9:
- Hermes' own managed llama-server unloads an idle model (and its prompt cache) after 15 min (+ two
120 s sweeps): its clock now ends there, so /context and the cold offload see it; a user's own local
server still never expires on the clock. The guarantee is capped at the estimated end.
- A malformed entry in cache/prompt_cache_routes.json (non-numeric timestamp, counters or gap lists) is
dropped instead of raising into agent build and usage accounting.
- The route key keeps the port (normalized base URL): two local servers on one host learn apart.
- The classic CLI's idle cache hook never ran: `hermes chat --cli` drives a GatewayAgent and the gateway
owns the warmer and its housekeeping. The hook, its test and its helper are removed (the two CLI
files are main's again).
- A due-scan's claimed action is handed to a release job that registered for the same chat while the
scan ran, instead of being dropped.
- Keep-alive log lines carry the chat's session tag (set on the timer thread).
- Tests that could not fail now can: the claim race pauses after the decision, the late-miss branch with
no successor, and the compaction hand-off through carry_compression_automation (each red when its fix
is reverted).
- Follow-ups folded in: a finite admission arms no idle keep-alive; delegate cost folding takes the
session-totals lock; the docs say the gateway offload lands on its 5-minute tick.
Teknium approved every improvement the usage backtest found:
- A keep-alive miss served by another upstream than the reply that cached the prefix (Nous serves one
Claude model from chatcmpl-* and gen-* upstreams; 70 switches broke a warm cache in the window), or
one that still read the stable system prefix, is routing, not lifetime. Real misses end warming only
on the second in a row (three misses of any kind end it too). The upstream key is data
(prompt_cache_clock.response_upstream: a gateway's upstream field, else the response id family),
stored on the clock event; a retried miss's rewrite is not charged to the money limit.
- cache_ttl auto: a person's chat starts on 5m and asks for 1h from the first message after an idle gap
past five minutes, for the rest of the session (kept per session id, carried to the compaction child,
re-derived from a stored clock that asked for 1h). The upgrade fires only when the clock holds no
guarantee and the last cache touch is over 300 s old, so markers never change on a warm prefix. No
idle keep-alives before the upgrade. /context names the pending tier. Explicit pins and machine
sessions unchanged. Wire snapshot regenerated: fresh cli agents now send 5m markers.
- Route store: a downgrade needs samples from two different sessions, an upstream switch is never a
sample, and a learned lifetime never undercuts the longest hit ever seen (kept outside the trimmed
recent gaps).
Tests pinning the single-miss stop and the 1h start are rewritten to the new ruling (assertions only).
Runner doubles built on GatewayShutdownMixin without the watcher mixin raised on the method
call; the drain reads only the runner's own pending-release map.
agent/prompt_cache_lifecycle.py (1,200 lines) splits along its topics, per root AGENTS.md
§ Packages and Python shape: replay.py (which requests replay, with which output cap, through
which client), economics.py (a keep-alive's cost against the rewrite it prevents), edge.py (the
cache-edge gates claim_edge asks), warmer.py (PromptCacheWarmer and the agent-facing seams).
__init__ is the facade (__all__, no behaviour); topic modules import one another, never the
facade. Callers keep importing the public names from agent.prompt_cache_lifecycle; tests mirror
the folder under tests/agent/prompt_cache_lifecycle/ and patch where each name is looked up.
Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
After the API-spec refactor, classify_route/_rule_openai_spec stopped reading the request's
prompt_cache_retention, so estimated_until equalled the 30-minute warming deadline on every
OpenAI-spec route. prompt_cache_is_cold() then turned True at 31 minutes, and turn-start prune,
owner offload and route-change offload rewrote history on routes whose cache was still warm:
api.meta.ai and Bedrock Mantle GPT-5.x/4.1 (Hermes asks those for 24h retention), and local
llama.cpp / vLLM / Ollama boxes, which evict on memory pressure, not on a clock. Each needless
rewrite costs a full prefix re-process.
Only the expiry estimate changes (_estimated_end). The 30m stays the guarantee and warming
deadline for every OpenAI-spec route, a 24h request included (warm at 25 min, first miss
disables). A request that asked for 24h is estimated to live read + 24h, and the estimate
survives a read renewal. An is_local_endpoint host has no estimated end (estimated_until None
with a known confidence), so it is never certainly cold on the clock, while route_changed and
compaction still invalidate the window and offload. chatgpt.com Codex gets no retention from
Hermes, so its 30m stands.
Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
agent/prompt_cache_routes.py: a per-profile store (<HERMES_HOME>/cache/prompt_cache_routes.json, atomic,
<= 500 routes, 7-day expiry) keyed by provider, host, model and marker use, fed by the clock from every
folded response (normal replies and keep-alives; no probes). After two consistent samples: never reads
back -> no keep-alives and no markers; re-writes the prefix on every hit -> no keep-alives; early misses
-> keep-alives on the learned lifetime (never past the tier) or none under a minute; an automatic cache
that dies early while the explicit one reads -> markers. /context shows 'Learned: <rule>.'
Nous Portal's /v1/models lists input_cache_write for every model that takes explicit cache_control
(Claude, Qwen 3.7/4, Gemini, GPT-6, ...). The nous profile declares prompt_cache_markers_from_catalog,
so the marker policy reads that rate: priced -> markers at the tier asked (Anthropic spec, declared),
unpriced -> no markers (OpenAI spec, 30m). Measured on qwen/qwen3.7-max: without markers its automatic
cache missed at 4 min; with a 1h marker it still hit after 13 idle minutes, the write billed at 1.25x.
Pricing now takes a catalog's input_cache_write_1h (Claude: 2x) or its single write rate for 1h writes
instead of a fixed 2x.
Teknium's rulings on PR #156455:
1. A request with cache_control markers is Anthropic spec on any wire or gateway: the 5m/1h it asks
for is declared and trusted (route ceilings still clamp); 'gateway_1h_untrusted' is gone. Every
unmarked request is OpenAI spec (30m, renewed by a read), Nous non-Claude models included.
2. The first keep-alive that misses disables warming for the rest of the session on that route (new
user messages and compactions do not re-arm it; a model/provider switch or a fresh session does).
The compact/offload fallthrough still runs; /context appends 'Keep-alives: off (one missed).'
3. While a tool call executes, keep-alives continue until it returns, uncounted against the idle
budget of 3 and bounded only by one rewrite's cost for that tool wait.
- A keep-alive only goes through a client that honours its cap: the OpenAI and Anthropic SDKs as
they are, any other client through effective_output_cap. Native Gemini lifts a thinking request
to 65,535 tokens, so it is not warmed; the long-decode extra_body.max_output_tokens is dropped
from the replay. ACP / unknown clients are not warmed.
- The budget is one _Budget per user turn that every run shares: each keep-alive is reserved at
admission and reconciled with its billed cost even if its run was replaced, and an ended budget is
carried to the turn's final prompt so a spent tool run still compacts or offloads.
- route_change_offload runs before every request assembly, so a mid-turn fallback restart offloads
old tool output before the first request on the new route.
- A: no priming and no keep-alives after a cache-edge compaction; the next user message starts the
budget. The budget is keyed on the user message, so tool rounds inside one turn share 3 keep-alives.
- B: a missed keep-alive still stops warming, and now ends the budget so step 2 (compact) or step 3
(expire + offload) is decided at once.
- C: no $0.05 floor; a keep-alive is sent when its read is cheaper than the rewrite, within one
rewrite per budget, with known prices and a prefix of at least 1,024 tokens.
- D: keep-alives fire at 5/6 of the TTL (250 s / 25 min / 50 min), >= 10 s margin; compaction decides
at the same moment.
- E: compaction no longer requires a still-warm cache (the summary is a fresh aux request).
- F: an idle chat past its window is offloaded by its owner (CLI tick, TUI ticker, gateway watcher)
and on release, not only on return.
- G: two specs: cache_control markers (Anthropic, 5m/1h) or OpenAI-spec automatic caching for every
other model, declared 30 min renewed by a read; OpenAI-spec routes get the full loop, replayed with
the smallest accepted output cap (16 for GPT-5/o-series).
- H2: a route switch (/model, fallback) reads as cold, so the first request on the new route offloads.
Removed tests pinning ruled-out behaviour: priming (test_cli_cache_expiry_prime.py, the priming and
prime-billing lifecycle tests, the TUI no-prime test), the $0.05 floor, 90% timing, the still-warm
gate (TUI window-closed test, already_cold), OpenAI pre-5.6 assumed / implicit unknown clock tests.
The Portal now keeps Claude's 1h tier: a raw probe read a 13.2k-token 1h prefix back from
cache after 7 and after 25 idle minutes, with its write billed at 2x (the 5m control rewrote).
The Nous profile drops its 5m ceiling and declares prompt_cache_max_ttl="1h" instead, so the
wire asks for 1h under cache_ttl auto and the clock declares it (route_ceiling_1h): human chats
on Nous now warm x3 on the 1h schedule, compact at the budget's end/release, and offload on a
cold return like Anthropic and OpenRouter. Without a declared ceiling a 1h ask on an
Anthropic-wire gateway stays unproven (gateway_1h_untrusted), which would leave Nous with no
lifecycle at all.
route_ttl_ceilings stays: tests that exercised the clamp now set {nous: 5m} in their temp config.
Docs drop every 'Nous is 5m' sentence; the Nous wire snapshot gains ttl 1h on its markers.
Main's root AGENTS.md adds no new flat <stem>_<topic> siblings unless an area AGENTS.md prescribes
one. The compaction/prune archive helpers (archive_pruned_originals, archive_compaction_drops,
pointer parsing, the summary's archive list) move into tools/tool_result_storage.py, which already
owns spilled and pruned tool-output files and their sweeper; the TUI cache-expiry ticker and
release-time compaction move into tui_gateway/session_reaper.py, which owns idle/LRU reaping and
already calls them. No shims; imports, docs and tests follow.
Review fixes for the prompt-cache lifecycle (Greptile on 8f99ba52):
- Compact at release: a warm budget ends at whichever comes first, its 3 keep-alives or the owner
releasing the agent. On a 1h route the gateway evicts an idle agent after an hour, before 3
keep-alives at ~54 min run out, so step 2 never fired. The gateway idle/LRU evictions and the TUI
idle/LRU reapers now ask claim_compaction_at_release (same gates, decided at the release, warming
cancelled) and compact first through the same claim-gated job, then release. No keep-alive after.
- Planning is write-free: _plan_compaction_window no longer archives. compress() archives once after
admission; a prepared pass archives its own window after taking its slot and the splice skips those
rows, so no result is written twice and refused passes write nothing.
- The committed summary lists every archived file the generated text omits ("Archived tool output"),
so the model keeps the path and the retention sweep keeps the file.
- A queued TUI cache-expiry job whose chat closed meanwhile is refused at the busy claim (_closing).
- A no-op, aborted or refused compaction no longer primes or grants a fresh budget (TUI and CLI).
- Keep-alive and priming writes are priced at the tier their request declared (1h = 2x input), as
loop responses are.
- Docs: keep-alives (and so step 2) are Claude-only; OpenAI routes are never warmed.
- The reset race test proves the reset reached the contested lock with a trace barrier (2 s bound).
agent/prompt_cache_lifecycle.py owns the per-chat decision at each pre-expiry point,
replacing agent/prompt_cache_warmer.py's scheduler and agent/cache_expiry_compaction.py's
decision (both deleted). A real request opens a budget of 3 keep-alives; chats a person
types into keep warming while idle, machine sessions (subagents, side agents, forks,
machine-paced sources) only while a tool runs. A spent budget on a proven/declared
window >= 30m with context >= half the compaction threshold and growth since the last
compaction is claimed once by the surface owner (CLI idle tick, TUI ticker, gateway
watcher); CLI and TUI then prime the compacted chat for one fresh budget. Any miss ends
warming; an unknown clock arms nothing. Every #122094 guard (witness, single admission
under lock, reset epoch, aux hooks, unknown-price refusal, spend cap, $0.05 floor) and
every #156253 owner guard (claim_gate, profile scope, bounded jobs, detached chats) is
kept. The one-hour age cap is replaced by the budget.
Live Nous run (route ceiling lifted to 1h): the idle prefilter keyed on the
response-time activity stamp blocked the fire point, and an attempt that
committed nothing (summary would grow) stayed due every tick. The prefilter
now sits at 0.75 of the window and a claimed window is latched. Docs.
The fork inherits the parent's interactive platform, so under the auto default
it resolved to 1h. Routed to a different model its cache is cold and it calls
back-to-back until done, so it is clamped to 5m like a delegated child (#104168).
Docs say the side-agent rule applies under auto.
A side agent (CLI/TUI /background, /btw, /refine) runs one finite task under its
parent's cli/tui label, so `auto` keeps it on the 5m tier. An unreadable config
now resolves to the shipped `auto` default like every other section, and the
template's schema stamp moves to 53 with the new migration.
Sessions a person types into (CLI, TUI, Desktop, messaging) now request the 1h
Anthropic cache tier by default and machine-paced ones stay on 5m, using the
existing `auto` policy. Migration 53 drops the old seeded `cache_ttl: "5m"` so
installs seeded from the template follow the new default; 1h, auto and off are
kept. The API server (`api_server`) and the skill curator (`curator`) platform
labels join the machine-paced set, matching the documented auto policy.
The warmer computed its own entry lifetime (the configured tier on native
Anthropic, 5 min on any gateway) and its own send-time anchor. Both now come
from agent/prompt_cache_clock.py: a refresh is due shortly before the clock's
guaranteed-warm deadline, and a window the clock does not call certainly warm
(unknown, assumed gateway 1h, cache moved, already past) arms nothing. Each
refresh is folded back into the clock (record_cache_response gains an
attempt= override so a keep-alive never clobbers the loop's stamped attempt),
its token row carries the clock column, and the next refresh is scheduled from
the deadline the refresh bought. warm_ttl_seconds, the warmer-local
TTL_SECONDS and _last_api_attempt_sent_at are gone: one lifetime source.
A refresh re-sends the tail past the last cache marker at the full input rate, but the savings
check and the remaining-budget reservation priced the whole prompt as a cache read, so a request
with a small cached prefix could be approved for refreshes costing more than the miss. The prefix
(cache read + write of the arming response) and the tail (its uncached input) are now priced
separately, and each refresh is reserved at no less than what the last one was billed.
A refresh in flight when compression rotated agent.session_id was booked on the new session. The
run now snapshots its session, source and billing route when it arms and books there; the new
session's in-memory totals are left alone.
A refresh whose usage shows no cache read or any cache write (the entry was already gone, or the
replay re-wrote it) used to be booked and then re-armed as if it were a cheap read, so a run could
keep paying write prices every TTL. Now the run stops on that refresh and says why.
The spend cap compared (n+1) * an assumed read cost against the miss. It now sums the estimated
billed cost of the refreshes actually sent (estimate_usage_cost on each refresh's own usage) and
stops before one more refresh would pass the miss; a refresh with unknown cost also stops.
Every stop reason is logged at INFO, once per change of reason (routine turn-end/new-request
stops of a run that sent nothing stay at DEBUG). warm_ttl_seconds is documented as the warmer's
only lifetime source so the shared cache clock (#156101) replaces it in one place.
Streaming warming (a keep-alive while a tool call is still running) has no
real tradeoff: the next request is certain, one keep-alive is a cache read
(~1/12 of the write it prevents), and the economics gate already refuses
cheap, unpriced and subscription-included routes. So it is always on and
prompt_caching.cache_warming is gone: warming follows prompt caching itself
(no cache_control markers -> nothing to warm).
Idle warming (keep-alives after the turn settled, betting p=0.15 that the
user replies within the TTL) was speculative spend, so the mode is deleted
rather than kept behind a knob: every turn exit now cancels the warmer.
One guard is new: a run's refreshes together may never cost more than the
single cache miss they prevent. On a 5-minute gateway route a one-hour tool
call would otherwise pay ~13 reads (> one 1.25x write); the run now stops
at floor(miss / warm) refreshes. Cache-parity forks opt out through
_skip_prompt_cache_warming instead of the removed mode.
With prompt_caching.cache_warming: "streaming", a tool round that outlives the cache
lifetime no longer turns the next request into a full-price cache write: the agent replays
the last request with max_tokens 1 at 90% of the lifetime, and one cache read keeps the
whole prefix alive.
Warms Claude on the Anthropic Messages wire AND on Chat Completions gateways (Nous Portal,
OpenRouter), where most Claude traffic runs. Off native Anthropic the refresh is timed on
the 5-minute schedule whatever cache_ttl asks for: a live probe on Nous Portal showed a
ttl "1h" entry fully re-written after 7 minutes, and the request then pays the full write.
Review round on #156081 (100yenadmin's review + /review):
- Sandbox guard decides on the terminal backend: archive-and-prune only on
`local` outside a hosted scope; every other backend (docker, modal, ssh,
daytona, vercel_sandbox, plugin or unknown names) and a refusal scope keep
the result whole. The old path-translation check never fired because
cache/pruned is mounted nowhere. The mocked test is replaced by
100yenadmin's real-resolver test (cherry-picked) plus unknown backends.
- Warm proactive pruning is back to main's defaults (0 / 8000 / 4096: off).
The cold path (provider cache already expired) needs no trigger and stays
on by default with its 16K reclaim gate; a warm gate only lowers it when
the warm prune is switched on. The two skill-safety fixtures and the
other prune test files are byte-identical to main again.
- The running-turn guard fails closed: a turn index that names no user row
(-1 after a compaction, or any other row) skips the round instead of
falling back to the count-only tail.
- The protected-tail boundary is aligned with _align_boundary_backward, so
one assistant step's parallel results are pruned all-or-none.
- read_file pages every cache/pruned archive (.json and .txt) and wraps a
line longer than the per-line cap, so a one-line 300,000-char archive
reads back completely.
- Archive writes are read back and compared byte-for-byte, not size-checked.
- Docs: what is on by default, the backend rule, that a referenced archive
stays until its session is deleted (sessions.auto_prune is off by
default), and that the sweep keeps everything past 20,000 referencing rows.
The proactive prune now knows when the provider prompt cache has already
expired. In that case a rewrite breaks nothing that is still paid for, so
the prune can run more often and at a smaller size.
- prompt_caching.provider_cache_expired(): checks prompt caching is on and
more than the route's effective TTL (5m or 1h, plus 30s slack) has passed
since the last provider response. turn_usage stamps that time on every
response; a resumed session reads the newest assistant row timestamp.
- prune_tool_results_only(cold_cache=True): commits from 16K reclaimable
tokens (or the configured gate if lower). It neither checks nor moves the
64K regrowth runway, and what it frees is credited against the next warm
64K gate. Warm behaviour is unchanged.
- New turn_proactive_prune module: shared call-site helper (same gates as
before: a session store, no checkpoint_required) plus a turn-start cold
prune. The turn-start prune runs on the history before this turn's
unpersisted user row, so the turn-start persist and api_content stamp
are untouched.
- Plugin engines whose prune_tool_results_only lacks cold_cache keep their
signature.
Replay of 80 real sessions at 1M, compared with the warm-only prune:
-11.5% / -9.5% with 5m caching, -2.2% / -1.9% with 1h caching, and no
session worse in any of the four cells. Most cache expiries come right
after a user message (209 of 343), which is why the turn-start site is
needed.
On large-window models the ratio threshold (50% of the window) rarely
fires, so old terminal dumps, file reads and web extracts are re-sent
on every call. The deterministic, no-LLM proactive prune already
handles this but shipped off (0 / 8000 / 4096).
New defaults:
proactive_prune_tokens 0 -> 64000
proactive_prune_min_result_chars 8000 -> 1000
proactive_prune_min_reclaim_tokens 4096 -> 64000
How they were chosen: a replay of 80 real never-compacted sessions
(40 dev / 40 holdout, ~6,100 main-model calls on dev) through the real
ContextCompressor with the summary call stubbed, priced with prompt
caching (cached prefix 0.1x, new tokens 1.25x, any history rewrite
re-billed in full). 18 settings were swept on dev at 1M; the best was
confirmed on holdout. A higher min_reclaim beat a lower one at every
trigger size, because each committed prune breaks the prompt cache.
Modeled input cost, default (prune off) vs new defaults:
window dev holdout
128K -3.8% -6.8%
200K -0.7% -3.2%
272K -8.0% -6.9%
400K -23.7% -26.2%
1M -24.1% -27.0%
No errors and no new context overflows in any run. With 1h-TTL cache
pricing (2.0x writes) the 1M saving is -20.3% dev / -23.5% holdout.
Trade-off: roughly half of old tool-output text stays verbatim (about
54% at 1M, against 100% today); demoted results keep a one-line summary
and stay recoverable through session_search. Answer quality was not
measured.
Also: a YAML boolean is never a token count. `proactive_prune_tokens:
false` now turns the prune off and `true` keeps the default, both at
agent build and on TUI/desktop live config reload. Before, reload turned
`true` into a 1-token trigger that pruned every turn.
Tests that exercise prune mechanics on ~5-7K-token fixtures now pin
min_reclaim=4096, since the 64K default would make them no-ops.
With no new commits since the last canary, release.py --canary resumes
that tag and exits 0, so Canary Release succeeds and Canary E2E ran the
whole set again (about 1,400 job-minutes) on a commit it had already
tested.
resolve now asks the Actions API for successful automatic Canary E2E
runs and matches their titles ("Canary E2E on <commit>", the run-name)
exactly against this commit; on a match it outputs tested=true and the
three calls skip. A dispatch skips the check and always runs: it is the
forced rerun. A commit whose earlier run was red runs again. resolve
gets actions: read for the query.
The new test replays the step against a fake gh and checks the calls'
ifs. The step and its outputs are new, so red on the previous head is
just a missing step; mutants carry the proof instead: dropping the
event or status filter, running the check on a dispatch, a call that
ignores tested, never setting tested, and a title match that isn't
exact are each caught (6 of 6).
Reported by @kshitijk4poor on #156684.
install-e2e-red.yml acted only on scheduled Install & Update E2E runs.
#135409 removed that schedule. Of its 1,453 runs since then, 1,434 were
skipped and 19 cancelled, and its last issue (#128399) closed on
2026-10-08.
It now watches Canary E2E and keeps the one install-e2e-red issue in
step with the latest run a canary started: red opens or rewrites it,
green closes it. A dispatched Canary E2E run (a replay or a branch
probe) leaves it alone, and so does a run the canary gate skipped. The
label and file names stay, so the old trackers keep their history.
red-tracker.mjs names the run by its display title, which carries the
commit under test (canary-e2e.yml's run-name). The run's head_sha is
main's tip when the workflow_run event fired, which can be a later
commit than the one tested. The issue now says "jobs" rather than
"legs", because a Canary E2E run includes CI's E2E jobs as well as the
install/update legs.
Since ffcd3621a9 (#135409) pull requests and pushes to main run no E2E
suite, so a stable claim is the first run to meet a regression. On
2026-11-16, claims rc.9 to rc.12 of v0.23.2 each failed E2E, and two of
rc.9's blockers had shipped in canaries days earlier:
- the five upgrade-handoff failures come from #155532 (c9e74fb4be), in
every canary since 2026-11-15;
- the user-state check flags the session-schema memo whenever SCHEMA_SQL
differs from v0.23.1's, as it has in every canary since 2026-11-12.
canary-e2e.yml runs after every successful Canary Release on the
default branch of the upstream repo. It makes the three calls
stable-release.yml makes for its ci, install-e2e and windows-live lanes,
with the same inputs and permissions, on the commit the canary tagged.
A workflow_run run's github.sha is main's tip when the event fired, not
that commit, so the canary run's head_sha is resolved once and handed
to every call. ci.yaml's detect gate opens E2E only for release: true
or a dispatch, and this run's event is workflow_run, so the call passes
release: true as a claim does. The workflow only reports: the canary
never waits on it and nothing publishes. One set runs at a time (group
canary-e2e, queued); rc.10's set took about 1,400 job-minutes and 45
minutes wall clock.
Tests evaluate the real workflow files with tests/ci/_gha_expr:
- which canary runs start it;
- that the commit under test is the canary's, not main's tip;
- that each call mirrors the claim's call of the same workflow;
- that ci.yaml, called from a workflow_run event with release: true,
reaches every E2E consumer.
Main's SessionDB.resolve_session_id returns the exact id, else the one id a prefix matches, else None.
The plugin guide's own chat-frontend example (website/docs/user-guide/features/plugins.md, _session_to_resume) calls SessionDB(read_only=True).resolve_session_id(...), and the stand-in had no such method: the example raised AttributeError.
The stand-in's SessionDB forwards resolve_session_id to the store's sessions.resolve_id, which answers the same way, and the guide's table lists it.
Proof: the new case (a unique prefix, an exact id and an ambiguous prefix through a read-only SessionDB opened as the example opens it) red before (AttributeError: hermes_state.SessionDB has no attribute 'resolve_session_id'), green after. The guide's _session_to_resume, extracted from the page and run unchanged against a seeded store, resolves a short id and a title and refuses an ambiguous prefix (helper-b probe_f29_docs_example.py, logs/f29-docs-probe.log). tests/hermes_cli/test_plugin_docs_public_imports.py 6 passed. Import-only check passes; ruff clean.
Reported-by: teknium1
Main's hermes_state imports WriterMutexTimeout, maintain_after_commit, write_site and writer_mutex_until from hermes_state_write and note_read_pool_exhausted from hermes_state_readpool, so all five are importable from hermes_state; F39 at the swap level restores them there.
The removal replaced hermes_state.py with a stand-in that forwards only its listed names, so the five raised AttributeError again from this level up.
The stand-in now lists the five and forwards each to its home at this level (persistence/sqlite/_state/write.py and persistence/sqlite/_state/readpool.py), with a warning that names no public replacement. The plugin API list, its generated page and the plugin guide's table carry them, since the stand-in's names and the published list are pinned equal. A new case imports each from hermes_state and checks it is its home's object.
Proof: tests/test_hermes_state_standin.py new case red before (AttributeError: module 'hermes_state' has no attribute 'WriterMutexTimeout'), green after; the plugin API list, docs-imports, published-API and backend-import-guard tests pass (12, 6, 173, 30). The one stand-in case still red is the callers-level append_batch keyword (see F20). Import-only check passes; scripts/ci/check_backend_imports.py clean; ruff clean.
Reported-by: unsupportedpastels
The context engine guide said every on_session_start after a compression continuation carries session_db and persistence. Only the adoption of a continuation another compression created passes them (agent/conversation_compression.py, _adopt_live_compression_child); the notice after the agent's own compression, and the calls at agent start and after /new, pass neither, as main's do. The line now says so and tells an engine to keep the handle bind_session_state received. The text is BearHuddleston's suggestion from his review.
Reported-by: BearHuddleston <bear@bearhuddleston.dev>
The plugin guide's table of where each hook fires named hermes_state_common.py for on_session_delete. That module is gone at this level; emit_session_deleted now lives in session_retention.py, and the row names it there.
The gateway local sessions guide pointed the workspace rule of session.list at hermes_state_sessions.workspace_key, a module this branch removes; it names the function where it lives now.
Hermes builds the SessionDB it hands a plugin context engine as session_db straight from the stand-in's class, so building it no longer emits the once-per-process hermes_state warning from a core frame and leaves the warning for plugin code. An engine with a bind_session_state or on_session_start hook whose signature cannot take persistence still reads through that SessionDB, so it gets the stand-in's one warning instead, naming the engine's class, the persistence= keyword and the removal release. An engine whose hooks all take persistence gets none. The context engine guide says so.
The official mcp-serve plugin gets its transcript handle from hermes_state_registry.acquire() and builds its routing index from SessionDB.list_gateway_sessions; with neither carried, its message reads answer "Session database unavailable", its event polling stops and the index comes back empty. hermes_state_registry.py returns as a stand-in: acquire(db_path=None) opens a hermes_state SessionDB of its own for the caller, release(db) closes it and returns True as main's did for a lent handle, and release_or_close(db) closes it. The first acquire in a process emits the stand-in's one deprecation warning in its own words, naming persistence_assembly.open_persistence and the removal release, at the plugin's call; a process that has already had the hermes_state warning gets no second one.
The stand-in's SessionDB carries list_gateway_sessions(*, platform=None, active_only=True), main's keyword-only signature, held open for the call like its other methods, and returns each session row with its last_active as main did. Both are listed in the plugin guide's replacement table and in hermes_cli/data/plugin_api.json, public-api.md is regenerated, and the test that fires at the removal release names hermes_state_registry.py among the files to remove.
The hermes_state stand-in now also forwards the nine public helpers main exported that live on in shared modules outside the backend: format_session_db_unavailable and get_last_init_error (storage_user_copy), resolved_max_resume_messages and resolved_max_export_messages (storage_limits), preflight_db_writability and read_only_db_uri (sqlite_support), holder_pid_checkable (process_identity), make_user_dir (hermes_dir_acl), and divert_session_transcript_jsonl, which supplies the profile's sessions folder under HERMES_HOME as main's did. Each one warns through the stand-in's once-per-process deprecation warning, naming its replacement.
hermes_cli/data/plugin_api.json lists hermes_state name by name instead of as a whole module, and lists the nine replacements, so hermes plugins validate reports an import of any name the stand-in does not carry (the old class's mixins and the SQLite backend's own helpers) instead of passing a plugin that fails on import. The plugin guide's replacement table names the nine and their replacements, and public-api.md is regenerated from the data file.
An agent given hermes_state.SessionDB as session_db writes through the handle that SessionDB holds when the agent is built. The stand_in_interface docstring and the plugin guide's SessionDB() row now say the caller keeps that SessionDB open for the agent's life: its close() releases the handle, and its reopen after close() gives the agent no new one.