Skip to content

feat: Add production-bottleneck-brief kit#280

Open
IbrahimKhan7208 wants to merge 15 commits into
Lamatic:mainfrom
IbrahimKhan7208:feat/production-bottleneck-brief
Open

feat: Add production-bottleneck-brief kit#280
IbrahimKhan7208 wants to merge 15 commits into
Lamatic:mainfrom
IbrahimKhan7208:feat/production-bottleneck-brief

Conversation

@IbrahimKhan7208

@IbrahimKhan7208 IbrahimKhan7208 commented Jul 20, 2026

Copy link
Copy Markdown

What this is

A kit that turns production order data (stage, timeline, quantity) into a prioritized, plain-English brief on which orders are at risk of missing their deadline — plus a follow-up Q&A flow for asking about any specific flagged order.

Live Demo

Design decision

Risk detection (days until due, days in stage, % complete, overdue status) is computed deterministically in a code node — not by the LLM. The LLM's only job is synthesizing those precomputed stats into a prioritized narrative, translating raw values into plain language. This keeps output reliable and reproducible rather than leaving risk assessment to model judgment.

Note on PR checklist format

This repo's auto-filled PR template references an older structure (config.json, bundles/<bundle-name>/, per-flow meta.json/inputs.json). I followed the current CONTRIBUTING.md instead, which uses lamatic.config.ts + flat .ts files under flows/ — matching the structure of existing merged kits like content-generation and article-summariser. Checklist below reflects CONTRIBUTING.md's actual requirements.

Checklist (per CONTRIBUTING.md)

  • Folder at kits/production-bottleneck-brief/ (kebab-case, unique)
  • lamatic.config.ts present with valid type, name, author, tags, steps, links
  • agent.md present
  • README.md present, describes purpose, setup, and usage
  • flows/<name>.ts exists for every step in lamatic.config.ts
  • constitutions/default.md present
  • .env.example present with placeholder values only
  • apps/package.json works with npm install && npm run dev
  • links.github points to kits/production-bottleneck-brief
  • links.deploy has root-directory=kits/production-bottleneck-brief/apps
  • No .env or .env.local committed
  • All @reference paths resolve
  • PR touches only files inside kits/production-bottleneck-brief/

Agentkit Challenge

Submitting as part of the Applied AI Engineer internship assignment.

  • Added kits/production-bottleneck-brief/ kit contents:

    • kits/production-bottleneck-brief/.env.example
    • kits/production-bottleneck-brief/.gitignore
    • kits/production-bottleneck-brief/README.md
    • kits/production-bottleneck-brief/agent.md
    • kits/production-bottleneck-brief/constitutions/default.md
    • kits/production-bottleneck-brief/lamatic.config.ts
    • kits/production-bottleneck-brief/flows/production-bottleneck-brief.ts
    • kits/production-bottleneck-brief/flows/follow-up-qa.ts
    • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts
    • kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
    • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_system_0.md
    • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_user_1.md
    • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-430_system_0.md
    • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-430_user_1.md
    • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md
    • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_user_1.md
    • kits/production-bottleneck-brief/model-configs/production-bottleneck-brief_llmnode-303_generative-model-name.ts
    • kits/production-bottleneck-brief/model-configs/production-bottleneck-brief_llmnode-430_generative-model-name.ts
    • kits/production-bottleneck-brief/model-configs/follow-up-qa_llmnode-222_generative-model-name.ts
    • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-node-268_embedding-model-name.ts
    • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-node-268_generative-model-name.ts
    • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-retrieve-node-644_embedding-model-name.ts
  • Added Next.js demo app under kits/production-bottleneck-brief/apps/:

    • kits/production-bottleneck-brief/apps/.env.example
    • kits/production-bottleneck-brief/apps/.gitignore
    • kits/production-bottleneck-brief/apps/AGENTS.md
    • kits/production-bottleneck-brief/apps/CLAUDE.md
    • kits/production-bottleneck-brief/apps/README.md
    • kits/production-bottleneck-brief/apps/actions/orchestrate.ts
    • kits/production-bottleneck-brief/apps/app/favicon.ico
    • kits/production-bottleneck-brief/apps/app/globals.css
    • kits/production-bottleneck-brief/apps/app/layout.tsx
    • kits/production-bottleneck-brief/apps/app/page.tsx
    • kits/production-bottleneck-brief/apps/eslint.config.mjs
    • kits/production-bottleneck-brief/apps/lib/lamatic-client.ts
    • kits/production-bottleneck-brief/apps/next.config.ts
    • kits/production-bottleneck-brief/apps/package.json
    • kits/production-bottleneck-brief/apps/package-lock.json
    • kits/production-bottleneck-brief/apps/postcss.config.mjs
    • kits/production-bottleneck-brief/apps/tsconfig.json
    • kits/production-bottleneck-brief/apps/public/file.svg
    • kits/production-bottleneck-brief/apps/public/globe.svg
    • kits/production-bottleneck-brief/apps/public/next.svg
    • kits/production-bottleneck-brief/apps/public/vercel.svg
    • kits/production-bottleneck-brief/apps/public/window.svg
  • Flow node types introduced (from kits/production-bottleneck-brief/flows/*.ts; no separate flow.json file present):

    • triggerNode
    • dynamicNode (used for code, LLM, and memory retrieve/add via the specific nodeId)
    • responseNode
    • Edges include responseEdge plus standard flow wiring between nodes
  • High-level flow behavior:

    • production-bottleneck-brief
      • triggerNode accepts orders[]
      • dynamicNode code computes deterministic per-order stats (e.g., days until due, days in stage, % complete, at-risk/overdue)
      • dynamicNode LLM generates a prioritized plain-English bottleneck brief from those computed stats
      • dynamicNode LLM turns the brief into an internal “email draft”
      • responseNode returns { brief, stats, emailDraft }
    • follow-up-qa
      • triggerNode accepts orders[], orderId, and question
      • dynamicNode code computes stats for the matched order (or returns an error payload)
      • dynamicNode memory retrieve searches orderQaHistory by orderId and uses the question as the search query
      • dynamicNode LLM answers using the order stats + retrieved memory
      • dynamicNode memory add stores the user question and assistant answer back into orderQaHistory
      • responseNode returns the generated answer

@github-actions

Copy link
Copy Markdown
Contributor

Failure recorded at 2026-07-20T20:34:48Z UTC. If this PR is not fixed within 4 weeks it will be automatically closed.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2ebba8ee-9aef-4d14-8191-e61eda1311ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Changes

The kit adds deterministic order-risk calculations, two Lamatic workflows for brief generation and order Q&A, a Next.js interface, runtime configuration, styling, environment examples, and documentation.

Production Bottleneck Brief

Layer / File(s) Summary
Order risk computation
kits/production-bottleneck-brief/scripts/*
Computes timing, completion, remaining-stage, and risk statistics for complete order sets and selected orders.
Workflow definitions and LLM contracts
kits/production-bottleneck-brief/flows/*, kits/production-bottleneck-brief/prompts/*, kits/production-bottleneck-brief/model-configs/*, kits/production-bottleneck-brief/constitutions/default.md, kits/production-bottleneck-brief/lamatic.config.ts
Defines brief generation, email drafting, order Q&A, memory handling, model configurations, prompts, constitution, and registered kit steps.
Application orchestration and interface
kits/production-bottleneck-brief/apps/actions/orchestrate.ts, kits/production-bottleneck-brief/apps/lib/lamatic-client.ts, kits/production-bottleneck-brief/apps/app/*
Adds typed server actions and a responsive page for JSON order analysis, severity statistics, email drafts, and order-specific Q&A.
Application scaffold and runtime configuration
kits/production-bottleneck-brief/apps/package.json, kits/production-bottleneck-brief/apps/tsconfig.json, kits/production-bottleneck-brief/apps/*.config.*, kits/production-bottleneck-brief/apps/.env.example, kits/production-bottleneck-brief/apps/.gitignore, kits/production-bottleneck-brief/apps/{README.md,AGENTS.md,CLAUDE.md}
Adds Next.js package, TypeScript, linting, PostCSS, environment examples, ignore rules, and application guidance.
Kit documentation and repository hygiene
kits/production-bottleneck-brief/.gitignore, kits/production-bottleneck-brief/README.md, kits/production-bottleneck-brief/agent.md, kits/production-bottleneck-brief/.env.example
Documents flow behavior, input schema, local execution, guardrails, and scope while adding root ignore patterns and environment placeholders.

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: adding the production-bottleneck-brief kit.
Description check ✅ Passed It covers the kit purpose, design decision, setup, and a detailed checklist, but it doesn't follow the repository template's exact section headings.
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.

@coderabbitai
coderabbitai Bot requested a review from d-pamneja July 20, 2026 20:35

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

🤖 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/production-bottleneck-brief/apps/actions/orchestrate.ts`:
- Around line 30-41: Replace the direct BRIEF_FLOW_ID and QA_FLOW_ID environment
lookups in getBottleneckBrief and askAboutOrder with the corresponding step
definitions from ../../lamatic.config. Import the central lamatic configuration
and derive each flow ID from its step’s envKey before calling
lamatic.executeFlow.

In `@kits/production-bottleneck-brief/apps/app/globals.css`:
- Around line 1-377: Replace the custom rules in globals.css with Tailwind CSS
v4 utilities and shadcn/ui component styling across the affected UI, removing
bespoke layout, typography, form, button, card, table, badge, responsive, and
animation declarations. Update the corresponding components to use shadcn/ui
primitives and Tailwind class names while preserving the existing structure,
responsive behavior, states, and visual hierarchy.

In `@kits/production-bottleneck-brief/apps/app/page.tsx`:
- Around line 136-146: Refactor the form containing the orderId and question
inputs to use react-hook-form with a zod schema and validation, replacing the
raw input elements with the project’s shadcn/ui form and input components.
Update submission and handleQuestionKeyDown to use the form API while preserving
the existing order-question behavior, and use lucide-react icons where the form
UI currently needs icons.

In `@kits/production-bottleneck-brief/constitutions/default.md`:
- Around line 1-17: Fix the MD022 heading-spacing issue in the template or
source generator that produces default.md, rather than editing this generated
file directly. Ensure generated Constitution headings have blank lines before
and after them, and preserve the existing content and formatting otherwise.

In
`@kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_system_0.md`:
- Around line 1-13: Update the repository-level markdownlint configuration to
ignore kits/production-bottleneck-brief/prompts/**/*.md, covering the anchor
file at lines 1-13 and sibling files
kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_user_1.md
lines 1-1 and
kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md
lines 1-5; make no direct changes to any prompt content.

In `@kits/production-bottleneck-brief/README.md`:
- Line 99: Normalize trailing newlines in
kits/production-bottleneck-brief/README.md at lines 99-99 and
kits/production-bottleneck-brief/agent.md at lines 27-27 by ensuring each
Markdown file ends with exactly one newline.
- Around line 26-44: The README currently conflates the flow API payload with
the pasted UI input format. Update the documentation around the orders schema
and Order Q&A input to explicitly state that the UI accepts a bare orders array,
while the flow API receives `{ orders: [...] }` and the Q&A API additionally
requires `orderId` and `question`; keep the formats clearly distinguished and
consistent with `apps/actions/orchestrate.ts`.
🪄 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: 5a0f45a8-e205-42c5-9db6-db21326b9fe2

📥 Commits

Reviewing files that changed from the base of the PR and between 69b0fc6 and 53ccfcf.

⛔ Files ignored due to path filters (7)
  • kits/production-bottleneck-brief/apps/app/favicon.ico is excluded by !**/*.ico
  • kits/production-bottleneck-brief/apps/package-lock.json is excluded by !**/package-lock.json
  • kits/production-bottleneck-brief/apps/public/file.svg is excluded by !**/*.svg
  • kits/production-bottleneck-brief/apps/public/globe.svg is excluded by !**/*.svg
  • kits/production-bottleneck-brief/apps/public/next.svg is excluded by !**/*.svg
  • kits/production-bottleneck-brief/apps/public/vercel.svg is excluded by !**/*.svg
  • kits/production-bottleneck-brief/apps/public/window.svg is excluded by !**/*.svg
📒 Files selected for processing (28)
  • kits/production-bottleneck-brief/.gitignore
  • kits/production-bottleneck-brief/README.md
  • kits/production-bottleneck-brief/agent.md
  • kits/production-bottleneck-brief/apps/.env.example
  • kits/production-bottleneck-brief/apps/.gitignore
  • kits/production-bottleneck-brief/apps/AGENTS.md
  • kits/production-bottleneck-brief/apps/CLAUDE.md
  • kits/production-bottleneck-brief/apps/README.md
  • kits/production-bottleneck-brief/apps/actions/orchestrate.ts
  • kits/production-bottleneck-brief/apps/app/globals.css
  • kits/production-bottleneck-brief/apps/app/layout.tsx
  • kits/production-bottleneck-brief/apps/app/page.tsx
  • kits/production-bottleneck-brief/apps/eslint.config.mjs
  • kits/production-bottleneck-brief/apps/lib/lamatic-client.ts
  • kits/production-bottleneck-brief/apps/next.config.ts
  • kits/production-bottleneck-brief/apps/package.json
  • kits/production-bottleneck-brief/apps/postcss.config.mjs
  • kits/production-bottleneck-brief/apps/tsconfig.json
  • kits/production-bottleneck-brief/constitutions/default.md
  • kits/production-bottleneck-brief/flows/follow-up-qa.ts
  • kits/production-bottleneck-brief/flows/production-bottleneck-brief.ts
  • kits/production-bottleneck-brief/lamatic.config.ts
  • kits/production-bottleneck-brief/model-configs/follow-up-qa_llmnode-222_generative-model-name.ts
  • kits/production-bottleneck-brief/model-configs/production-bottleneck-brief_llmnode-303_generative-model-name.ts
  • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md
  • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_user_1.md
  • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_system_0.md
  • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_user_1.md

Comment thread kits/production-bottleneck-brief/apps/actions/orchestrate.ts
Comment thread kits/production-bottleneck-brief/apps/app/globals.css Outdated
Comment thread kits/production-bottleneck-brief/apps/app/page.tsx Outdated
Comment thread kits/production-bottleneck-brief/constitutions/default.md
Comment thread kits/production-bottleneck-brief/README.md Outdated
Comment thread kits/production-bottleneck-brief/README.md Outdated
@akshatvirmani akshatvirmani changed the title feat: Add production-bottleneck-brief kit feat: Add production-bottleneck-brief kit. Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/production-bottleneck-brief

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.

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation passed. The kit loaded successfully in Lamatic Studio.

This PR is ready for final review and merge.

@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/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts`:
- Around line 4-12: Update computeStats in
kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
(lines 4-12) and the corresponding date/stat calculations in
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts
(lines 4-13) to subtract numeric date timestamps rather than Date objects. Guard
quantity before calculating pctComplete so zero, invalid, or missing quantities
produce a safe non-Infinity/non-NaN result while preserving valid percentage
calculations.
🪄 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: 8f32995c-bfc0-47c1-b6ae-04f21d8bfb67

📥 Commits

Reviewing files that changed from the base of the PR and between 53ccfcf and 31b55c0.

📒 Files selected for processing (2)
  • kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
  • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts

Comment thread kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.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.

Caution

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

⚠️ Outside diff range comments (1)
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts (1)

13-24: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Neutralize the rogue multiplier.

Agent, your mission, should you choose to accept it, is to intercept a critical data corruption threat in our completion stats.

By applying the * 100 multiplier on line 13, pctComplete is successfully scaled to a percentage. However, the asset at line 24 still multiplies it by 100 again. This double-scaling will cause a 50% completion rate to be reported as 5000, severely compromising our situational awareness.

Disarm the second multiplier to restore data integrity. This message will self-destruct.

🕵️ Proposed mission parameters (Fix)
-    const pctComplete = quantity > 0 ? Math.round((completedQuantity / quantity) * 100) : 0;
+    const pctComplete = quantity > 0 ? Math.round((completedQuantity / quantity) * 100) : 0;
     const stageIndex = o.stages.indexOf(o.currentStage);
     const stagesRemaining = o.stages.length - stageIndex - 1;
 
     const atRisk = daysUntilDue < (stagesRemaining * 3) || (daysUntilDue < 0);
 
     return {
       id: o.id,
       currentStage: o.currentStage,
       daysInStage,
       daysUntilDue,
-      pctComplete: Math.round(pctComplete * 100),
+      pctComplete,
       stagesRemaining,
       atRisk
     };
🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`
around lines 13 - 24, Remove the redundant percentage multiplier from the
pctComplete field in the returned object. Keep the existing calculation in the
pctComplete declaration so completion values remain correctly scaled once.
🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`:
- Around line 13-24: Remove the redundant percentage multiplier from the
pctComplete field in the returned object. Keep the existing calculation in the
pctComplete declaration so completion values remain correctly scaled once.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7880856f-e05e-4dc9-9559-2019318c60aa

📥 Commits

Reviewing files that changed from the base of the PR and between 31b55c0 and 8805837.

📒 Files selected for processing (2)
  • kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
  • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts

@IbrahimKhan7208

Copy link
Copy Markdown
Author

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@IbrahimKhan7208

Copy link
Copy Markdown
Author

Status update — everything actionable on my end for this PR is done.

Fixes for issues flagged by GitHub Actions (structural/Phase 2 validation):

  • Added the missing scripts/ files (follow-up-qa_code-node-797_code.ts,
    production-bottleneck-brief_code-node-969_code.ts) that Phase 2 validation
    flagged as unresolved @scripts/... references
  • Confirmed both files are now present and tracked in the repo

Fixes for issues flagged by CodeRabbit:

  • Converted Date subtraction to .getTime() calls (didn't type-check as written)
  • Added a guard against divide-by-zero on pctComplete when quantity is 0
  • Fixed a duplicate percentage scaling bug in pctComplete (was being multiplied
    by 100 twice, inflating a 42% completion to 4200%)
  • Applied all of the above in both the local script files and the live Studio
    flows, and re-verified against the deployed demo that percentages now report
    correctly

Two things still pending that look like infra-side issues rather than anything
in this PR's code, flagging in case a maintainer needs to look:

  1. Validate PR Contribution / validate (pull_request_target) has been
    failing consistently, including the latest run which has been stuck on
    "Running Studio validation — results will appear here shortly" for a while
    now. This looks like a workflow-level issue: pull_request_target blocks
    checking out code from fork PRs for security reasons, so it would affect
    any fork-based contribution the same way, not just this one. Possibly needs
    a trigger change (e.g. to pull_request, or splitting validation from any
    privileged steps) on the workflow itself.
  2. CodeRabbit shows "Review rate limited" on the latest push — assuming
    this clears on its own, just noting it in case a manual re-review trigger
    is needed.

Happy to make any further changes needed — otherwise I'll keep an eye out for
updates here.

@akshatvirmani akshatvirmani changed the title feat: Add production-bottleneck-brief kit. feat: Add production-bottleneck-brief kit Jul 21, 2026
@IbrahimKhan7208

Copy link
Copy Markdown
Author

Hey @akshatvirmani I just wanna flag that I have few more ideas for my kit (to add more features/capabilities to my current flows used in the kit). But I'll hold off on any of that until this PR gets merged (cause this is already at "passing-checks" label and making changes will might affect that). Therefore I'll open that as a separate follow-up PR at that point rather than adding scope here, to make sure there won't be any confusion with PRs and merging.

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 22, 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.

Caution

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

⚠️ Outside diff range comments (2)
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts (2)

1-1: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Mission: read orders from the Code-node runtime.

Line 1’s mustache expression resolves to a literal path inside a Code node, so computeStats will not receive the order array. Read workflow.triggerNode_1.output.orders instead.

Based on learnings, Code-node bodies must access upstream values through workflow.<nodeId>.output.<field>, not {{...}}.

🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`
at line 1, Replace the mustache-based orders assignment with a Code-node runtime
access through workflow.triggerNode_1.output.orders, ensuring computeStats
receives the upstream order array.

Source: Learnings


5-27: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Mission: make malformed-order handling safe and contract-compatible.

Line 6 dereferences o before validation, so a null array entry crashes the entire flow rather than being flagged at risk. The invalid-data return also omits metrics required by OrderStat and rendered by the app. Guard non-object entries before property access, then return a complete sentinel stat or exclude invalid records from stats.

🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`
around lines 5 - 27, Update the order mapping logic around the `orders.map`
callback to guard null or non-object entries before accessing fields such as
`stageEnteredDate` and `dueDate`. For invalid entries, return a complete
sentinel `OrderStat` containing all metrics required by the contract and
renderer while preserving `atRisk: true`, or exclude them from `stats` if that
is the established contract; do not allow malformed records to crash the flow.
🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`:
- Line 1: Replace the mustache-based orders assignment with a Code-node runtime
access through workflow.triggerNode_1.output.orders, ensuring computeStats
receives the upstream order array.
- Around line 5-27: Update the order mapping logic around the `orders.map`
callback to guard null or non-object entries before accessing fields such as
`stageEnteredDate` and `dueDate`. For invalid entries, return a complete
sentinel `OrderStat` containing all metrics required by the contract and
renderer while preserving `atRisk: true`, or exclude them from `stats` if that
is the established contract; do not allow malformed records to crash the flow.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: 382402f8-0509-443e-b312-ab1741d2a6c6

📥 Commits

Reviewing files that changed from the base of the PR and between 8814dc1 and 389a4a7.

📒 Files selected for processing (2)
  • kits/production-bottleneck-brief/.env.example
  • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@akshatvirmani

Copy link
Copy Markdown
Contributor

LGTM! Can you please resolve two comments left by coderabbit? @IbrahimKhan7208

Add validation for order data in computeStats function.
@IbrahimKhan7208

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 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.

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (1)
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts (1)

1-1: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Mission continues with the repository’s binding rule.

The repository guidelines for kits/*/scripts/*.ts require externalizing Code node values with Lamatic template variables, and these literal mustache inputs remain in code-node scripts. Update products and orderId through the required template binding form instead of leaving the mustache expressions embedded in the generated .ts files.

🤖 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/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`
at line 1, Replace the embedded mustache inputs with the repository-required
Lamatic template variable binding for products and orderId. Apply the
corresponding updates in
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts
lines 1-1 and
kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
lines 1-2, preserving the existing variable usage while externalizing their
values.

Source: Learnings

🤖 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/production-bottleneck-brief/apps/app/globals.css`:
- Around line 537-552: Merge the two consecutive .chat-thread CSS rule blocks
into a single rule, preserving all existing layout, spacing, background, border,
and radius declarations without changing their values.

In `@kits/production-bottleneck-brief/flows/follow-up-qa.ts`:
- Around line 165-174: Update the second memoryValue entry in the follow-up QA
flow so the generated response from LLMNode_222 is stored with role "assistant"
rather than "user"; leave the question entry and content unchanged.

In
`@kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md`:
- Around line 4-10: Remove the “deprioritizing this order behind one with more
remaining slack” example from the recovery-action guidance. Keep only actions
grounded in the available single-order stats, such as reallocating resources to
the current bottleneck or escalating a stage-specific supplier, and preserve the
prohibition against assuming unavailable information.

In
`@kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`:
- Around line 22-28: Update the validators in
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts
lines 22-28 and
kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
lines 13-19 to require completedQuantity <= quantity alongside the existing
finite and non-negative checks. Apply the same upper-bound validation in both
calculator paths.

---

Outside diff comments:
In
`@kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts`:
- Line 1: Replace the embedded mustache inputs with the repository-required
Lamatic template variable binding for products and orderId. Apply the
corresponding updates in
kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts
lines 1-1 and
kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
lines 1-2, preserving the existing variable usage while externalizing their
values.
🪄 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 Plus

Run ID: ffe7cb51-12fa-4b0c-b810-74335c652d01

📥 Commits

Reviewing files that changed from the base of the PR and between 8814dc1 and 3d20b2c.

📒 Files selected for processing (21)
  • kits/production-bottleneck-brief/.env.example
  • kits/production-bottleneck-brief/README.md
  • kits/production-bottleneck-brief/agent.md
  • kits/production-bottleneck-brief/apps/actions/orchestrate.ts
  • kits/production-bottleneck-brief/apps/app/globals.css
  • kits/production-bottleneck-brief/apps/app/layout.tsx
  • kits/production-bottleneck-brief/apps/app/page.tsx
  • kits/production-bottleneck-brief/flows/follow-up-qa.ts
  • kits/production-bottleneck-brief/flows/production-bottleneck-brief.ts
  • kits/production-bottleneck-brief/lamatic.config.ts
  • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-node-268_embedding-model-name.ts
  • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-node-268_generative-model-name.ts
  • kits/production-bottleneck-brief/model-configs/follow-up-qa_memory-retrieve-node-644_embedding-model-name.ts
  • kits/production-bottleneck-brief/model-configs/production-bottleneck-brief_llmnode-430_generative-model-name.ts
  • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md
  • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_user_1.md
  • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-303_system_0.md
  • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-430_system_0.md
  • kits/production-bottleneck-brief/prompts/production-bottleneck-brief_llmnode-430_user_1.md
  • kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
  • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts

Comment thread kits/production-bottleneck-brief/apps/app/globals.css
Comment thread kits/production-bottleneck-brief/flows/follow-up-qa.ts
Comment thread kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md Outdated
@IbrahimKhan7208

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 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.

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/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md`:
- Around line 4-9: Remove the “escalating to a supplier” example from the
recovery-action guidance in the prompt. Keep the instruction limited to concrete
actions supported by the available order statistics, such as reallocating
resources to the current bottleneck, without requiring unavailable supplier or
contact information.
🪄 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 Plus

Run ID: 054699a3-046d-4a9d-9980-625ec8e921c5

📥 Commits

Reviewing files that changed from the base of the PR and between 3d20b2c and aebbf2a.

📒 Files selected for processing (5)
  • kits/production-bottleneck-brief/apps/app/globals.css
  • kits/production-bottleneck-brief/flows/follow-up-qa.ts
  • kits/production-bottleneck-brief/prompts/follow-up-qa_llmnode-222_system_0.md
  • kits/production-bottleneck-brief/scripts/follow-up-qa_code-node-797_code.ts
  • kits/production-bottleneck-brief/scripts/production-bottleneck-brief_code-node-969_code.ts

@IbrahimKhan7208

Copy link
Copy Markdown
Author

@akshatvirmani All CodeRabbit comments from the latest reviews are resolved, Let me know if anything else needs attention.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @IbrahimKhan7208! 👋

Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review.

Steps to follow:

  1. Read through all CodeRabbit comments carefully
  2. Address each issue raised (or reply explaining why you disagree)
  3. Push your fixes as new commits
  4. Once all issues are resolved, comment here so we can re-review

This helps keep the review process efficient for everyone. Thank you! 🙏

@IbrahimKhan7208

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 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.

@IbrahimKhan7208

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 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.

@IbrahimKhan7208

Copy link
Copy Markdown
Author

Hey @akshatvirmani , are we good now? all the comments from coderabbit is finally resolved, in the last time few comments were there that's why github-action bot gave me the message and right know I finally resolved all, and coderabbit has approved all. can you just make github-action bot to re asses and attach the "passing-check" label again and we can move forward I think?

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