feat: scaffold Debate Arena agent kit#197
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:
WalkthroughThis PR adds the Debate Arena kit, including its flow definitions, prompt and model wiring, Next.js app scaffold, server actions, and a client page that runs setup, debate rounds, and judging while saving history and rendering results. ChangesDebate Arena kit
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/debate-arena/apps/app/globals.css (1)
1-229: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winUse CSS variables for styling per kit guidelines.
The coding guideline for
kits/*/apps/**/*.{ts,tsx,css}requires CSS variables for styling, but this file uses ~15+ hardcoded hex/rgba color values scattered across selectors with no:rootcustom properties. This hurts maintainability — changing the accent color or background requires editing dozens of lines.As per coding guidelines: "For kit Next.js apps: use CSS variables for styling."
♻️ Proposed refactor — extract colors into :root variables
+:root { + --bg-primary: `#0f1115`; + --bg-secondary: `#181b21`; + --bg-tertiary: `#14171d`; + --text-primary: `#e8e9ed`; + --text-secondary: `#c3c6cf`; + --text-muted: `#9aa0ab`; + --border-default: `#2a2e37`; + --border-disabled: `#35394a`; + --accent: `#5b7cfa`; + --accent-a: rgba(91, 124, 250, 0.1); + --accent-a-border: rgba(91, 124, 250, 0.4); + --accent-b: rgba(250, 121, 91, 0.1); + --accent-b-border: rgba(250, 121, 91, 0.4); + --success: rgba(91, 250, 178, 0.08); + --success-border: rgba(91, 250, 178, 0.3); + --error: rgba(250, 91, 91, 0.1); + --error-border: rgba(250, 91, 91, 0.35); + --error-text: `#ff9b9b`; +} + * { box-sizing: border-box; } html, body { padding: 0; margin: 0; - background: `#0f1115`; - color: `#e8e9ed`; + background: var(--bg-primary); + color: var(--text-primary); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }Then replace all remaining hardcoded values with the corresponding
var(--...)references throughout the file.🤖 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/debate-arena/apps/app/globals.css` around lines 1 - 229, The global stylesheet uses many repeated hardcoded color values instead of kit-required CSS variables, making theme changes hard to maintain. Add a :root block with reusable custom properties for the background, text, borders, accent colors, and translucent variants, then update the selectors in globals.css to reference those variables everywhere. Keep the existing styling intent intact while replacing the hex/rgba literals across html/body, controls, cards, bubbles, verdict, recommendation, and error states.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/debate-arena/apps/actions/orchestrate.ts`:
- Around line 63-69: The flow response handling in orchestrate should validate
the returned payload before treating it as a DebateSetup. Introduce small zod
schemas at the boundary around client.executeFlow and res.result, then parse the
successful output and only return it when validation passes; otherwise surface
the existing error path. Update the res.status/result check in orchestrate so
the cast to DebateSetup is replaced by schema-backed parsing and the UI never
receives drifted flow data.
- Around line 1-3: The orchestrate action is still hardcoding flow ID env
lookups instead of using the kit config as the source of truth. Update the logic
in orchestrate.ts to import ../../lamatic.config, read each step’s envKey from
steps, and use those values when resolving flow IDs rather than calling
requireFlowId with DEBATE_*_FLOW_ID strings. Keep the existing getLamaticClient
flow wiring, but make the step-to-flow mapping come directly from the kit
config.
In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 127-133: The topic textarea in page.tsx is missing a programmatic
label, so add an accessible name by pairing it with a visible <label htmlFor>
using a stable id on the textarea, or by adding an aria-label directly to the
textarea element. Also update the error banner component in the same file to use
role="alert" so failures are announced immediately to assistive technologies.
In `@kits/debate-arena/apps/package.json`:
- Around line 12-17: The package.json dependencies block is missing several
guideline-required UI/form packages. Update the dependencies section to include
the Next.js app’s required frontend stack: Tailwind CSS v4+, shadcn/ui,
lucide-react, react-hook-form, and zod alongside the existing next/react
packages. Make sure the app’s package manifest reflects any UI libraries used by
the app so the dependency list matches the coding guidelines and the components
in the app can resolve correctly.
In `@kits/debate-arena/flows/debate-setup.ts`:
- Around line 80-88: The prompt entries in debate-setup use the same UUIDs as
debate-round, which can collide if Lamatic treats prompt IDs globally. Update
the system and user prompt IDs in the debate-setup flow to new unique UUIDs, and
keep the corresponding prompt references in the same flow aligned so each prompt
can be resolved independently without overlapping debate-round’s IDs.
In `@kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md`:
- Line 1: The judge prompt is interpolating structured values directly, so the
model may see opaque object/array text instead of usable debate content. Update
the prompt source in debate-judge_instructorllmnode-239_user_1.md to serialize
triggerNode_1.output.positionA, triggerNode_1.output.positionB, and
triggerNode_1.output.transcript into JSON text before insertion. Keep the Topic
field as-is, but ensure the debate inputs are rendered as explicit JSON payloads
so the judge can reliably evaluate the actual data.
---
Outside diff comments:
In `@kits/debate-arena/apps/app/globals.css`:
- Around line 1-229: The global stylesheet uses many repeated hardcoded color
values instead of kit-required CSS variables, making theme changes hard to
maintain. Add a :root block with reusable custom properties for the background,
text, borders, accent colors, and translucent variants, then update the
selectors in globals.css to reference those variables everywhere. Keep the
existing styling intent intact while replacing the hex/rgba literals across
html/body, controls, cards, bubbles, verdict, recommendation, and error states.
🪄 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: 3624d9d9-d047-4c3e-a93c-57e003f5bf01
⛔ Files ignored due to path filters (1)
kits/debate-arena/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (28)
kits/debate-arena/.gitignorekits/debate-arena/README.mdkits/debate-arena/agent.mdkits/debate-arena/apps/.env.examplekits/debate-arena/apps/.eslintrc.jsonkits/debate-arena/apps/actions/orchestrate.tskits/debate-arena/apps/app/globals.csskits/debate-arena/apps/app/layout.tsxkits/debate-arena/apps/app/page.tsxkits/debate-arena/apps/lib/lamatic-client.tskits/debate-arena/apps/next-env.d.tskits/debate-arena/apps/next.config.mjskits/debate-arena/apps/package.jsonkits/debate-arena/apps/tsconfig.jsonkits/debate-arena/constitutions/default.mdkits/debate-arena/flows/debate-judge.tskits/debate-arena/flows/debate-round.tskits/debate-arena/flows/debate-setup.tskits/debate-arena/lamatic.config.tskits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.tskits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.tskits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.tskits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.mdkits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.mdkits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.mdkits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.md
| "dependencies": { | ||
| "lamatic": "^0.3.2", | ||
| "next": "14.2.35", | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1" | ||
| }, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Missing Tailwind CSS and other guideline-required dependencies.
Per coding guidelines, kit Next.js apps must use Tailwind CSS v4+, shadcn/ui components, lucide-react for icons, and react-hook-form + zod for forms. The dependencies block includes lamatic, next, and react/react-dom but omits tailwindcss, shadcn/ui, lucide-react, react-hook-form, and zod. If the app UI uses any of these, they need to be declared here.
As per coding guidelines: kits/*/apps/**/*.{ts,tsx,js,jsx} — "use Next.js 14-15, React 18, TypeScript, Tailwind CSS v4+, shadcn/ui components, react-hook-form + zod for forms, lucide-react for icons, and Vercel for deployment".
📦 Suggested additions to dependencies
"dependencies": {
"lamatic": "^0.3.2",
"next": "14.2.35",
"react": "^18.3.1",
- "react-dom": "^18.3.1"
+ "react-dom": "^18.3.1",
+ "tailwindcss": "^4",
+ "lucide-react": "^0.400.0",
+ "react-hook-form": "^7",
+ "zod": "^3"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "dependencies": { | |
| "lamatic": "^0.3.2", | |
| "next": "14.2.35", | |
| "react": "^18.3.1", | |
| "react-dom": "^18.3.1" | |
| }, | |
| "dependencies": { | |
| "lamatic": "^0.3.2", | |
| "next": "14.2.35", | |
| "react": "^18.3.1", | |
| "react-dom": "^18.3.1", | |
| "tailwindcss": "^4", | |
| "lucide-react": "^0.400.0", | |
| "react-hook-form": "^7", | |
| "zod": "^3" | |
| }, |
🤖 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/debate-arena/apps/package.json` around lines 12 - 17, The package.json
dependencies block is missing several guideline-required UI/form packages.
Update the dependencies section to include the Next.js app’s required frontend
stack: Tailwind CSS v4+, shadcn/ui, lucide-react, react-hook-form, and zod
alongside the existing next/react packages. Make sure the app’s package manifest
reflects any UI libraries used by the app so the dependency list matches the
coding guidelines and the components in the app can resolve correctly.
Source: Coding guidelines
| @@ -0,0 +1 @@ | |||
| Topic: {{triggerNode_1.output.topic}} Position A: {{triggerNode_1.output.positionA}} Position B: {{triggerNode_1.output.positionB}} Debate Transcript: {{triggerNode_1.output.transcript}} Evaluate the debate above and produce your verdict as valid JSON matching the output schema. | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if any existing kit prompt files demonstrate object serialization in Mustache templates.
rg -n 'output\.\w+\b' --glob 'kits/*/prompts/*.md' | head -30Repository: Lamatic/AgentKit
Length of output: 154
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the debate prompt files and any template-engine helpers relevant to interpolation.
printf '\n## prompt files\n'
git ls-files 'kits/debate-arena/prompts/*.md' || true
printf '\n## search for template serialization or mustache-style rendering\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
'JSON\.stringify|stringify\(|mustache|handlebars|template engine|interpolat|serialize' \
.Repository: Lamatic/AgentKit
Length of output: 30023
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the specific prompt file and nearby prompt patterns.
printf '\n## file size\n'
wc -l kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
printf '\n## prompt content\n'
cat -n kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
printf '\n## neighboring debate prompts\n'
git ls-files 'kits/debate-arena/prompts/*.md' | sed -n '1,40p'Repository: Lamatic/AgentKit
Length of output: 1010
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect all debate-arena prompt files for interpolation style and any explicit serialization.
for f in kits/debate-arena/prompts/*.md; do
echo "### $f"
sed -n '1,4p' "$f"
echo
done
printf '\n## search for literal object/array fields in debate prompts\n'
rg -n '\{\{[^}]+\}\}' kits/debate-arena/prompts/*.mdRepository: Lamatic/AgentKit
Length of output: 4507
🌐 Web query:
Lamatic template engine object interpolation mustache JSON stringify prompt variables
💡 Result:
In Lamatic.ai, template engines and prompt interfaces utilize a double-brace syntax ({{variableName}}) for object interpolation and variable injection [1][2][3]. Key aspects of variable handling include: Interpolation Syntax: Variables are injected into prompts and configurations using the {{key}} format [4][2][3]. When referencing output from specific nodes, the syntax typically follows the pattern {{nodeId.output.field}} [1][5]. Prompt Templates: The Prompt IDE and LLM nodes support modular prompt construction [2][3]. You can insert variables by typing {{ to open a selection menu or by manually typing the variable name [2][6][3]. These templates can be saved, versioned, and reused across different flows [2][6][3]. Structured Data and JSON: While prompt variables are interpolated as strings within the template text, you can manage complex structured data using Code Nodes [7][8]. In a Code Node, you can perform standard JavaScript operations, including JSON.stringify to convert objects into strings before passing them to downstream nodes or prompt templates [7]. Additionally, the platform provides specific nodes, such as the Generate JSON Node, which uses Zod-based schemas to ensure AI output conforms to a strict JSON structure [9]. Variable Management: Variables can be managed centrally via Variable Nodes or project-level settings (Secrets), allowing for dynamic data passing and secure configuration management without hardcoding values [1][10].
Citations:
- 1: https://github.com/lamatic/docs/blob/main/pages/docs/nodes/logic/variable-node.mdx
- 2: https://github.com/lamatic/docs/blob/main/pages/guides/tutorials/prompt-engineering-with-lamatic.mdx
- 3: https://lamatic.ai/docs/ide/prompt-ide
- 4: https://lamatic.ai/docs/flows/flow-config
- 5: https://github.com/lamatic/docs/blob/main/pages/docs/nodes/ai/generate-text-node.mdx
- 6: https://lamatic.ai/guides/tutorials/prompt-engineering-with-lamatic
- 7: https://lamatic.ai/docs/flows/variables
- 8: https://lamatic.ai/docs/ide/code-ide
- 9: https://lamatic.ai/docs/nodes/ai/generate-json-node
- 10: https://lamatic.ai/docs/studio/studio-variables-and-secrets
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the target prompt and inspect nearby prompt files for templating style.
printf '## target file\n'
wc -l kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
cat -n kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
printf '\n## all prompt files in kits/debate-arena/prompts\n'
git ls-files 'kits/debate-arena/prompts/*.md'Repository: Lamatic/AgentKit
Length of output: 1011
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the debate-arena flow and any code that shapes the values fed into these prompts.
printf '## debate arena files\n'
git ls-files 'kits/debate-arena/**' | sed -n '1,120p'
printf '\n## search for positionA, positionB, transcript, and debate-round wiring\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
'positionA|positionB|transcript|debate-judge_instructorllmnode-239|debate-round_instructorllmnode-435|debate-setup_instructorllmnode-980' \
kits/debate-arenaRepository: Lamatic/AgentKit
Length of output: 15187
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the flow source if present and the surrounding docs that describe how prompts receive data.
fd -a 'debate-arena' kitsRepository: Lamatic/AgentKit
Length of output: 192
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find the debate-arena flow source and inspect the trigger/output mapping for the judge node.
flow_file="$(fd -a 'debate-arena.*\.ts$|debate-arena.*\.js$|debate-arena' kits | head -1 || true)"
printf 'flow candidate: %s\n' "$flow_file"
if [ -n "$flow_file" ] && [ -f "$flow_file" ]; then
wc -l "$flow_file"
cat -n "$flow_file"
fiRepository: Lamatic/AgentKit
Length of output: 208
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check whether the debate-arena kit already serializes these structured fields before the prompt node.
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
'JSON\.stringify\(|positionA|positionB|transcript|debate-arena' \
kits/debate-arenaRepository: Lamatic/AgentKit
Length of output: 12296
Serialize the judge inputs before interpolation (kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md). positionA, positionB, and transcript are structured values; emit JSON text here so the judge sees the real debate data instead of opaque object/array text.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 1-1: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🤖 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/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md` at
line 1, The judge prompt is interpolating structured values directly, so the
model may see opaque object/array text instead of usable debate content. Update
the prompt source in debate-judge_instructorllmnode-239_user_1.md to serialize
triggerNode_1.output.positionA, triggerNode_1.output.positionB, and
triggerNode_1.output.transcript into JSON text before insertion. Keep the Topic
field as-is, but ensure the debate inputs are rendered as explicit JSON payloads
so the judge can reliably evaluate the actual data.
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/debate-arena/.env.example`:
- Around line 7-9: Replace the hard-coded debate flow UUIDs in the .env.example
template with generic placeholders, since these values are deployment-specific
and should not point new installs to a particular workspace. Update the example
entries for DEBATE_SETUP_FLOW_ID, DEBATE_ROUND_FLOW_ID, and DEBATE_JUDGE_FLOW_ID
in the debate-arena env template, while keeping the existing “copy flow id”
guidance so users know where to obtain the real 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
Run ID: d9fb03c6-6b29-48fc-93bb-207ae6a2f813
📒 Files selected for processing (1)
kits/debate-arena/.env.example
|
Pushed fixes for all 6 review comments plus the follow-up on
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/debate-arena/apps/app/globals.css (1)
218-378: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy liftMission brief: convert these hardcoded palette values to CSS variables.
Agent, the accent (
#5b7cfa), border (#2a2e37), text (#e8e9ed/#9aa0ab), and surface (#181b21/#14171d) colors, plus the confidence/dangerrgba(...)tints, recur across dozens of selectors here. The project standard for kit apps is to drive styling through CSS variables. Centralize these in a:roottoken set and reference viavar(--...)so theming stays consistent and a single edit propagates.As per coding guidelines: "For kit Next.js apps: use CSS variables for styling."
🎨 Illustrative token approach
+:root { + --color-accent: `#5b7cfa`; + --color-border: `#2a2e37`; + --color-surface: `#181b21`; + --color-surface-alt: `#14171d`; + --color-text: `#e8e9ed`; + --color-text-muted: `#9aa0ab`; + --color-danger: `#fa5b5b`; +}Then, e.g.:
.ghost-button:hover { - border-color: `#5b7cfa`; - color: `#e8e9ed`; + border-color: var(--color-accent); + color: var(--color-text); }🤖 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/debate-arena/apps/app/globals.css` around lines 218 - 378, The palette in this stylesheet is still hardcoded, while the kit app standard requires CSS variables for theming and consistency. Move the repeated accent, border, text, surface, and confidence/danger tint values into a :root token set in globals.css, then update the affected selectors (such as .ghost-button, .error-banner, .history-panel, .history-list button, and the confidence-tag variants) to reference var(--...) tokens instead of literal colors. Keep the existing visual styles intact while centralizing the values so future theme changes flow through one place.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/debate-arena/apps/app/page.tsx`:
- Around line 276-308: regenerateRound currently updates only the selected turn,
which can leave later rebuttals inconsistent with the revised statement. In
page.tsx, either restrict the Regenerate action to the latest turn, or when
regenerateRound runs, also mark or rebuild downstream turns after the updated
index so transcript stays coherent. Use regenerateRound, runDebateRound, and
setTranscript as the key places to adjust the behavior.
- Around line 34-44: The persisted history parsing in loadHistory() only
verifies the top-level JSON is an array, so invalid items can still reach
loadFromHistory() and break when accessing entry.setup or entry.verdict. Update
loadHistory() to validate each parsed item against the SavedDebate shape (or add
equivalent type guards before returning), and filter out any malformed entries
so only safe records are returned for loadFromHistory() to consume.
---
Outside diff comments:
In `@kits/debate-arena/apps/app/globals.css`:
- Around line 218-378: The palette in this stylesheet is still hardcoded, while
the kit app standard requires CSS variables for theming and consistency. Move
the repeated accent, border, text, surface, and confidence/danger tint values
into a :root token set in globals.css, then update the affected selectors (such
as .ghost-button, .error-banner, .history-panel, .history-list button, and the
confidence-tag variants) to reference var(--...) tokens instead of literal
colors. Keep the existing visual styles intact while centralizing the values so
future theme changes flow through one place.
🪄 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: eaadd456-b8c7-4a9d-a1d8-f2838863625c
📒 Files selected for processing (3)
kits/debate-arena/apps/app/globals.csskits/debate-arena/apps/app/page.tsxkits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.md
|
@coderabbitai review |
✅ Action performedReview finished.
|
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/debate-arena/apps/app/page.tsx (1)
334-366: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRegenerating the last turn leaves the verdict and saved record out of sync.
Good work sealing off the earlier turns. But this button also stays live once
phase === "done". When an operative regenerates the final turn,transcriptis swapped for a fresh statement whileverdict(still on screen) and the already-persisted history entry keep referencing the retired statement. The "Download as Markdown" then exports the new transcript stapled to the stale verdict, and the saved history record diverges from what's displayed.Simplest containment: when regenerating with a verdict present, invalidate it so the debate is clearly no longer "judged" (and let the user re-run the judge), rather than showing a contradictory pairing.
🧩 One option: drop the stale verdict on regenerate
const updated = [...transcript]; updated[turnIndex] = res.data; setTranscript(updated); + + // The prior verdict/history entry were judged against the replaced + // statement -- clear them so the UI doesn't show a contradictory pairing. + if (verdict) { + setVerdict(null); + setPhase("debating"); + } }🤖 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/debate-arena/apps/app/page.tsx` around lines 334 - 366, The regenerateRound flow in page.tsx leaves the final verdict and persisted history stale when the last turn is regenerated. Update regenerateRound so that after a successful replacement of the turn in transcript, any existing verdict is cleared (and any related judged/completed state is reset) when phase is done or a verdict is present, using the regenerateRound, setTranscript, and verdict-related state in the page component. This keeps the displayed debate and saved/exported record aligned and forces the judge to be rerun on the new transcript.
🤖 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/debate-arena/apps/app/globals.css`:
- Around line 249-253: The .field-error rule is using a hardcoded error color
instead of the shared theme token. Update the stylesheet to use a CSS variable
for this color, and define the token alongside the other theme variables in the
html/body theme block so .field-error and .error-banner can share the same
source of truth. Use the existing .field-error selector and the main theme token
definitions to locate the change.
---
Outside diff comments:
In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 334-366: The regenerateRound flow in page.tsx leaves the final
verdict and persisted history stale when the last turn is regenerated. Update
regenerateRound so that after a successful replacement of the turn in
transcript, any existing verdict is cleared (and any related judged/completed
state is reset) when phase is done or a verdict is present, using the
regenerateRound, setTranscript, and verdict-related state in the page component.
This keeps the displayed debate and saved/exported record aligned and forces the
judge to be rerun on the new transcript.
🪄 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: b4ddf53d-dd99-4c79-beb8-1e63bef60324
📒 Files selected for processing (2)
kits/debate-arena/apps/app/globals.csskits/debate-arena/apps/app/page.tsx
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
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/debate-arena/apps/app/page.tsx`:
- Around line 437-449: Disable the history entry buttons and the Clear history
button while a debate is active or regeneration is in progress, and update
loadFromHistory to defensively reset regeneratingRound when loading a past
debate. Use the existing isRunning state and regeneratingRound state around the
history list rendering and clearHistory action, and make sure loadFromHistory
remains the only place that restores ctxRef.current and related debate state.
🪄 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: 9b379144-6e34-4ba0-a5f8-691c668edac1
⛔ Files ignored due to path filters (1)
kits/debate-arena/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (30)
kits/debate-arena/.env.examplekits/debate-arena/.gitignorekits/debate-arena/README.mdkits/debate-arena/agent.mdkits/debate-arena/apps/.env.examplekits/debate-arena/apps/.eslintrc.jsonkits/debate-arena/apps/actions/orchestrate.tskits/debate-arena/apps/app/globals.csskits/debate-arena/apps/app/layout.tsxkits/debate-arena/apps/app/page.tsxkits/debate-arena/apps/lib/lamatic-client.tskits/debate-arena/apps/next-env.d.tskits/debate-arena/apps/next.config.mjskits/debate-arena/apps/package.jsonkits/debate-arena/apps/postcss.config.mjskits/debate-arena/apps/tsconfig.jsonkits/debate-arena/constitutions/default.mdkits/debate-arena/flows/debate-judge.tskits/debate-arena/flows/debate-round.tskits/debate-arena/flows/debate-setup.tskits/debate-arena/lamatic.config.tskits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.tskits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.tskits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.tskits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.mdkits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.mdkits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.mdkits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.md
Summary
Adds a new kit, "Debate Arena": two AI agents debate opposing positions on any tradeoff or decision across multiple rounds, then an impartial judge synthesizes a pros/cons matrix and a final recommendation with an honest confidence level.
Three Lamatic flows:
Plus a Next.js app in apps/ that orchestrates the three flows end-to-end and renders the debate live.
PR Checklist
1. Select Contribution Type
2. General Requirements
3. File Structure
4. Validation
kits/debate-arena/README.mdkits/debate-arena/agent.mdkits/debate-arena/constitutions/default.mdkits/debate-arena/lamatic.config.tskits/debate-arena/.env.examplekits/debate-arena/.gitignorekits/debate-arena/flows/debate-setup.tskits/debate-arena/flows/debate-round.tskits/debate-arena/flows/debate-judge.tskits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.mdkits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.mdkits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.mdkits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.mdkits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.mdkits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.tskits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.tskits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.tskits/debate-arena/apps/.env.examplekits/debate-arena/apps/.eslintrc.jsonkits/debate-arena/apps/actions/orchestrate.tskits/debate-arena/apps/app/globals.csskits/debate-arena/apps/app/layout.tsxkits/debate-arena/apps/app/page.tsxkits/debate-arena/apps/lib/lamatic-client.tskits/debate-arena/apps/next-env.d.tskits/debate-arena/apps/next.config.mjskits/debate-arena/apps/package.jsonkits/debate-arena/apps/package-lock.jsonkits/debate-arena/apps/postcss.config.mjskits/debate-arena/apps/tsconfig.jsonkits/debate-arena/flows/*.ts; noflow.jsonartifacts found underkits/debate-arena/)triggerNode(GraphQL/API trigger withadvance_schema)dynamicNode(InstructorLLM node configured via model/prompt references, outputs structured JSON)responseNode(maps Instructor output fields into the flow response)defaultEdge(trigger → dynamicNode → responseNode)responseEdge(trigger → responseNode)debate-setup{ topic }{ cleanTopic, positionA, positionB, context }(topic reframed into two opposed positions)debate-round{ topic, position, opponentPosition, transcript, round, isRebuttal }{ statement, keyPoint }(opening vs rebuttal behavior; transcript-grounded)debate-judge{ topic, positionA, positionB, transcript }pros/consfor each side,strongestArgA/B,recommendation,confidence(low/medium/high), andcaveats