Skip to content

feat: Add outage-detector kit#263

Open
amanbud4530 wants to merge 18 commits into
Lamatic:mainfrom
amanbud4530:add-outage-detector
Open

feat: Add outage-detector kit#263
amanbud4530 wants to merge 18 commits into
Lamatic:mainfrom
amanbud4530:add-outage-detector

Conversation

@amanbud4530

@amanbud4530 amanbud4530 commented Jul 17, 2026

Copy link
Copy Markdown

PR Checklist

1. Select Contribution Type

  • Kit (kits/outage-detector/)

2. General Requirements

  • PR is for one project only (no unrelated changes)
  • No secrets, API keys, or real credentials are committed — .env.example only, .env.local gitignored
  • Folder name uses kebab-case and matches the flow ID (outage-detector)
  • All changes are documented in README.md (purpose, setup, usage, required credentials)

3. File Structure

  • lamatic.config.ts present with valid metadata (name, description, tags, steps, author, envKey)
  • flows/outage-detector.ts present — self-contained flow file (meta + inputs + references + nodes + edges)
  • agent.md and constitutions/default.md present
  • apps/.env.example present with placeholder values only
  • No hand-edited flow node graphs — nodes/edges mirror the real Lamatic Studio export; only prompts and generativeModelName were replaced with @references, as the format requires

4. Validation

  • npm install && npm run dev works locally (confirmed working)
  • PR title is clear: feat: Add outage-detector kit
  • GitHub Actions workflows pass
  • CodeRabbit / reviewer comments addressed — pending review
  • No unrelated files or projects modified
  • Added the complete outage-detector kit configuration, README, agent documentation, default constitution, environment example, and deployment metadata.
  • Added the outage detection flow, including:
    • Trigger node for incoming ticket data.
    • Vector search over historical support tickets.
    • Ticket vectorization and indexing with duplicate overwrite support.
    • Instructor LLM node for root-cause correlation verification.
    • Condition node routing on confidence >= 0.75.
    • Instructor LLM node for internal and customer message drafting.
    • Passthrough branch for unflagged tickets.
    • Response node returning status, confidence, matches, reasoning, and messages.
  • Added model configurations and system/user prompts for correlation verification and response drafting.
  • Added a self-contained Next.js demo app with:
    • Ticket queue UI and submission workflow.
    • Server-side Lamatic flow orchestration.
    • Synthetic ticket dataset.
    • Typed Lamatic client and result models.
    • Tailwind CSS v4 theme, shadcn-style Button component, and class utilities.
    • Next.js, TypeScript, PostCSS, and package configuration.
  • Added environment and generated-file ignore rules, including .env*, .next, node_modules, .vercel, and macOS metadata.
  • Updated prompts and constitution to treat ticket content as untrusted, require exact candidate IDs, validate technical/timing correlation, reject self-inflicted causes, and produce grounded support/customer messaging.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

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

Changes

Outage Detector

Layer / File(s) Summary
Workflow definition
kits/outage-detector/flows/outage-detector.ts, kits/outage-detector/lamatic.config.ts
Defines retrieval, indexing, correlation verification, confidence routing, message drafting, response mapping, and kit deployment metadata.
Correlation and drafting contracts
kits/outage-detector/model-configs/*, kits/outage-detector/prompts/*, kits/outage-detector/constitutions/default.md
Configures model references, matching rules, output schemas, and message-generation requirements.
Demo runtime and flow execution
kits/outage-detector/apps/lib/*, kits/outage-detector/apps/actions/*, kits/outage-detector/apps/package.json, kits/outage-detector/apps/tsconfig.json, kits/outage-detector/apps/public/data/*, kits/outage-detector/apps/.env.example, kits/outage-detector/apps/next.config.mjs, kits/outage-detector/apps/next-env.d.ts, kits/outage-detector/apps/postcss.config.mjs, .gitignore, kits/outage-detector/.gitignore
Adds Lamatic credential validation, workflow execution, typed results, Next.js configuration, synthetic tickets, environment templates, and ignore rules.
Interactive demo interface
kits/outage-detector/apps/app/*, kits/outage-detector/apps/components/ui/button.tsx, kits/outage-detector/apps/lib/utils.ts
Adds the ticket queue, submission flow, result log, conditional output rendering, global styling, and reusable button/class utilities.
Kit documentation
kits/outage-detector/README.md, kits/outage-detector/agent.md
Documents the agent contract, workflow behavior, local demo, credentials, outputs, and known caveats.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the primary change: adding the outage-detector kit.
Description check ✅ Passed The checklist is mostly complete and covers the required sections, including kit type, structure, docs, and validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/outage-detector

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0ada432 and 9ddcc39.

⛔ Files ignored due to path filters (1)
  • kits/outage-detector/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (24)
  • kits/outage-detector/.gitignore
  • kits/outage-detector/README.md
  • kits/outage-detector/agent.md
  • kits/outage-detector/apps/.env.example
  • kits/outage-detector/apps/actions/orchestrate.ts
  • kits/outage-detector/apps/app/globals.css
  • kits/outage-detector/apps/app/layout.tsx
  • kits/outage-detector/apps/app/page.tsx
  • kits/outage-detector/apps/data/synthetic_tickets.json
  • kits/outage-detector/apps/lib/lamatic-client.ts
  • kits/outage-detector/apps/next-env.d.ts
  • kits/outage-detector/apps/next.config.mjs
  • kits/outage-detector/apps/package.json
  • kits/outage-detector/apps/public/data/synthetic_tickets.json
  • kits/outage-detector/apps/tsconfig.json
  • kits/outage-detector/constitutions/default.md
  • kits/outage-detector/flows/outage-detector.ts
  • kits/outage-detector/lamatic.config.ts
  • kits/outage-detector/model-configs/outage-detector_InstructorLLMNode_311.ts
  • kits/outage-detector/model-configs/outage-detector_InstructorLLMNode_837.ts
  • kits/outage-detector/prompts/outage-detector_InstructorLLMNode_311_system.md
  • kits/outage-detector/prompts/outage-detector_InstructorLLMNode_311_user.md
  • kits/outage-detector/prompts/outage-detector_InstructorLLMNode_837_system.md
  • kits/outage-detector/prompts/outage-detector_InstructorLLMNode_837_user.md

Comment thread kits/outage-detector/agent.md Outdated
Comment thread kits/outage-detector/apps/actions/orchestrate.ts
Comment thread kits/outage-detector/apps/app/globals.css
Comment thread kits/outage-detector/apps/app/page.tsx Outdated
Comment thread kits/outage-detector/apps/data/synthetic_tickets.json Outdated
Comment thread kits/outage-detector/constitutions/default.md
Comment thread kits/outage-detector/flows/outage-detector.ts
Comment thread kits/outage-detector/lamatic.config.ts Outdated
Comment thread kits/outage-detector/README.md Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai
coderabbitai Bot requested review from amanintech and d-pamneja July 17, 2026 11:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 value

Interpolate 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 workflowEnvKey extraction 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9eae653 and d115aa8.

📒 Files selected for processing (2)
  • kits/outage-detector/apps/actions/orchestrate.ts
  • kits/outage-detector/apps/lib/lamatic-client.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d115aa8 and 85451f5.

⛔ Files ignored due to path filters (1)
  • kits/outage-detector/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • kits/outage-detector/README.md
  • kits/outage-detector/apps/app/globals.css
  • kits/outage-detector/apps/app/page.tsx
  • kits/outage-detector/apps/components/ui/button.tsx
  • kits/outage-detector/apps/lib/utils.ts
  • kits/outage-detector/apps/package.json
  • kits/outage-detector/apps/postcss.config.mjs
  • kits/outage-detector/constitutions/default.md

Comment thread kits/outage-detector/apps/app/page.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant