Repository navigation
Description
Problem
The Collector appends to NDJSON forever (append: true in the provisioning repo's otel-collector.yaml). claude-ops ships the pruner, but nothing runs it unless the operator hand-registers a scheduled task.
Evidence (claude-ops 0.63.31)
skills/observability/otel/prune-otel-store.shimplements two-tier retention (CC_OTEL_RETENTION_DAYSdefault 7,CC_OTEL_BODY_RETENTION_DAYSdefault 2,context/operator-setup-retention.md:31-32).- It is reached from
/claude-ops:observability clean(scripts/clean.sh:421-431) and from a Windows Scheduled Task recipe that is "generated from your machine's paths and never committed" (operator-setup-retention.md:86-111,schtasks /create /tn "ClaudeCodeOtelPrune" ...). operator-setup-retention.mdsays to re-register the task after every plugin update because the cache path changes (:97-98). That is fragile in itself, since version dirs change every release (see the cache version directory issue).- The prerequisite is a scoped
SERVICE_STOP | SERVICE_STARTgrant "converged by machine provisioning" (:88-89), so scheduling depends on the provisioning repo. - macOS/Linux: "do not schedule a mutating prune" until provisioning owns an equivalent service (
:113-118). - No probe in
scripts/probe-observability-state.shis known to flag a missing task or an oversized store (not verified; the probe should be read before implementing).
The prune fails on Windows
Observed on Windows with claude-ops 0.63.31, Git Bash and duckdb 1.5.5, so scheduling the task alone does not bound growth:
- With
CC_OTEL_STORE=C:\ProgramData\local-otel\cc-store(Machine scope, as provisioning sets it), awk writes toC:ProgramDatalocal-otelcc-store/cc-logs.json.dropped.tmp: No such file or directory. The backslashes are stripped. - With a forward-slash store path, cold compaction fails:
action=error-compact-failed file=cc-logs.json ... cold compaction failed for cc-logs.json - aborting before trim (original untouched). The duckdb output goes to /dev/null, so the cause is hidden. Please surface duckdb's stderr. - Dry-run works (it would drop 16,418 of 32,518 log lines).
Net: the prune cannot trim this 829 MB store at all. The fix needs backslash-safe store paths (normalize to forward slashes or quote for awk) and visible duckdb errors, in addition to the scheduling work below.
Expected
- The observability probe reports store size versus retention and whether
ClaudeCodeOtelPruneexists and points at an existing script path. A store older than the retention window with no task is a warning with the exactschtaskscommand. - A version-independent entry point: the scheduled task points at a stable launcher (a shim in the plugin data dir that resolves the newest installed plugin), like the statusline shim in context-guard / rate-limit-guard: durable statusline wiring (version-independent shim) #1251 (closed), so the task survives plugin updates without re-registration.
setupoffers to register the task.
Proposed direction
Add the probe first (read-only, cheap), then the stable-launcher change. Separate provisioning-repo issue (not this repo): otel-collector.yaml append: true should get a bounded exporter setting, or provisioning should own the scheduled task and the service-control grant together, so a fresh machine ships with retention on.
Related: #4373 (hook fan-out cost; the store bloat contributes to query time), #199, #1251, #3835.
🤖 Generated with Claude Code
Activity