add SemIf degeneration watchdog for codegen streams

CodegenClient accepts a per-chat degeneration_check callback polled every
interval chars against the last window chars of content+reasoning (bounded
rolling buffer); a non-None return aborts the stream. build_scheduler wires a
2-option SemIf continue/stop decision (P(stop) >= threshold aborts) recorded
as a trace-only codegen event, degrading to keep-going when the engine is
unavailable.
This commit is contained in:
Denton Social committed 2026-09-24 19:38:01 -05:00
1 parent bd99735283
commit 7c5cd2b685
6 files changed
+302 -11

No files matched your search

+9 -1
View File
@@ -26,7 +26,15 @@
"max_fill_ratio": 0.9,
"warn_fill_ratio": 0.7,
"max_output": 0.85,
"chars_per_token": 4.0
"chars_per_token": 4.0,
"degeneration": {
"_comment": "SemIf degeneration watchdog: while the body streams, a 2-option SemIf decision (continue/stop) is made every `interval` chars against the last `window` chars of content+reasoning (once `min_chars` have accumulated); P(stop) >= threshold aborts the write with a graceful stub. Recorded trace-only (kind `codegen`), never in the decision log. Disabled when no engine is available.",
"enabled": true,
"threshold": 0.9,
"interval": 8000,
"window": 2000,
"min_chars": 4000
}
},
"skill_bodies": "data/skills",
"skills": {