refactor(dashboard): I1 — move Step-10 auto-escalate classifier into codec_chat_pipeline#167
Merged
Merged
Conversation
…ec_chat_pipeline (SR-60)
codec_dashboard.py: 1,310 → 1,201 LOC (-109).
Cumulative since pre-B6 baseline: 3,912 → 1,201 (-69.3%).
The Phase 3 Step 10 auto-escalation classifier cluster (9 names:
_AUTO_ESCALATE_SYSTEM_PROMPT, _qwen_chat_classify, _classify_chat_message,
_AUTOESCALATE_SILENCE_LOCK, _autoescalate_silence_set,
ESCALATE_CHECKPOINTS_THRESHOLD, silence_session_autoescalate,
_reset_autoescalate_silence_for_test, _should_escalate_to_project) moves
verbatim to codec_chat_pipeline.py — its natural home alongside _StepBudget /
_is_conversational. The cluster is latent (no production caller yet; the
chat→project "Promote?" prompt is deferred to Phase 3.5) but test-covered.
codec_dashboard re-exports all 9 names identity-equal for back-compat.
Test surface:
- test_chat_escalation: monkeypatch target swapped codec_dashboard →
codec_chat_pipeline. The functions call each other through the pipeline
module namespace, so patching the in-module chain (_qwen_chat_classify →
_classify_chat_message → _should_escalate_to_project) must target where
they're DEFINED, not the re-export. All 8 monkeypatch tests updated.
- test_dashboard_llm: codec_llm.call count >=2 → >=1 (classifier moved;
only /api/command's Flash fallback remains in codec_dashboard).
- new TestI1EscalationExtraction (3 pins): cluster-in-pipeline, 9-name
identity-equal re-export, dashboard-no-longer-defines.
- drive-by ruff F401: dropped now-unused `import threading` from codec_dashboard
(the only consumer was _AUTOESCALATE_SILENCE_LOCK, which moved).
codec_chat_pipeline gains `import threading` + `import codec_llm` for the
moved code. test_dashboard_llm's 3 _qwen_chat_classify behavior tests are
unaffected (they patch codec_llm.call at source, which the re-export honors).
Full suite: 2,055 passed / 77 skipped (was 2,052 in H1). +3 net.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced May 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
9th wave. Moves the Phase 3 Step 10 auto-escalation classifier cluster out of
codec_dashboard.pyintocodec_chat_pipeline.py— its natural home next to_StepBudget/_is_conversational.This cluster is latent (no production caller yet — the chat→project "Promote to Project mode?" prompt is deferred to Phase 3.5 per CLAUDE.md known gaps) but fully test-covered, so it was dead weight sitting in the dashboard.
LOC reduction (cumulative since pre-B6 baseline)
codec_dashboard.py is now 1,201 LOC — a 69.3% cut from where this refactor began.
What moved (9 names → codec_chat_pipeline.py)
_AUTO_ESCALATE_SYSTEM_PROMPT·_qwen_chat_classify·_classify_chat_message·_AUTOESCALATE_SILENCE_LOCK·_autoescalate_silence_set·ESCALATE_CHECKPOINTS_THRESHOLD·silence_session_autoescalate·_reset_autoescalate_silence_for_test·_should_escalate_to_projectAll re-exported identity-equal from
codec_dashboardfor back-compat.Test note (why one file changed monkeypatch targets)
The classifier functions call each other through the pipeline module namespace (
_qwen_chat_classify→_classify_chat_message→_should_escalate_to_project). Monkeypatching the in-module chain must target where the functions are defined, sotest_chat_escalation.pyswapsimport codec_dashboard as cd→import codec_chat_pipeline as cd(8 tests).test_dashboard_llm.py's 3 classifier tests are unaffected — they patchcodec_llm.callat source, which the re-export honors.Test plan
python3.13 -m pytest --ignore=tests/test_skills.py -q→ 2,055 passed, 77 skipped (was 2,052 in H1; +3 net)TestI1EscalationExtraction)codec_chat_pipelinetest_dashboard_llmcodec_llm.call pin updated>=2 → >=1(classifier moved)ruff check: 0 issues (dropped now-deadimport threadingfrom codec_dashboard)python3 -c 'import codec_dashboard': clean🤖 Generated with Claude Code