Skip to content

refactor(dashboard): I1 — move Step-10 auto-escalate classifier into codec_chat_pipeline#167

Merged
AVADSA25 merged 1 commit into
mainfrom
dashboard-route-extraction-7
May 31, 2026
Merged

refactor(dashboard): I1 — move Step-10 auto-escalate classifier into codec_chat_pipeline#167
AVADSA25 merged 1 commit into
mainfrom
dashboard-route-extraction-7

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

Summary

9th wave. Moves the Phase 3 Step 10 auto-escalation classifier cluster out of codec_dashboard.py into codec_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)

Wave After Net
Pre-B6 baseline 3,912
B6 → H1 (#160#166) 1,310 -2,602
I1 (this PR) 1,201 -109

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_project

All re-exported identity-equal from codec_dashboard for 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, so test_chat_escalation.py swaps import codec_dashboard as cdimport codec_chat_pipeline as cd (8 tests). test_dashboard_llm.py's 3 classifier tests are unaffected — they patch codec_llm.call at source, which the re-export honors.

Test plan

  • python3.13 -m pytest --ignore=tests/test_skills.py -q2,055 passed, 77 skipped (was 2,052 in H1; +3 net)
  • 9-name identity-equal re-export verified (new TestI1EscalationExtraction)
  • All 8 escalation monkeypatch tests pass against codec_chat_pipeline
  • test_dashboard_llm codec_llm.call pin updated >=2 → >=1 (classifier moved)
  • ruff check: 0 issues (dropped now-dead import threading from codec_dashboard)
  • python3 -c 'import codec_dashboard': clean

🤖 Generated with Claude Code

…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>
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.

2 participants