feat: Add outage-detector kit#263
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds the Outage Detector Lamatic flow, correlation and drafting prompts, typed server execution, a Next.js demo with synthetic tickets, kit configuration, environment setup, and documentation. ChangesOutage Detector
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/outage-detector/agent.md`:
- Around line 25-26: Update the incoming-ticket indexing description to state
that every ticket is indexed into the shared `support-tickets` vector store
configured by the outage-detector flow, removing the implication that each
ticket uses its own isolated store.
In `@kits/outage-detector/apps/actions/orchestrate.ts`:
- Around line 3-5: Move configuration extraction into processTicket in
kits/outage-detector/apps/actions/orchestrate.ts: import ../../lamatic.config,
resolve the step definition and workflowEnvKey, derive workflowId, and pass it
to submitTicket. In kits/outage-detector/apps/lib/lamatic-client.ts, remove
config parsing and environment extraction, and update submitTicket to accept the
resolved workflowId parameter.
In `@kits/outage-detector/apps/app/globals.css`:
- Around line 5-116: Extract the repeated static color values in the global
selectors, buttons, panels, badges, and detail text into descriptive CSS custom
properties declared under :root, then replace each hardcoded color with the
corresponding variable while preserving the current appearance and layout.
In `@kits/outage-detector/apps/app/page.tsx`:
- Around line 38-110: Refactor the Outage Detector page’s JSX to use Tailwind
CSS v4+ utility classes instead of static classes such as container, grid,
panel, and ticket-row, and replace the raw button in the stepForward flow with
the shadcn/ui Button component. Preserve the existing ticket queue, submission
state, log rendering, and conditional output behavior while applying shadcn
components where appropriate.
In `@kits/outage-detector/apps/data/synthetic_tickets.json`:
- Around line 1-19: Remove the duplicate synthetic_tickets.json payload from the
kits/outage-detector location, update any README or mission instructions that
reference it to use the canonical public/data asset, and ensure the Next.js
frontend relies exclusively on that public drop-zone file.
In `@kits/outage-detector/apps/package.json`:
- Around line 10-15: Add the mandated Next.js app dependencies to the
dependencies manifest: Tailwind CSS v4 or newer, shadcn/ui component support,
react-hook-form, zod, and lucide-react, while preserving the existing Next.js
and React versions.
In `@kits/outage-detector/constitutions/default.md`:
- Around line 3-21: Update the constitutions’ outage-analysis rules to
explicitly treat raw customer tickets and historical records as untrusted data,
requiring agents to ignore any instructions or directives embedded within them.
Preserve the existing classification and messaging requirements while ensuring
ticket content can only provide factual evidence, not alter agent behavior.
In `@kits/outage-detector/flows/outage-detector.ts`:
- Around line 338-343: Update the condition represented by value
"conditionNode_526-addNode_838" to require the verdict field same_root_cause to
equal true in addition to confidence being at least 0.75. Also require
matched_ticket_ids to be non-empty if that field is available, while preserving
the existing flagged-branch routing for valid matches.
In `@kits/outage-detector/lamatic.config.ts`:
- Line 14: Update the deploy URL in the Lamatic configuration to clone from the
canonical Lamatic/AgentKit repository instead of amanbud4530/AgentKit, while
preserving the existing root directory and environment parameters.
In `@kits/outage-detector/prompts/outage-detector_InstructorLLMNode_837_user.md`:
- Around line 1-4: Update the prompt using InstructorLLMNode_311.output to
include the candidate ticket records alongside matched_ticket_ids, and instruct
the drafting agent to derive impacted accounts only from records whose IDs are
listed in matched_ticket_ids. Preserve the existing suspected component,
reasoning, and new-ticket inputs.
In `@kits/outage-detector/README.md`:
- Around line 24-33: Add a language identifier, such as text, to the opening
fenced code block containing the API Trigger flow diagram in the README, leaving
the diagram content unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: a52182a6-b2b3-4abd-9dbb-8f4692698769
⛔ Files ignored due to path filters (1)
kits/outage-detector/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (24)
kits/outage-detector/.gitignorekits/outage-detector/README.mdkits/outage-detector/agent.mdkits/outage-detector/apps/.env.examplekits/outage-detector/apps/actions/orchestrate.tskits/outage-detector/apps/app/globals.csskits/outage-detector/apps/app/layout.tsxkits/outage-detector/apps/app/page.tsxkits/outage-detector/apps/data/synthetic_tickets.jsonkits/outage-detector/apps/lib/lamatic-client.tskits/outage-detector/apps/next-env.d.tskits/outage-detector/apps/next.config.mjskits/outage-detector/apps/package.jsonkits/outage-detector/apps/public/data/synthetic_tickets.jsonkits/outage-detector/apps/tsconfig.jsonkits/outage-detector/constitutions/default.mdkits/outage-detector/flows/outage-detector.tskits/outage-detector/lamatic.config.tskits/outage-detector/model-configs/outage-detector_InstructorLLMNode_311.tskits/outage-detector/model-configs/outage-detector_InstructorLLMNode_837.tskits/outage-detector/prompts/outage-detector_InstructorLLMNode_311_system.mdkits/outage-detector/prompts/outage-detector_InstructorLLMNode_311_user.mdkits/outage-detector/prompts/outage-detector_InstructorLLMNode_837_system.mdkits/outage-detector/prompts/outage-detector_InstructorLLMNode_837_user.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/outage-detector/apps/actions/orchestrate.ts (1)
6-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueInterpolate the workflow environment key dynamically.
Agent, our intel reveals a slight vulnerability in your fallback protocols. By hardcoding "OUTAGE_DETECTOR" in your error reasoning string, you risk sending field operatives on a wild goose chase if headquarters ever reassigns the environment key in the configuration.
Your mission, should you choose to accept it, is to hoist the
workflowEnvKeyextraction out of the try block and dynamically interpolate it into the fallback reasoning string. This ensures our operatives are always inspecting the correct assets.This message will self-destruct in five seconds.
🕶️ Proposed mission directives (fix)
-export async function processTicket(ticket: TicketPayload): Promise<FlowResult> { - try { - const step = lamaticConfig.steps.find((s) => s.id === "outage-detector"); - const workflowEnvKey = step?.envKey ?? "OUTAGE_DETECTOR"; - const workflowId = process.env[workflowEnvKey]; +export async function processTicket(ticket: TicketPayload): Promise<FlowResult> { + const step = lamaticConfig.steps.find((s) => s.id === "outage-detector"); + const workflowEnvKey = step?.envKey ?? "OUTAGE_DETECTOR"; + + try { + const workflowId = process.env[workflowEnvKey]; if (!workflowId) { throw new Error( `Workflow ID environment variable "${workflowEnvKey}" is not set. Please add it to your .env.local file.` ); } return await submitTicket(ticket, workflowId); } catch (err) { console.error("Flow execution failed:", err); return { status: "Else", confidence: 0, matched_ticket_ids: [], suspected_component: "unknown", reasoning: - "Flow call failed — check OUTAGE_DETECTOR, LAMATIC_API_KEY, LAMATIC_PROJECT_ID, and LAMATIC_API_URL in .env.local", + `Flow call failed — check ${workflowEnvKey}, LAMATIC_API_KEY, LAMATIC_PROJECT_ID, and LAMATIC_API_URL in .env.local`,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/outage-detector/apps/actions/orchestrate.ts` around lines 6 - 27, Move the workflowEnvKey extraction before the try block in processTicket so it remains available to the catch fallback, then interpolate workflowEnvKey in the returned reasoning instead of hardcoding "OUTAGE_DETECTOR". Preserve the existing configuration lookup and error-handling behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@kits/outage-detector/apps/actions/orchestrate.ts`:
- Around line 6-27: Move the workflowEnvKey extraction before the try block in
processTicket so it remains available to the catch fallback, then interpolate
workflowEnvKey in the returned reasoning instead of hardcoding
"OUTAGE_DETECTOR". Preserve the existing configuration lookup and error-handling
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2e2a586b-3c4a-43b3-952f-b3309aaa2c28
📒 Files selected for processing (2)
kits/outage-detector/apps/actions/orchestrate.tskits/outage-detector/apps/lib/lamatic-client.ts
…hook-form, zod, lucide-react)
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/outage-detector/apps/app/page.tsx`:
- Around line 53-64: Update the ticket highlighting condition in the tickets
slice map so it identifies the active ticket based on the current index and
slice start, including the index = 0 case. Replace the hardcoded i === 1 logic
in the tickets.map rendering while preserving the existing slice range and
styling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7fd26594-65cd-4ba9-a758-8f217bef4707
⛔ Files ignored due to path filters (1)
kits/outage-detector/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (8)
kits/outage-detector/README.mdkits/outage-detector/apps/app/globals.csskits/outage-detector/apps/app/page.tsxkits/outage-detector/apps/components/ui/button.tsxkits/outage-detector/apps/lib/utils.tskits/outage-detector/apps/package.jsonkits/outage-detector/apps/postcss.config.mjskits/outage-detector/constitutions/default.md
PR Checklist
1. Select Contribution Type
kits/outage-detector/)2. General Requirements
.env.exampleonly,.env.localgitignoredkebab-caseand matches the flow ID (outage-detector)README.md(purpose, setup, usage, required credentials)3. File Structure
lamatic.config.tspresent with valid metadata (name, description, tags, steps, author, envKey)flows/outage-detector.tspresent — self-contained flow file (meta + inputs + references + nodes + edges)agent.mdandconstitutions/default.mdpresentapps/.env.examplepresent with placeholder values onlygenerativeModelNamewere replaced with@references, as the format requires4. Validation
npm install && npm run devworks locally (confirmed working)feat: Add outage-detector kitoutage-detectorkit configuration, README, agent documentation, default constitution, environment example, and deployment metadata.confidence >= 0.75..env*,.next,node_modules,.vercel, and macOS metadata.