Rework triage into a robust, structured pipeline#9
Open
trukwava wants to merge 1 commit into
Open
Conversation
Replaces the brittle categorizer, the backwards urgency scorer, and the length-based routing with a single structured AI call plus deterministic safety nets. Problems fixed: - No-API-key white screen: the Groq client was built at module load and threw before React mounted, making the advertised "mock mode" unreachable. Client is now lazy; a missing/failed key degrades to a local heuristic. - Categorization was a free-text prompt at temp 0.7 parsed by substring matching. Now one Groq call with a system prompt, category enum, JSON mode and temp 0, with output validation and safe defaults. - Urgency scored punctuation/length/time-of-day, inverting reality (7/10 sample messages mislabeled; "server down now" -> Low, "thanks!!!" -> High). Rewritten to score business impact, with a critical-signal floor that can never report a clear outage/security/access issue below High. - Routing sent Feature Requests to the billing portal and escalated on message length. Now correct per-category action + owning team, and escalation keyed off urgency/critical signal. Also: input validation, escalation/route-to/confidence in the UI, a heuristic-mode notice, a committed test (npm test, 14/14), and an IMPROVEMENTS.md writeup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Reworks the triage flow to address the three highest-impact issues found while testing the app against
sample-messages.jsonand new examples. Full writeup inIMPROVEMENTS.md.Top 3 issues fixed
temperature 0.7whose category was recovered by substring-matching the model's prose; and because the Groq client was built at module load, a missing key threw before React mounted and white-screened the app, making the README's "mock mode" unreachable."Server down now"→ Low,"Thanks!!!"→ High; weekends/after-hours lowered urgency).message.length > 100and never called, no team assignment.Approach
One structured Groq call (JSON mode,
temperature 0, a real system prompt + urgency rubric) wrapped in deterministic safety nets:High, even on an LLM miss or offline.Verification
npm test→ 14/14 (tests/triage.test.mjs) covering the previously-broken cases.Files
src/utils/llmHelper.js,src/utils/urgencyScorer.js,src/utils/templates.js,src/pages/AnalyzePage.jsx, plustests/,IMPROVEMENTS.md, and atestscript.Worked as a scoping/judgment exercise: problem framing, prioritization, and review by the submitter; execution paired with Claude Code (AI use is permitted by the program).
🤖 Generated with Claude Code