feat: type-scope events vacuum to prune only stream rows (14d) + drop turn-stats vacuum
This commit is contained in:
parent
f8cf76b62d
commit
6e39515669
9 changed files with 50 additions and 99 deletions
|
|
@ -74,13 +74,19 @@ One table:
|
|||
harness emits during turn loop execution.
|
||||
|
||||
The harness writes; the host vacuums. `hive-c0re::events_vacuum`
|
||||
runs hourly and sweeps every existing agent harness dir, deleting
|
||||
rows older than 7 days. Age-only — no row cap — so a chatty turn
|
||||
doesn't lose history sooner than a quiet one; disk pressure on a
|
||||
sustained burst is the cheaper problem to have. Centralising
|
||||
retention on the host means a misbehaving harness can't disable
|
||||
its own vacuum and agents don't need any cleanup wiring of their
|
||||
own.
|
||||
runs hourly and sweeps every existing agent harness dir. Retention
|
||||
is **type-scoped**: it deletes only the verbose `stream` rows (the
|
||||
raw claude `stream-json` deltas — one per text chunk / tool use, the
|
||||
bulk of the file's size) older than 14 days, and keeps every other
|
||||
kind (`turn_start`, `turn_end`, `note`, `status_changed`,
|
||||
`model_changed`, `token_usage_changed`, `turn_state_changed`)
|
||||
indefinitely — those are small and carry the semantic per-turn
|
||||
history the operator scrolls back through when debugging a
|
||||
regression. Age-only within the `stream` kind — no row cap — so a
|
||||
chatty turn doesn't lose its stream history sooner than a quiet one.
|
||||
Centralising retention on the host means a misbehaving harness can't
|
||||
disable its own vacuum and agents don't need any cleanup wiring of
|
||||
their own.
|
||||
|
||||
Path overridable via `HYPERHIVE_EVENTS_DB` (for dev / no-`/harness`
|
||||
setups). On open failure the `Bus` falls back to no-store mode
|
||||
|
|
@ -111,8 +117,10 @@ host-side). Best-effort and created on first write
|
|||
(`CREATE TABLE IF NOT EXISTS`), so it's simply absent until a bash
|
||||
task runs.
|
||||
|
||||
`hive-c0re::stats_vacuum` runs hourly and deletes rows older than 90 days
|
||||
(`started_at < cutoff`). Age-only sweep, same pattern as `events_vacuum`.
|
||||
turn-stats.sqlite has **no vacuum** — it's one tiny row per turn
|
||||
(~hundreds of KB even over months), read directly by the `/stats` page
|
||||
and the hive-wide stats view, so pruning it would only lose trend
|
||||
history for no space gain.
|
||||
|
||||
### `/state/hyperhive-harness.json` (per agent)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue