feat: scaffold SRE incident postmortem agent kit#180
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 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. ChangesSRE Incident Postmortem Agent Kit
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: 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 | 🟠 MajorTailwind 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.jsonand lockfile resolve to v3.4.17. Upgrade to Tailwind CSS v4 and update the PostCSS configuration accordingly (v4 typically uses@tailwindcss/postcssinstead of thetailwindcssplugin). 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
⛔ Files ignored due to path filters (1)
kits/sre-incident-postmortem-agent/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (26)
kits/sre-incident-postmortem-agent/.env.examplekits/sre-incident-postmortem-agent/.gitignorekits/sre-incident-postmortem-agent/README.mdkits/sre-incident-postmortem-agent/agent.mdkits/sre-incident-postmortem-agent/apps/.env.examplekits/sre-incident-postmortem-agent/apps/.eslintrc.jsonkits/sre-incident-postmortem-agent/apps/.gitignorekits/sre-incident-postmortem-agent/apps/README.mdkits/sre-incident-postmortem-agent/apps/actions/orchestrate.tskits/sre-incident-postmortem-agent/apps/app/globals.csskits/sre-incident-postmortem-agent/apps/app/layout.tsxkits/sre-incident-postmortem-agent/apps/app/page.tsxkits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/apps/lib/types.tskits/sre-incident-postmortem-agent/apps/lib/utils.tskits/sre-incident-postmortem-agent/apps/next-env.d.tskits/sre-incident-postmortem-agent/apps/next.config.mjskits/sre-incident-postmortem-agent/apps/package.jsonkits/sre-incident-postmortem-agent/apps/postcss.config.mjskits/sre-incident-postmortem-agent/apps/tailwind.config.tskits/sre-incident-postmortem-agent/apps/tsconfig.jsonkits/sre-incident-postmortem-agent/constitutions/default.mdkits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.tskits/sre-incident-postmortem-agent/lamatic.config.tskits/sre-incident-postmortem-agent/model-configs/sre-incident-postmortem-agent_postmortem-generator.tskits/sre-incident-postmortem-agent/prompts/sre-incident-postmortem-agent_postmortem-generator_system.md
There was a problem hiding this comment.
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 winMission: 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 intry/catchand 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 liftMission: swap the hard-coded palette for CSS-variable-backed tokens.
This screen still hard-codes a large
slate/tealpalette (bg-white,text-slate-*,border-slate-*,bg-teal-*, etc.), so it bypasses the theme variables introduced inkits/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 thelamaticnpm 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
⛔ Files ignored due to path filters (1)
kits/sre-incident-postmortem-agent/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
kits/sre-incident-postmortem-agent/apps/actions/orchestrate.tskits/sre-incident-postmortem-agent/apps/app/globals.csskits/sre-incident-postmortem-agent/apps/app/page.tsxkits/sre-incident-postmortem-agent/apps/components/ui/button.tsxkits/sre-incident-postmortem-agent/apps/components/ui/input.tsxkits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsxkits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/apps/package.jsonkits/sre-incident-postmortem-agent/apps/postcss.config.mjs
There was a problem hiding this comment.
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 winMission: make the flow output contract say one thing.
Line 108 declares a wrapped
{ "postmortem": { ... } }payload withimmediate_remediationas a string, but Line 120 tells the model to return an unwrapped object and makesimmediate_remediationan array.apps/lib/lamatic-client.tslater readsexecution.result.postmortem, andapps/lib/types.tsrequiresimmediate_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
📒 Files selected for processing (7)
kits/sre-incident-postmortem-agent/apps/app/globals.csskits/sre-incident-postmortem-agent/apps/app/page.tsxkits/sre-incident-postmortem-agent/apps/components/ui/button.tsxkits/sre-incident-postmortem-agent/apps/components/ui/input.tsxkits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsxkits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts
9b521d8 to
7338a00
Compare
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/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
📒 Files selected for processing (2)
kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts
| 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, | ||
| ]); |
There was a problem hiding this comment.
🩺 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.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
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? |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.ts (1)
83-103: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftThis 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 — noPromise.race, no abort, no polling. This directly reopens the case file from the previous mission briefing:lamatic@0.3.2'sexecuteFlowdoesn't exposeAbortSignalor a timeout option, and the team's own recon confirmed the SDK-supported way to bound execution ischeckStatuswith apollTimeout. Dropping thePromise.racewrapper 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
📒 Files selected for processing (2)
kits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.ts
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
Studio Runtime Validation (Phase 2)❌ Studio validation failed. The kit was rejected by Lamatic Studio. Errorssre-incident-postmortem-agent
Please fix the errors above and push a new commit to re-run validation. |
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:
Contribution Type
Kit: Lamatic flow + runnable Next.js app.
Validation
npm installnpm run lintnpm run type-checknpm run buildChecklist
kits/sre-incident-postmortem-agentlamatic.config.tsagent.mdREADME.mdconstitutions/default.mdapps/.env.examplekits/sre-incident-postmortem-agent/kits/sre-incident-postmortem-agent/lamatic.config.tskits/sre-incident-postmortem-agent/README.mdkits/sre-incident-postmortem-agent/agent.mdkits/sre-incident-postmortem-agent/constitutions/default.mdkits/sre-incident-postmortem-agent/.env.examplekits/sre-incident-postmortem-agent/.gitignorekits/sre-incident-postmortem-agent/flows/sre-incident-postmortem-agent.tskits/sre-incident-postmortem-agent/model-configs/sre-incident-postmortem-agent_postmortem-generator.tskits/sre-incident-postmortem-agent/prompts/sre-incident-postmortem-agent_postmortem-generator_system.mdflows/sre-incident-postmortem-agent.ts):triggerNode(triggerNode_1): GraphQL “API Request” trigger;advance_schemaacceptsservice_name,incident_title,alert_details,logs_or_symptoms,timeline_notes,impact_description,current_statusdynamicNode(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_postmortemresponseNode(responseNode_triggerNode_1): GraphQL “API Response” node mapping LLM output into{ "postmortem": "<LLM output>" }triggerNode_1→InstructorLLMNode_1→responseNode_triggerNode_1, with the user prompt templated from the trigger outputs and the response returning the generatedpostmortem.kits/sre-incident-postmortem-agent/apps/kits/sre-incident-postmortem-agent/apps/README.mdkits/sre-incident-postmortem-agent/apps/package.jsonkits/sre-incident-postmortem-agent/apps/package-lock.jsonkits/sre-incident-postmortem-agent/apps/tsconfig.jsonkits/sre-incident-postmortem-agent/apps/next.config.mjskits/sre-incident-postmortem-agent/apps/next-env.d.tskits/sre-incident-postmortem-agent/apps/postcss.config.mjskits/sre-incident-postmortem-agent/apps/tailwind.config.tskits/sre-incident-postmortem-agent/apps/.env.examplekits/sre-incident-postmortem-agent/apps/.eslintrc.jsonkits/sre-incident-postmortem-agent/apps/.gitignorekits/sre-incident-postmortem-agent/apps/app/layout.tsxkits/sre-incident-postmortem-agent/apps/app/page.tsxkits/sre-incident-postmortem-agent/apps/app/globals.csskits/sre-incident-postmortem-agent/apps/components/ui/button.tsxkits/sre-incident-postmortem-agent/apps/components/ui/input.tsxkits/sre-incident-postmortem-agent/apps/components/ui/textarea.tsxkits/sre-incident-postmortem-agent/apps/actions/orchestrate.tskits/sre-incident-postmortem-agent/apps/lib/types.tskits/sre-incident-postmortem-agent/apps/lib/lamatic-client.tskits/sre-incident-postmortem-agent/apps/lib/utils.ts