refactor: pipeline cleanup — 6 follow-up fixes (#33–#38) #40
No reviewers
Labels
No labels
compliance
demo
deployment
docs
enhancement
parser
patterns
performance
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/turnstone#40
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pipeline-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Six follow-up fixes from the post-implementation code review of the multi-agent diagnose pipeline. Depends on PR #39 (base branch:
feat/29-multi-agent-diagnose).372 tests passing — no regressions.
#33 — MappingProxyType for ClassifiedTimeline.cluster_severities
frozen=Trueonly blocks field reassignment, not mutation of the dict value. Wrapped withMappingProxyTypeinclassifier.pyat construction time so the mapping is truly immutable.#34 — Remove dead suppression branch in synthesizer
_build_hypothesis_block()filters toactive = [rh for rh in ranked if not rh.suppress][:3]. Theif rh.suppress and rh.suppression_reasonbranch was unreachable — alwaysFalse. Replaced with novelty score display.#35 — Shared
_llm_client.pyExtracted
call_llm(),extract_content(), andstrip_json_fences()intoapp/services/diagnose/_llm_client.py. BothRootCauseHypothesizerandSummarySynthesizernow import from one source. Also added JSON fence stripping inhypothesizer._parse_response()— LLMs often return triple-backtick fences despite system prompt instructions.#36 — Per-stage error isolation in pipeline.py
Unhandled stage exceptions previously caused the SSE stream to close silently. Each stage is now wrapped in
try/exceptthat emits{type: 'error'}+{type: 'done'}so the client always receives a terminal event.#37 — format_context_block() in legacy branch only
format_context_block(ctx)was computed unconditionally but only used in the legacy LLM path. Moved inside theif llm_url and llm_model and combined:block.#38 — str() coercion on supporting_cluster_ids
LLMs sometimes return integers instead of strings for cluster IDs. Added
str(x)coercion inhypothesizer._parse_response()to match thetuple[str, ...]type annotation.Files changed
app/services/diagnose/_llm_client.py(new)app/services/diagnose/models.pyapp/services/diagnose/classifier.pyapp/services/diagnose/hypothesizer.pyapp/services/diagnose/synthesizer.pyapp/services/diagnose/pipeline.pyapp/services/diagnose/__init__.pyCloses #33 #34 #35 #36 #37 #38