Skip to content

feat: scaffold SRE incident postmortem agent kit#180

Open
Savanjadav wants to merge 6 commits into
Lamatic:mainfrom
Savanjadav:feat/sre-incident-postmortem-agent
Open

feat: scaffold SRE incident postmortem agent kit#180
Savanjadav wants to merge 6 commits into
Lamatic:mainfrom
Savanjadav:feat/sre-incident-postmortem-agent

Conversation

@Savanjadav

@Savanjadav Savanjadav commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Adds the SRE Incident Postmortem Agent kit, a Lamatic-powered Next.js app that helps engineering teams convert messy incident notes, alerts, logs, symptoms, and timeline updates into a structured blameless incident postmortem.

Problem

Incident details are often scattered across monitoring alerts, logs, Slack updates, deployment notes, and manual observations. This makes post-incident documentation slow, inconsistent, and easy to miss.

Solution

This kit provides a runnable app and Lamatic flow that generates:

  • Severity classification
  • Executive summary
  • Suspected root cause
  • Incident timeline
  • Customer/business impact
  • Immediate remediation steps
  • Long-term prevention actions
  • Owner follow-ups
  • Markdown postmortem report

Contribution Type

Kit: Lamatic flow + runnable Next.js app.

Validation

  • npm install
  • npm run lint
  • Flow TypeScript syntax validation passed
  • npm run type-check
  • npm run build

Checklist

  • Added contribution under kits/sre-incident-postmortem-agent
  • Added Lamatic flow export
  • Added lamatic.config.ts
  • Added agent.md
  • Added README.md
  • Added constitutions/default.md
  • Added runnable Next.js app under apps/
  • Added .env.example
  • No secrets committed
  • Added new kit: kits/sre-incident-postmortem-agent/
    • Config/usage/docs:
      • kits/sre-incident-postmortem-agent/lamatic.config.ts
      • kits/sre-incident-postmortem-agent/README.md
      • kits/sre-incident-postmortem-agent/agent.md
      • kits/sre-incident-postmortem-agent/constitutions/default.md
      • kits/sre-incident-postmortem-agent/.env.example
      • kits/sre-incident-postmortem-agent/.gitignore
    • Lamatic flow + model/prompt:
      • kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts
      • kits/sre-incident-postmortem-agent/model-configs/sre-incident-postmortem-agent_postmortem-generator.ts
      • kits/sre-incident-postmortem-agent/prompts/sre-incident-postmortem-agent_postmortem-generator_system.md
      • Flow node types introduced (from flows/sre-incident-postmortem-agent.ts):
        • triggerNode (triggerNode_1): GraphQL “API Request” trigger; advance_schema accepts service_name, incident_title, alert_details, logs_or_symptoms, timeline_notes, impact_description, current_status
        • dynamicNode (InstructorLLMNode_1): Instructor-style LLM node producing strict JSON with required keys: severity, executive_summary, suspected_root_cause, timeline[], customer_impact, immediate_remediation, long_term_prevention[], owner_followups[], markdown_postmortem
        • responseNode (responseNode_triggerNode_1): GraphQL “API Response” node mapping LLM output into { "postmortem": "<LLM output>" }
      • High-level flow wiring:
        • triggerNode_1InstructorLLMNode_1responseNode_triggerNode_1, with the user prompt templated from the trigger outputs and the response returning the generated postmortem.
  • Added runnable Next.js app: kits/sre-incident-postmortem-agent/apps/
    • App config/docs:
      • kits/sre-incident-postmortem-agent/apps/README.md
      • kits/sre-incident-postmortem-agent/apps/package.json
      • kits/sre-incident-postmortem-agent/apps/package-lock.json
      • kits/sre-incident-postmortem-agent/apps/tsconfig.json
      • kits/sre-incident-postmortem-agent/apps/next.config.mjs
      • kits/sre-incident-postmortem-agent/apps/next-env.d.ts
      • kits/sre-incident-postmortem-agent/apps/postcss.config.mjs
      • kits/sre-incident-postmortem-agent/apps/tailwind.config.ts
      • kits/sre-incident-postmortem-agent/apps/.env.example
      • kits/sre-incident-postmortem-agent/apps/.eslintrc.json
      • kits/sre-incident-postmortem-agent/apps/.gitignore
    • UI/pages:
      • kits/sre-incident-postmortem-agent/apps/app/layout.tsx
      • kits/sre-incident-postmortem-agent/apps/app/page.tsx
      • kits/sre-incident-postmortem-agent/apps/app/globals.css
      • kits/sre-incident-postmortem-agent/apps/components/ui/button.tsx
      • kits/sre-incident-postmortem-agent/apps/components/ui/input.tsx
      • kits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsx
    • Server logic/types:
      • kits/sre-incident-postmortem-agent/apps/actions/orchestrate.ts
      • kits/sre-incident-postmortem-agent/apps/lib/types.ts
      • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
      • kits/sre-incident-postmortem-agent/apps/lib/utils.ts

@coderabbitai

coderabbitai Bot commented Jun 28, 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 a new SRE postmortem kit with a Lamatic flow, server action and typed client, a Next.js UI for incident intake and generated output, plus documentation and configuration for setup and deployment.

Changes

SRE Incident Postmortem Agent Kit

Layer / File(s) Summary
Agent constitution, prompt, and flow definition
kits/sre-incident-postmortem-agent/constitutions/default.md, kits/sre-incident-postmortem-agent/prompts/...system.md, kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts, kits/sre-incident-postmortem-agent/model-configs/...ts
Defines blameless guardrails in the constitution, enforces structured JSON output in the system prompt, and wires a Lamatic flow with GraphQL trigger, LLM node, response node, metadata, inputs, and edges.
TypeScript types and Lamatic GraphQL client
kits/sre-incident-postmortem-agent/apps/lib/types.ts, kits/sre-incident-postmortem-agent/apps/lib/utils.ts, kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
Declares the incident input, postmortem, response, and GraphQL response interfaces, adds the class-name utility, and implements Lamatic request execution plus strict postmortem validation.
Server action: generatePostmortem
kits/sre-incident-postmortem-agent/apps/actions/orchestrate.ts
Adds input trimming, required-field validation, kit-step lookup for the workflow env key, and structured success or error responses around postmortem generation.
Next.js page, layout, and global styles
kits/sre-incident-postmortem-agent/apps/app/layout.tsx, kits/sre-incident-postmortem-agent/apps/app/globals.css, kits/sre-incident-postmortem-agent/apps/components/ui/button.tsx, kits/sre-incident-postmortem-agent/apps/components/ui/input.tsx, kits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsx, kits/sre-incident-postmortem-agent/apps/app/page.tsx
Adds the root layout, global Tailwind baseline styles, reusable button/input/textarea UI components, and the client page with the intake form, loading and empty states, generated postmortem rendering, and markdown copy flow.
Kit config, project scaffolding, and docs
kits/sre-incident-postmortem-agent/lamatic.config.ts, kits/sre-incident-postmortem-agent/apps/package.json, kits/sre-incident-postmortem-agent/apps/next.config.mjs, kits/sre-incident-postmortem-agent/apps/next-env.d.ts, kits/sre-incident-postmortem-agent/apps/tsconfig.json, kits/sre-incident-postmortem-agent/apps/tailwind.config.ts, kits/sre-incident-postmortem-agent/apps/postcss.config.mjs, kits/sre-incident-postmortem-agent/apps/.eslintrc.json, kits/sre-incident-postmortem-agent/.env.example, kits/sre-incident-postmortem-agent/.gitignore, kits/sre-incident-postmortem-agent/apps/.env.example, kits/sre-incident-postmortem-agent/apps/.gitignore, kits/sre-incident-postmortem-agent/README.md, kits/sre-incident-postmortem-agent/agent.md, kits/sre-incident-postmortem-agent/apps/README.md
Adds kit metadata, package and tooling configuration, environment and ignore files, TypeScript and Tailwind setup, and the README and agent documentation for the kit and app.

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 0.00% 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 main change: scaffolding the SRE incident postmortem agent kit.
Description check ✅ Passed The description covers summary, problem, solution, contribution type, validation, and a checklist, with only some template-specific details missing.
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

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/sre-incident-postmortem-agent

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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/sre-incident-postmortem-agent/apps/postcss.config.mjs (1)

1-9: 📐 Maintainability & Code Quality | 🟠 Major

Tailwind CSS v3.4.17 does not meet the v4+ requirement.

The coding guidelines require Tailwind CSS v4+ for kit Next.js apps. The current package.json and lockfile resolve to v3.4.17. Upgrade to Tailwind CSS v4 and update the PostCSS configuration accordingly (v4 typically uses @tailwindcss/postcss instead of the tailwindcss plugin). As per coding guidelines, kit Next.js apps must use Tailwind CSS v4+.

🤖 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/sre-incident-postmortem-agent/apps/postcss.config.mjs` around lines 1 -
9, Tailwind is still configured for v3 in the PostCSS setup, but this kit
Next.js app must use Tailwind CSS v4+. Update the project dependencies in
package.json and the lockfile to resolve Tailwind v4, then adjust
postcss.config.mjs to use the v4 PostCSS plugin setup (use `@tailwindcss/postcss`
instead of the tailwindcss plugin) while keeping autoprefixer as needed. Verify
the app’s build and styles still load correctly after the config change.

Source: Coding guidelines

🤖 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/sre-incident-postmortem-agent/apps/actions/orchestrate.ts`:
- Around line 3-4: The orchestration action is still relying on an env-resolved
workflow path instead of the parent kit config. Update the `orchestrate` action
to import and use `../../lamatic.config` directly, and route
`executePostmortemFlow` (or its caller in `orchestrate.ts`) through the
config-backed step definitions rather than `SRE_POSTMORTEM_FLOW_ID`. Make sure
the `executePostmortemFlow` call path and any related
`GeneratePostmortemResponse` / `IncidentInput` handling use the kit’s config
source so the app always invokes the correct flow.

In `@kits/sre-incident-postmortem-agent/apps/app/globals.css`:
- Around line 5-20: The global theme values in the stylesheet are still
hard-coded in the body rules, so update the app to use CSS variables for the
theme tokens instead. Define the background and foreground colors as variables
in :root and then have body consume those variables, keeping the existing
globals.css structure and the body selector as the main place to swap in
token-based styling.
- Around line 1-3: The global styles are still hard-coding body background and
text colors instead of using the kit theme variables. Update the body styling in
globals.css to use the existing CSS custom properties for background and
foreground so it follows the app’s theme convention, and keep the change
localized to the global stylesheet.

In `@kits/sre-incident-postmortem-agent/apps/app/page.tsx`:
- Around line 157-169: The submit flow in page.tsx can leave isLoading stuck on
when generatePostmortem(incident) throws before returning a response. Update the
submit function to wrap the action call in try/catch/finally, keep the existing
success/error handling for GeneratePostmortemResponse, and ensure
setIsLoading(false) always runs in the finally block even on invocation
failures.
- Around line 127-275: The Home intake flow is still managing form state
manually with useState, updateField, and raw input/textarea controls; refactor
it to the kit-standard react-hook-form plus zod setup used elsewhere. Replace
the incident state and canSubmit logic in Home with a typed form schema, wire
fields through form methods instead of incident[field.key], and swap the native
controls for shadcn/ui form components so validation, disabled submit, load
sample, and clear actions all flow through the form stack.

In `@kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts`:
- Around line 56-77: The validatePostmortem helper is coercing missing or
renamed Lamatic fields into empty strings or arrays, which hides malformed
payloads. Update validatePostmortem in lamatic-client.ts to fail fast when
required Postmortem fields are absent or have the wrong shape instead of
normalizing them, and throw a clear error before returning. Keep the check
centralized in validatePostmortem so the Lamatic client and server action only
succeed with a complete, valid postmortem payload.
- Around line 87-129: The Lamatic request flow in lamatic-client.ts should fail
fast on workflow execution status and not rely on validation to expose upstream
errors. In the function that performs the fetch and parses the GraphQL response,
inspect parsed.data.executeWorkflow.status before calling validatePostmortem,
and throw a clear error when it is not a success state so callers see the real
Lamatic failure. Also add a request timeout around the fetch call in this same
path so hung requests do not block indefinitely, and preserve the existing
response/error parsing behavior in the LamaticGraphQLResponse handling.

In `@kits/sre-incident-postmortem-agent/apps/package.json`:
- Around line 13-31: The app dependency baseline is still incomplete in
package.json, with tailwindcss pinned to the older version and lamatic missing.
Update the dependencies in the apps package manifest to use the required
Tailwind v4+ setup, add lamatic alongside the existing app dependencies, and
then refresh the lockfile so the resolved versions match the new baseline.

---

Outside diff comments:
In `@kits/sre-incident-postmortem-agent/apps/postcss.config.mjs`:
- Around line 1-9: Tailwind is still configured for v3 in the PostCSS setup, but
this kit Next.js app must use Tailwind CSS v4+. Update the project dependencies
in package.json and the lockfile to resolve Tailwind v4, then adjust
postcss.config.mjs to use the v4 PostCSS plugin setup (use `@tailwindcss/postcss`
instead of the tailwindcss plugin) while keeping autoprefixer as needed. Verify
the app’s build and styles still load correctly after the config change.
🪄 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: a8473d35-366a-43dc-b591-3393e34b5921

📥 Commits

Reviewing files that changed from the base of the PR and between 745c94a and a7d9fab.

⛔ Files ignored due to path filters (1)
  • kits/sre-incident-postmortem-agent/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (26)
  • kits/sre-incident-postmortem-agent/.env.example
  • kits/sre-incident-postmortem-agent/.gitignore
  • kits/sre-incident-postmortem-agent/README.md
  • kits/sre-incident-postmortem-agent/agent.md
  • kits/sre-incident-postmortem-agent/apps/.env.example
  • kits/sre-incident-postmortem-agent/apps/.eslintrc.json
  • kits/sre-incident-postmortem-agent/apps/.gitignore
  • kits/sre-incident-postmortem-agent/apps/README.md
  • kits/sre-incident-postmortem-agent/apps/actions/orchestrate.ts
  • kits/sre-incident-postmortem-agent/apps/app/globals.css
  • kits/sre-incident-postmortem-agent/apps/app/layout.tsx
  • kits/sre-incident-postmortem-agent/apps/app/page.tsx
  • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
  • kits/sre-incident-postmortem-agent/apps/lib/types.ts
  • kits/sre-incident-postmortem-agent/apps/lib/utils.ts
  • kits/sre-incident-postmortem-agent/apps/next-env.d.ts
  • kits/sre-incident-postmortem-agent/apps/next.config.mjs
  • kits/sre-incident-postmortem-agent/apps/package.json
  • kits/sre-incident-postmortem-agent/apps/postcss.config.mjs
  • kits/sre-incident-postmortem-agent/apps/tailwind.config.ts
  • kits/sre-incident-postmortem-agent/apps/tsconfig.json
  • kits/sre-incident-postmortem-agent/constitutions/default.md
  • kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts
  • kits/sre-incident-postmortem-agent/lamatic.config.ts
  • kits/sre-incident-postmortem-agent/model-configs/sre-incident-postmortem-agent_postmortem-generator.ts
  • kits/sre-incident-postmortem-agent/prompts/sre-incident-postmortem-agent_postmortem-generator_system.md

Comment thread kits/sre-incident-postmortem-agent/apps/actions/orchestrate.ts
Comment thread kits/sre-incident-postmortem-agent/apps/app/globals.css Outdated
Comment thread kits/sre-incident-postmortem-agent/apps/app/globals.css
Comment thread kits/sre-incident-postmortem-agent/apps/app/page.tsx Outdated
Comment thread kits/sre-incident-postmortem-agent/apps/app/page.tsx Outdated
Comment thread kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
Comment thread kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts Outdated
Comment thread kits/sre-incident-postmortem-agent/apps/package.json

@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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
kits/sre-incident-postmortem-agent/apps/app/page.tsx (2)

199-206: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Mission: trap clipboard failures instead of letting the handler reject.

If navigator.clipboard.writeText(...) fails, this async click handler rejects with no user feedback. Wrap the write in try/catch and surface a copy-specific error so the button does not fail silently.

Possible fix
   const copyMarkdown = async () => {
     if (!postmortem?.markdown_postmortem) {
       return;
     }

-    await navigator.clipboard.writeText(postmortem.markdown_postmortem);
-    setCopied(true);
-    window.setTimeout(() => setCopied(false), 1800);
+    try {
+      await navigator.clipboard.writeText(postmortem.markdown_postmortem);
+      setCopied(true);
+      window.setTimeout(() => setCopied(false), 1800);
+    } catch {
+      setError("Unable to copy the Markdown postmortem.");
+    }
   };

Also applies to: 384-395

🤖 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/sre-incident-postmortem-agent/apps/app/page.tsx` around lines 199 - 206,
The copy handler in copyMarkdown currently awaits
navigator.clipboard.writeText(...) without handling failures, so the async click
action can reject silently. Update copyMarkdown (and the matching copy flow at
the other mentioned location) to wrap the clipboard write in try/catch, keep
setCopied(true) and the timeout only on success, and surface a copy-specific
error state or message when the write fails so the button gives feedback instead
of failing silently.

211-229: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Mission: swap the hard-coded palette for CSS-variable-backed tokens.

This screen still hard-codes a large slate/teal palette (bg-white, text-slate-*, border-slate-*, bg-teal-*, etc.), so it bypasses the theme variables introduced in kits/sre-incident-postmortem-agent/apps/app/globals.css. That also leaks into the shared primitives used here. As per coding guidelines, "kits/*/apps/**/*.{ts,tsx,css}: For kit Next.js apps: use CSS variables for styling and import the lamatic npm package for SDK integration`."

Also applies to: 235-399

🤖 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/sre-incident-postmortem-agent/apps/app/page.tsx` around lines 211 - 229,
The page UI in this `Page` component still uses hard-coded `slate`/`teal`
Tailwind colors instead of the theme CSS variables defined in globals, so
replace those palette classes with the CSS-variable-backed tokens throughout
this screen. Update the affected markup in the main layout/header and any shared
primitives used by this page to keep styling consistent with the kit theme. Keep
the changes localized to the `Page` render structure and preserve the existing
visual hierarchy while swapping color utilities for theme-driven ones.

Source: Coding guidelines

🤖 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/sre-incident-postmortem-agent/apps/app/page.tsx`:
- Around line 175-195: The postmortem result from submit() is applied without
checking whether the form inputs changed while the request was in flight, so
stale responses can overwrite the current visible state. Fix this in page.tsx by
freezing the form during generatePostmortem submission or by versioning the
request in submit() so only the latest in-flight generation can update
setPostmortem/setError. Also make the related form actions (sample load and
clear handlers in the same component) respect isLoading so users cannot mutate
the form until the current generation completes.

In `@kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts`:
- Around line 117-148: Keep the Lamatic request timeout active until the
response body is fully read, not just until fetch() resolves. In
lamatic-client.ts, the AbortController and timer around the request should cover
both the fetch call and the subsequent response.text() read, so a stalled body
still aborts; clear the timeout only after response.text() completes and
preserve the existing AbortError handling in the request flow.
- Around line 104-138: The fetch-based implementation in executePostmortemFlow
is duplicating kit-level Lamatic concerns; switch this flow to use the lamatic
package SDK instead of calling fetch directly. Keep the existing input and
workflowEnvKey handling in executePostmortemFlow, but delegate
endpoint/auth/timeout/workflow execution to the SDK so the app stays aligned
with the integration contract and remove the local request-building logic.

---

Outside diff comments:
In `@kits/sre-incident-postmortem-agent/apps/app/page.tsx`:
- Around line 199-206: The copy handler in copyMarkdown currently awaits
navigator.clipboard.writeText(...) without handling failures, so the async click
action can reject silently. Update copyMarkdown (and the matching copy flow at
the other mentioned location) to wrap the clipboard write in try/catch, keep
setCopied(true) and the timeout only on success, and surface a copy-specific
error state or message when the write fails so the button gives feedback instead
of failing silently.
- Around line 211-229: The page UI in this `Page` component still uses
hard-coded `slate`/`teal` Tailwind colors instead of the theme CSS variables
defined in globals, so replace those palette classes with the
CSS-variable-backed tokens throughout this screen. Update the affected markup in
the main layout/header and any shared primitives used by this page to keep
styling consistent with the kit theme. Keep the changes localized to the `Page`
render structure and preserve the existing visual hierarchy while swapping color
utilities for theme-driven ones.
🪄 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: db5562f5-04f0-48c4-8a39-a26f4fbe6898

📥 Commits

Reviewing files that changed from the base of the PR and between a7d9fab and 3893a96.

⛔ Files ignored due to path filters (1)
  • kits/sre-incident-postmortem-agent/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • kits/sre-incident-postmortem-agent/apps/actions/orchestrate.ts
  • kits/sre-incident-postmortem-agent/apps/app/globals.css
  • kits/sre-incident-postmortem-agent/apps/app/page.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/button.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/input.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsx
  • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
  • kits/sre-incident-postmortem-agent/apps/package.json
  • kits/sre-incident-postmortem-agent/apps/postcss.config.mjs

Comment thread kits/sre-incident-postmortem-agent/apps/app/page.tsx
Comment thread kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts Outdated
Comment thread kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts Outdated

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts (1)

107-120: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mission: make the flow output contract say one thing.

Line 108 declares a wrapped { "postmortem": { ... } } payload with immediate_remediation as a string, but Line 120 tells the model to return an unwrapped object and makes immediate_remediation an array. apps/lib/lamatic-client.ts later reads execution.result.postmortem, and apps/lib/types.ts requires immediate_remediation: string, so this split can turn into response-node mapping failures or downstream validation errors.

Suggested contract-alignment patch
-        schema:
-          '{\n  "type": "object",\n  "properties": {\n    "postmortem": {\n      "type": "object",\n      "properties": {\n        "severity": { "type": "string" },\n        "executive_summary": { "type": "string" },\n        "suspected_root_cause": { "type": "string" },\n        "timeline": { "type": "array", "items": { "type": "string" } },\n        "customer_impact": { "type": "string" },\n        "immediate_remediation": { "type": "string" },\n        "long_term_prevention": { "type": "array", "items": { "type": "string" } },\n        "owner_followups": { "type": "array", "items": { "type": "string" } },\n        "markdown_postmortem": { "type": "string" }\n      }\n    }\n  }\n}',
+        schema:
+          '{\n  "type": "object",\n  "required": ["postmortem"],\n  "additionalProperties": false,\n  "properties": {\n    "postmortem": {\n      "type": "object",\n      "required": ["severity", "executive_summary", "suspected_root_cause", "timeline", "customer_impact", "immediate_remediation", "long_term_prevention", "owner_followups", "markdown_postmortem"],\n      "additionalProperties": false,\n      "properties": {\n        "severity": { "type": "string" },\n        "executive_summary": { "type": "string" },\n        "suspected_root_cause": { "type": "string" },\n        "timeline": { "type": "array", "items": { "type": "string" } },\n        "customer_impact": { "type": "string" },\n        "immediate_remediation": { "type": "string" },\n        "long_term_prevention": { "type": "array", "items": { "type": "string" } },\n        "owner_followups": { "type": "array", "items": { "type": "string" } },\n        "markdown_postmortem": { "type": "string" }\n      }\n    }\n  }\n}',
@@
-Return valid JSON only with exactly these keys:
+Return valid JSON only with exactly this shape:
 
 {
-  "severity": "string",
-  "executive_summary": "string",
-  "suspected_root_cause": "string",
-  "timeline": ["string"],
-  "customer_impact": "string",
-  "immediate_remediation": ["string"],
-  "long_term_prevention": ["string"],
-  "owner_followups": ["string"],
-  "markdown_postmortem": "string"
+  "postmortem": {
+    "severity": "string",
+    "executive_summary": "string",
+    "suspected_root_cause": "string",
+    "timeline": ["string"],
+    "customer_impact": "string",
+    "immediate_remediation": "string",
+    "long_term_prevention": ["string"],
+    "owner_followups": ["string"],
+    "markdown_postmortem": "string"
+  }
 }
🤖 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/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts`
around lines 107 - 120, The postmortem flow contract is inconsistent between the
schema and the prompt: the schema in sre-incident-postmortem-agent.ts expects a
wrapped postmortem object and defines immediate_remediation as a string, while
the user prompt asks for an unwrapped object and makes immediate_remediation an
array. Update the schema and prompt to match one shape consistently, and align
the field types with the downstream expectations in lamatic-client.ts and
types.ts so execution.result.postmortem maps cleanly without validation or
parsing issues.
🤖 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/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts`:
- Around line 218-228: The Lamatic request timeout Promise in lamatic-client.ts
leaves a live timer behind after Promise.race settles, so update the timeout
handling around the executeFlow race to keep and clear the setTimeout handle
once client.executeFlow(workflowId, input) resolves or rejects. Use the
timeout/race block in the same function to ensure the timer is always cleared on
both success and failure, and keep the timeout error behavior unchanged.

---

Outside diff comments:
In `@kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts`:
- Around line 107-120: The postmortem flow contract is inconsistent between the
schema and the prompt: the schema in sre-incident-postmortem-agent.ts expects a
wrapped postmortem object and defines immediate_remediation as a string, while
the user prompt asks for an unwrapped object and makes immediate_remediation an
array. Update the schema and prompt to match one shape consistently, and align
the field types with the downstream expectations in lamatic-client.ts and
types.ts so execution.result.postmortem maps cleanly without validation or
parsing issues.
🪄 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: 5f6785d7-e684-467e-abe9-f09eb94f7e31

📥 Commits

Reviewing files that changed from the base of the PR and between 3893a96 and 9b521d8.

📒 Files selected for processing (7)
  • kits/sre-incident-postmortem-agent/apps/app/globals.css
  • kits/sre-incident-postmortem-agent/apps/app/page.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/button.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/input.tsx
  • kits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsx
  • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
  • kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts

Comment thread kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts Outdated
@Savanjadav Savanjadav force-pushed the feat/sre-incident-postmortem-agent branch from 9b521d8 to 7338a00 Compare June 29, 2026 00:48

@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/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts`:
- Around line 96-108: The timeout in executeFlow only stops awaiting the result
and leaves the Lamatic request running in the background. Update the
lamatic-client flow to use a Lamatic-supported cancellation or status-polling
approach, or add request-level abort support if available, so the in-flight
executeFlow call is actually stopped when REQUEST_TIMEOUT_MS is reached. Keep
the fix centered around client.executeFlow, the timeout Promise.race block, and
the timeoutId cleanup path.
🪄 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: 1ed05b54-8240-4540-9c80-26afb5d4652d

📥 Commits

Reviewing files that changed from the base of the PR and between 9b521d8 and 9c86231.

📒 Files selected for processing (2)
  • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
  • kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts

Comment on lines +96 to +108
const timeout = new Promise<never>((_, reject) => {
timeoutId = setTimeout(
() => reject(new Error("Lamatic request timed out.")),
REQUEST_TIMEOUT_MS,
);
});

let execution: Awaited<ReturnType<typeof client.executeFlow>>;
try {
execution = await Promise.race([
client.executeFlow(workflowId, input),
timeout,
]);

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.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🌐 Web query:

Does lamatic version 0.3.2 support cancelling or timing out Lamatic.executeFlowrequests (for example viaAbortSignal or a timeout option), and what is the supported API?

💡 Result:

Based on the Lamatic SDK documentation, the Lamatic.executeFlow method does not natively support cancelling requests via AbortSignal or providing a built-in timeout option [1][2]. The executeFlow method returns a promise that resolves when the workflow execution completes or throws an error in cases of network issues, configuration problems, or parsing failures [1][2]. While executeFlow lacks direct timeout control, you can manage long-running processes by using the checkStatus method [1]. The checkStatus method allows for custom polling intervals and timeouts, returning a status of "error" with an HTTP status code of 408 if the specified timeout is reached [1]. In summary: - executeFlow does not accept AbortSignal or timeout parameters [1][2]. - For workflows requiring timeout management, you should trigger the flow and subsequently use the checkStatus method with a pollTimeout parameter to monitor the request status [1]. - Error handling for executeFlow should be implemented using standard try-catch blocks to capture network or configuration errors [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file around the cited lines
sed -n '1,220p' kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts

# Find any other Lamatic client usage and any timeout/cancel helpers
rg -n "executeFlow|checkStatus|AbortSignal|timeout" kits/sre-incident-postmortem-agent/apps -g '!**/node_modules/**'

Repository: Lamatic/AgentKit

Length of output: 4340


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Identify the Lamatic SDK version and any local cancellation-related types/usages.
git ls-files '**/package.json' '**/package-lock.json' '**/pnpm-lock.yaml' '**/yarn.lock' | sed -n '1,50p'
rg -n '"lamatic"|lamatic@|AbortController|AbortSignal|checkStatus|executeFlow' \
  kits/sre-incident-postmortem-agent/apps package.json pnpm-lock.yaml yarn.lock package-lock.json \
  -g '!**/node_modules/**'

Repository: Lamatic/AgentKit

Length of output: 2892


Abort the Lamatic request, not just the await. Promise.race only stops waiting here; lamatic@0.3.2 doesn’t expose AbortSignal or a timeout on executeFlow, so the in-flight call can keep running in the background after this path throws. Switch to a Lamatic-supported cancellation/status-polling flow or add request-level abort support.

🤖 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/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts` around lines
96 - 108, The timeout in executeFlow only stops awaiting the result and leaves
the Lamatic request running in the background. Update the lamatic-client flow to
use a Lamatic-supported cancellation or status-polling approach, or add
request-level abort support if available, so the in-flight executeFlow call is
actually stopped when REQUEST_TIMEOUT_MS is reached. Keep the fix centered
around client.executeFlow, the timeout Promise.race block, and the timeoutId
cleanup path.

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Savanjadav

Copy link
Copy Markdown
Author

All CodeRabbit feedback has been addressed in the latest commits, and the PR now has all checks passing. Could a maintainer please dismiss the stale CodeRabbit requested-changes state if needed?

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

♻️ Duplicate comments (1)
kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts (1)

83-103: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

This tape will not self-destruct, and neither will a stuck request.

Agent, the timeout wrapper is gone. Line 89 now bare-awaits client.executeFlow(workflowId, input) with nothing bounding it — no Promise.race, no abort, no polling. This directly reopens the case file from the previous mission briefing: lamatic@0.3.2's executeFlow doesn't expose AbortSignal or a timeout option, and the team's own recon confirmed the SDK-supported way to bound execution is checkStatus with a pollTimeout. Dropping the Promise.race wrapper without adopting that mechanism trades "leaky but bounded" for "fully unbounded" — a hung Lamatic call now blocks this server action indefinitely.

🕶️ Proposed fix using SDK-supported polling
-  const execution = await client.executeFlow(workflowId, input);
+  const execution = await client.executeFlow(workflowId, input);
+  // If executeFlow itself can hang, trigger + checkStatus(pollTimeout) is the
+  // SDK-supported way to bound execution time; verify against lamatic@0.3.2 docs.
Does lamatic npm package version 0.3.2 support a timeout or pollTimeout option on executeFlow, or only via checkStatus?
🤖 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/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts` around lines
83 - 103, The Lamatic flow execution is now unbounded because `executeFlow` is
awaited directly in `lamatic-client.ts` without any timeout or abort control.
Update the `Lamatic` workflow execution path in this function to use the
SDK-supported polling approach (`checkStatus` with `pollTimeout`) or an
equivalent bounded wrapper, and ensure the request cannot hang indefinitely.
Keep the existing status validation and `validatePostmortem` flow after the
bounded execution completes.
🤖 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.

Duplicate comments:
In `@kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts`:
- Around line 83-103: The Lamatic flow execution is now unbounded because
`executeFlow` is awaited directly in `lamatic-client.ts` without any timeout or
abort control. Update the `Lamatic` workflow execution path in this function to
use the SDK-supported polling approach (`checkStatus` with `pollTimeout`) or an
equivalent bounded wrapper, and ensure the request cannot hang indefinitely.
Keep the existing status validation and `validatePostmortem` flow after the
bounded execution completes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42d6ccad-9db2-4801-b697-f910fabf6903

📥 Commits

Reviewing files that changed from the base of the PR and between 9c86231 and 9c17291.

📒 Files selected for processing (2)
  • kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts
  • kits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation failed. The kit was rejected by Lamatic Studio.

Errors

sre-incident-postmortem-agent

  • Flow: sre-incident-postmortem-agent — config_json.nodes must be a non-empty array

Please fix the errors above and push a new commit to re-run validation.
Refer to CONTRIBUTING.md for guidance.

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.

2 participants