Skip to content

feat(monitor): Sprint 21 β€” continuous monitoring mode (P3-5) (v1.11.0) - #13

Merged
wesleyscholl merged 2 commits into
mainfrom
claude/konjo-toki-lkvusj
Jun 21, 2026
Merged

feat(monitor): Sprint 21 β€” continuous monitoring mode (P3-5) (v1.11.0)#13
wesleyscholl merged 2 commits into
mainfrom
claude/konjo-toki-lkvusj

Conversation

@konjoinfinity

Copy link
Copy Markdown
Contributor

Sprint 21 β€” Continuous Monitoring Mode (P3-5) (v1.11.0)

Motivation

P3-5 β€” the last strategic backlog item, unblocked by the P3-2 compliance work. Safety drift happens in production, not at review time: a model behind an endpoint can regress after a deploy, a prompt-template change, or a dependency bump. This wires the Sprint 11 regression gate to a live target β€” probe on a cadence, diff against a frozen baseline, and alert the moment any category regresses beyond tolerance.

What's new β€” toki.monitor (zero external deps)

  • AlertSink ABC + LogSink (WARNING), CollectingSink (in-memory), WebhookSink (stdlib urllib JSON POST; delivery failures logged, never raised β€” a flaky webhook can't crash the loop)
  • MonitorConfig Β· ProbeResult Β· MonitorReport (to_json/save no-overwrite/load)
  • SafetyMonitor β€” probe() runs the generator battery through the real RobustnessEvaluator; establish_baseline() freezes a trusted run; check() diffs via toki.regression.compare and dispatches alerts on regression; run(cycles) for cron-driven cadence; monitor_once() wrapper

Integration

  • CLI: python -m toki monitor --model safe|unsafe|mixed --reference --baseline --tolerance --webhook --seed --output-dir [--json]
  • toki.__init__ exports + __version__ β†’ 1.11.0; pyproject.toml bumped

Live demo

Baseline established from the safe reference; the endpoint then regresses to unsafe β†’ monitor reports overall Ξ” = βˆ’0.90 across 4 categories (worst: boundary) and dispatches the alert. An unchanged endpoint reports status: ok with no alert.

Verification

  • 744/744 Python tests passing (722 prior + new); toki.monitor 100% covered β€” the WebhookSink failure path is exercised offline via a refused 127.0.0.1:1 connection (no external network)
  • ruff check/format clean; vulture clean; all functions ≀ grade B; cargo test green
  • Includes a follow-up fix relocating the monitor CLI tests into python/tests/test_main.py (they were briefly written to a stray repo-root file)
  • PLAN.md + CHANGELOG.md updated; P3-5 closed β€” full P3 backlog cleared

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01WRE1YLhT6aNP4GZT8zbw6q


Generated by Claude Code

claude added 2 commits June 21, 2026 11:39
P3-5, the last strategic backlog item, unblocked by the P3-2 compliance work.
Safety drift happens in production, not at review time β€” a model behind an
endpoint can regress after a deploy or template change. This wires the Sprint 11
regression gate to a live target: probe on a cadence, diff against a frozen
baseline, and alert the moment any category regresses beyond tolerance.

- toki.monitor: AlertSink ABC + LogSink/CollectingSink/WebhookSink (urllib POST,
  failures logged not raised); SafetyMonitor.probe runs the generator battery
  through the real RobustnessEvaluator, establish_baseline freezes a trusted run,
  check() diffs via toki.regression.compare and dispatches alerts on regression,
  run(cycles) for cron-driven cadence; ProbeResult/MonitorReport with
  save/load/to_json; monitor_once wrapper
- CLI: python -m toki monitor --model --reference --baseline --tolerance --webhook
- toki.__init__ exports; version 1.10.0 -> 1.11.0; pyproject bumped
- 25 new tests (22 module + 3 CLI); 741/741 passing; module 100% covered

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WRE1YLhT6aNP4GZT8zbw6q
The Sprint 21 monitor CLI tests were accidentally written to a stray
repo-root tests/test_main.py (wrong working directory) where they were
never collected and lacked the `main` import. Move them into the real
python/tests/test_main.py and remove the stray file.

744/744 tests passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WRE1YLhT6aNP4GZT8zbw6q
@wesleyscholl
wesleyscholl marked this pull request as ready for review June 21, 2026 21:20
@wesleyscholl
wesleyscholl merged commit e1dcfef into main Jun 21, 2026
7 checks passed
@wesleyscholl
wesleyscholl deleted the claude/konjo-toki-lkvusj branch June 21, 2026 21:20
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.

3 participants