Skip to content

fix: 24h stats, blocked filtering, agent install, context timeouts#99

Merged
cyyever merged 5 commits intomainfrom
fix/stats-24h-window
Mar 18, 2026
Merged

fix: 24h stats, blocked filtering, agent install, context timeouts#99
cyyever merged 5 commits intomainfrom
fix/stats-24h-window

Conversation

@cyyever
Copy link
Collaborator

@cyyever cyyever commented Mar 18, 2026

Summary

  • 24h sliding-window stats: add Get24hStats (SQLite) for accurate blocked/total counts independent of in-memory session metrics
  • Server-side blocked filtering: add GetRecentBlockedLogs so GUI can request only blocked events without allowed events pushing them past LIMIT
  • Agent install check: ListAgents now hides agents whose config doesn't exist on the machine, reducing noise in the GUI
  • EnableAgent guard: return error when protection is not running instead of silently failing
  • ClearEvents: add endpoint to delete all tool call logs and reset metrics
  • Context timeouts: add timeouts to all context.Background() database operations to prevent indefinite hangs (5s event logging, 10s span recording/metric seeding, 30s periodic cleanup)
  • CI fuzz timeout: run FuzzInterceptAnthropicResponse standalone with 15s (was 12s parallelized) to avoid deadline-exceeded from rule engine init cost

Test plan

  • go build ./... passes
  • go vet ./... passes
  • Pre-commit hooks pass (gofmt, golangci-lint, nilaway, actionlint, gitleaks, govulncheck, go test)
  • CI green

cyyever added 4 commits March 18, 2026 16:34
The in-memory metrics are seeded at startup and only increment, so
events that age out of the 24h window are still counted. Add a
SQLite-based Get24hStats() query that always returns the accurate
blocked/total counts for the current 24h sliding window.
- Add GetRecentBlockedLogs for SQL-level blocked_only filtering before LIMIT
- Add Get24hStats/ClearAllEvents for accurate sliding-window dashboard stats
- Add GetEvents blocked_only param, GetStats24h/ClearEvents libcrust exports
- Add Installed() to Target interface to filter uninstalled agents from ListAgents
- Guard EnableAgent against port 0 when protection is not running
Rule engine initialization (shell workers) consumes startup time that
can exceed 12s under CPU contention. Run standalone with 15s budget.
- record.go: 5s timeout for event logging
- telemetry.go: 10s timeout for span recording
- manager.go: 10s timeout for startup metric seeding, 30s for cleanup
@cyyever cyyever changed the title fix: 24h stats, blocked filtering, agent install check, fuzz timeout fix: 24h stats, blocked filtering, agent install, context timeouts Mar 18, 2026
@cyyever cyyever merged commit 175a159 into main Mar 18, 2026
16 checks passed
@cyyever cyyever deleted the fix/stats-24h-window branch March 18, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant