feat(copilot): add goal decomposition step before agent building#12731
feat(copilot): add goal decomposition step before agent building#12731
Conversation
…_model_parameter Some AI-category blocks do not expose a "model" input property in their inputSchema. The fixer was injecting a default model value into these blocks, which is incorrect. Now checks for the presence of "model" in inputSchema properties before attempting to set or validate the model field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a decompose_goal tool that breaks user goals into sub-instructions before building. Users see a plan checklist and can approve or modify before the agent is created, improving transparency and control. - Backend: DecomposeGoalTool, TaskDecompositionResponse model, system prompt update - Frontend: DecomposeGoal component with StepItem checklist, approve/modify buttons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ss companion text - Move decomposition prompt from prompting.py to agent_generation_guide.md as a required pre-build gate - Add tool-decompose_goal to CUSTOM_TOOL_TYPES so it renders individually (not collapsed) - Add task_decomposition to INTERACTIVE_RESPONSE_TYPES so the box is pinned to response after streaming - Filter out text parts (table) from response when decompose_goal is pinned - Hide decompose_goal during streaming so the box only appears once all reasoning is complete and Approve is immediately actionable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ming render - Revert ChatMessagesContainer streaming filter — decompose_goal now visible during stream - Remove text suppression in splitReasoningAndResponse — table message is allowed alongside sub-instructions box Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…into feat/task-decomposition-copilot
|
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
|
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 backend "decompose_goal" tool and response models, registers it, requires goal decomposition in the agent guide, and implements a frontend UI to render, edit, approve (auto‑approve) or retry decomposed build steps; also updates schemas, routing types, and tests. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant Frontend as Frontend UI
participant Backend as Decompose Tool
participant DB as Storage
User->>Frontend: Submit goal + proposed steps
Frontend->>Backend: execute decompose_goal(goal, steps)
Backend->>Backend: Validate inputs (goal, steps, ≤ MAX_STEPS)
alt validation fails
Backend-->>Frontend: ErrorResponse
Frontend->>User: Show error / retry
else valid
Backend-->>Frontend: TaskDecompositionResponse (steps, requires_approval)
Frontend->>User: Render plan (editable if last message → show approve/modify + countdown)
alt User edits & approves
User->>Frontend: Edit steps + Approve
Frontend->>Backend: submit approval/modifications
else countdown expires
Frontend->>Backend: auto-submit approval
end
Frontend->>DB: (optional) persist plan / trigger build
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
/review |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/copilot/tools/decompose_goal.py (1)
18-18: AlignMAX_STEPSwith the guide’s decomposition constraint.The tool currently allows 10 steps, while the guide instructs “4–8 steps max.” Keeping both aligned avoids planner/tool contract drift.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/backend/copilot/tools/decompose_goal.py` at line 18, The MAX_STEPS constant in autogpt_platform/backend/backend/copilot/tools/decompose_goal.py allows 10 steps which contradicts the guide's “4–8 steps max”; change the MAX_STEPS value from 10 to 8 (update the MAX_STEPS symbol) and adjust any related comments or tests that reference the old limit so the tool’s decomposition constraint matches the guide.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/backend/copilot/tools/decompose_goal.py`:
- Around line 112-121: The list comprehension that builds decomposition_steps
assumes every item in steps is a dict and calls step.get(...), which will raise
if an item is malformed; update the logic around DecompositionStepModel creation
(decomposition_steps) to validate each step item (the steps iterable) is a dict
before accessing .get, and if any item is not a dict either (a) return or raise
a structured ErrorResponse indicating invalid step shape or (b) skip/normalize
the item to a safe default and log the problem; ensure the fix touches the
decomposition_steps construction and any surrounding function that consumes it
so the structured ErrorResponse path is used for malformed inputs.
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 99-118: The ContentHint text is unconditional but should reflect
output.requires_approval; update DecomposeGoal.tsx so the hint is conditional or
its copy changes based on the output.requires_approval flag (the existing JSX
uses output.requires_approval and handlers handleApprove/handleModify) — either
move the <ContentHint> block inside the same conditional that renders the
Approve/Modify buttons and keep the "Review the plan above and approve to start
building." copy, or render a different message (e.g., "Review the plan above."
or "No approval required; proceed to start building.") when
output.requires_approval is false so the hint matches the UI state.
- Around line 41-42: The UI currently only shows the error card when a parsed
`output` exists, so when `part.state === "output-error"` but `output` is
missing/unparseable users see no retry UI; update the render logic in
DecomposeGoal to check `part.state === "output-error"` separately from `output`
parsing and render a fallback error card (same visual/error message + retry
action) whenever `part.state` is `"output-error"` and `isOperating` is false,
using the existing retry handler (reuse the same retry callback used for parsed
errors) and the same error-card component to ensure users always get a retry
option even if `output` could not be parsed.
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/helpers.tsx:
- Around line 41-61: The parseOutput function currently uses loose `"steps" in
output` and `"error" in output` checks allowing malformed objects through and
hiding message-only errors; update parseOutput to first ensure output is a
non-null object, then perform strict shape validation before casting: for
TaskDecompositionOutput ensure output.steps is Array.isArray(output.steps) and
each step has the expected fields/types (e.g., string/number properties) and
output.goal is a string; for DecomposeErrorOutput accept either an "error"
string or an object with a "message" string and validate that type before
returning; avoid direct casts until these guards pass and return null for
anything that fails validation so UI receives only well-formed outputs from
parseOutput.
In `@autogpt_platform/frontend/src/app/api/openapi.json`:
- Line 12520: ToolResponseUnion is missing the new TaskDecompositionResponse
(and nested DecompositionStepModel) so OpenAPI codegen won't export those
schemas; update the ToolResponseUnion definition (in the same module where
ToolResponseUnion is declared) to include TaskDecompositionResponse and
DecompositionStepModel, and add any required imports for
TaskDecompositionResponse so the union references the model symbols directly
(ensure the enum ResponseType includes "task_decomposition" already). This
change will expose TaskDecompositionResponse and DecompositionStepModel in the
generated OpenAPI schema for frontend codegen.
---
Nitpick comments:
In `@autogpt_platform/backend/backend/copilot/tools/decompose_goal.py`:
- Line 18: The MAX_STEPS constant in
autogpt_platform/backend/backend/copilot/tools/decompose_goal.py allows 10 steps
which contradicts the guide's “4–8 steps max”; change the MAX_STEPS value from
10 to 8 (update the MAX_STEPS symbol) and adjust any related comments or tests
that reference the old limit so the tool’s decomposition constraint matches the
guide.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6f9d50e2-cbf9-4127-be72-cb9978ed80e0
📒 Files selected for processing (10)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsxautogpt_platform/frontend/src/app/api/openapi.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Seer Code Review
🧰 Additional context used
📓 Path-based instructions (14)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend developmentFormat frontend code using
pnpm format
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development
autogpt_platform/frontend/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g.graphID,useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Nodark:Tailwind classes — the design system handles dark mode
Use Next.js<Link>for internal navigation — never raw<a>tags
Noanytypes unless the value genuinely can be anything
No linter suppressors (//@ts-ignore``,// eslint-disable) — fix the actual issue
Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer
Use generated API hooks from `@/app/api/generated/endpoints/` with pattern `use{Method}{Version}{OperationName}` and regenerate with `pnpm generate:api`
Do not use `useCallback` or `useMemo` unless asked to optimise a given function
Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from@/app/api/__generated__/endpoints/following the patternuse{Method}{Version}{OperationName}, and regenerate withpnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local/componentsfolder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not useuseCallbackoruseMemounless asked to optimise a given function
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/**/*.{tsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/src/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Component props should use
interface Props { ... }(not exported) unless the interface needs to be used outside the component
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/src/app/(platform)/**/components/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)
Put sub-components in local
components/folder
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsx
autogpt_platform/frontend/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)
autogpt_platform/frontend/**/*.tsx: Component props should betype Props = { ... }(not exported) unless it needs to be used outside the component
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*
Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
autogpt_platform/frontend/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
No barrel files or
index.tsre-exports in the frontendDo not type hook returns, let Typescript infer as much as possible
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/frontend/src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Do not type hook returns, let Typescript infer as much as possible
Extract component logic into custom hooks grouped by concern, not by component. Each hook should represent a cohesive domain of functionality (e.g., useSearch, useFilters, usePagination) rather than bundling all state into one useComponentState hook. Put each hook in its own
.tsfile.
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/backend/**/*.md
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Document agent responsibilities and interfaces in markdown files
Files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
autogpt_platform/{backend,autogpt_libs}/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Format Python code with
poetry run format
Files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
🧠 Learnings (56)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '@/app/api/__generated__/' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local `/components` folder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-03-24T02:23:31.305Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/RateLimitResetDialog/RateLimitResetDialog.tsx:0-0
Timestamp: 2026-03-24T02:23:31.305Z
Learning: In the Copilot platform UI code, follow the established Orval hook `onError` error-handling convention: first explicitly detect/handle `ApiError`, then read `error.response?.detail` (if present) as the primary message; if not available, fall back to `error.message`; and finally fall back to a generic string message. This convention should be used for generated Orval hooks even if the custom Orval mutator already maps details into `ApiError.message`, to keep consistency across hooks/components (e.g., `useCronSchedulerDialog.ts`, `useRunGraph.ts`, and rate-limit/reset flows).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-03-31T14:04:42.444Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx:172-177
Timestamp: 2026-03-31T14:04:42.444Z
Learning: In the Copilot frontend components under autogpt_platform/frontend/src/app/(platform)/copilot/, Tailwind dark mode variants (e.g., `dark:*`) are intentional and should be allowed. Do not flag `dark:` utilities in these Copilot UI components as incorrect; they are used to ensure proper contrast and correct behavior in both light and dark themes.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-02-27T10:45:55.700Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:55.700Z
Learning: As of PR `#12213`, MCP tool response types (MCPToolsDiscoveredResponse, MCPToolOutputResponse) are defined in openapi.json and frontend code in autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx uses the generated types from `@/app/api/__generated__/`. Other tools like RunBlock still use inline TypeScript interfaces (e.g., BlockDetailsResponse) for SSE stream payloads that are not included in openapi.json schemas. The pattern is tool-specific: use generated types when available in openapi.json, use inline types only when the payload schema is truly SSE-stream-only and not exposed via OpenAPI.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-26T00:32:06.673Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12566
File: autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts:968-974
Timestamp: 2026-03-26T00:32:06.673Z
Learning: In Significant-Gravitas/AutoGPT, the admin-facing methods in `autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts` (e.g., `addUserCredits`, `getUsersHistory`, `getUserRateLimit`, `resetUserRateLimit`) intentionally follow the legacy `BackendAPI` pattern with manually defined types in `autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts`. Migrating these admin endpoints to the generated OpenAPI hooks (`@/app/api/__generated__/endpoints/`) is a planned separate effort covering all admin endpoints together, not done piecemeal per PR. Do not flag individual admin type additions in `types.ts` as blocking issues.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsautogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No linter suppressors (`// ts-ignore`, `// eslint-disable`) — fix the actual issue
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Fully capitalize acronyms in symbols, e.g. `graphID`, `useBackendAPI`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 Learning: 2026-03-23T06:36:25.447Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/frontend/src/app/(platform)/library/components/LibraryImportWorkflowDialog/useLibraryImportWorkflowDialog.ts:0-0
Timestamp: 2026-03-23T06:36:25.447Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, the `LibraryImportWorkflowDialog` (previously `LibraryImportCompetitorDialog`) and its associated generated API hook (`usePostV2ImportACompetitorWorkflowN8nMakeComZapier` / `usePostV2ImportAWorkflowFromAnotherToolN8nMakeComZapier`) were removed in a subsequent refactor. Workflow import from external platforms (n8n, Make.com, Zapier) now uses a server action `fetchWorkflowFromUrl` instead of direct API calls or generated orval hooks. Do not expect or flag missing generated hook usage for workflow import in `autogpt_platform/frontend/src/app/(platform)/library/components/LibraryImportWorkflowDialog/`.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 Learning: 2026-04-08T17:26:41.536Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: classic/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:41.536Z
Learning: Applies to classic/.autogpt/autogpt.yaml : Workspace-level permissions in {workspace}/.autogpt/autogpt.yaml should use pattern syntax: command_name(glob_pattern) with support for {workspace}, **, and * tokens
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 Learning: 2026-04-08T17:26:23.273Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:23.273Z
Learning: Applies to autogpt_platform/frontend/**/AGENTS.md : Document agent responsibilities and capabilities in AGENTS.md with clear descriptions of what each agent does
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:18.156Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:18.156Z
Learning: Applies to autogpt_platform/backend/**/*.md : Document agent responsibilities and interfaces in markdown files
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.239Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.239Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Include clear usage examples in AGENTS.md for each agent to facilitate integration and reduce onboarding time
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.239Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.239Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Maintain AGENTS.md as the single source of truth for agent specifications and interfaces across the codebase
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:23.273Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:23.273Z
Learning: Applies to autogpt_platform/frontend/**/AGENTS.md : Use AGENTS.md as the central registry for agent definitions and their capabilities
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.239Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.239Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Document all agents in AGENTS.md with their name, description, input/output schemas, and usage examples
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-27T08:39:45.696Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12592
File: autogpt_platform/frontend/AGENTS.md:1-3
Timestamp: 2026-03-27T08:39:45.696Z
Learning: In Significant-Gravitas/AutoGPT, Claude is the primary coding agent. AGENTS.md files intentionally retain Claude-specific wording (e.g., "CLAUDE.md - Frontend", "This file provides guidance to Claude Code") even though AGENTS.md is the canonical cross-agent instruction source. Do not flag Claude-specific titles or phrasing in AGENTS.md files as issues.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:06.525Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:06.525Z
Learning: Applies to AGENTS.md : Document all agent configurations and capabilities in AGENTS.md
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-04T08:04:35.881Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12273
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:216-220
Timestamp: 2026-03-04T08:04:35.881Z
Learning: In the AutoGPT Copilot backend, ensure that SVG images are not treated as vision image types by excluding 'image/svg+xml' from INLINEABLE_MIME_TYPES and MULTIMODAL_TYPES in tool_adapter.py; the Claude API supports PNG, JPEG, GIF, and WebP for vision. SVGs (XML text) should be handled via the text path instead, not the vision path.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-04-01T04:17:41.600Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12632
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-01T04:17:41.600Z
Learning: When reviewing AutoGPT Copilot tool implementations, accept that `readOnlyHint=True` (provided via `ToolAnnotations`) may be applied unconditionally to *all* tools—even tools that have side effects (e.g., `bash_exec`, `write_workspace_file`, or other write/save operations). Do **not** flag these tools for having `readOnlyHint=True`; this is intentional to enable fully-parallel dispatch by the Anthropic SDK/CLI and has been E2E validated. Only flag `readOnlyHint` issues if they conflict with the established `ToolAnnotations` behavior (e.g., missing/incorrect propagation relative to the intended annotation mechanism).
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-04T12:19:39.243Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12279
File: autogpt_platform/backend/backend/copilot/tools/base.py:184-188
Timestamp: 2026-03-04T12:19:39.243Z
Learning: In autogpt_platform/backend/backend/copilot/tools/, ensure that anonymous users always pass user_id=None to tool execution methods. The anon_ prefix (e.g., anon_123) is used only for PostHog/analytics distinct_id and must not be used as an actual user_id. Use a simple truthiness check on user_id (e.g., if user_id: ... else: ... or a dedicated is_authenticated flag) to distinguish anonymous from authenticated users, and review all tool execution call sites within this directory to prevent accidentally forwarding an anon_ user_id to tools.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-31T14:22:26.566Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:26.566Z
Learning: In files under autogpt_platform/backend/backend/copilot/tools/, ensure agent graph enrichment uses the typed Pydantic model `backend.data.graph.Graph` for `AgentInfo.graph` (i.e., `Graph | None`), not `dict[str, Any]`. When enriching with graph data (e.g., `_enrich_agents_with_graph`), prefer calling `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly to retrieve the typed `Graph` object rather than routing through JSON conversions like `get_agent_as_json()` / `graph_to_json()`.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-05T15:42:08.207Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12297
File: .claude/skills/backend-check/SKILL.md:14-16
Timestamp: 2026-03-05T15:42:08.207Z
Learning: In Python files under autogpt_platform/backend (recursively), rely on poetry run format to perform formatting (Black + isort) and linting (ruff). Do not run poetry run lint as a separate step after poetry run format, since format already includes linting checks.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-16T16:35:40.236Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/api/features/workflow_import.py:54-63
Timestamp: 2026-03-16T16:35:40.236Z
Learning: Avoid using the word 'competitor' in public-facing identifiers and text. Use neutral naming for API paths, model names, function names, and UI text. Examples: rename 'CompetitorFormat' to 'SourcePlatform', 'convert_competitor_workflow' to 'convert_workflow', '/competitor-workflow' to '/workflow'. Apply this guideline to files under autogpt_platform/backend and autogpt_platform/frontend.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-03-31T15:37:38.626Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/backend/backend/copilot/tools/agent_generator/fixer.py:37-47
Timestamp: 2026-03-31T15:37:38.626Z
Learning: When validating/constructing Anthropic API model IDs in Significant-Gravitas/AutoGPT, allow the hyphen-separated Claude Opus 4.6 model ID `claude-opus-4-6` (it corresponds to `LlmModel.CLAUDE_4_6_OPUS` in `autogpt_platform/backend/backend/blocks/llm.py`). Do NOT require the dot-separated form in Anthropic contexts. Only OpenRouter routing variants should use the dot separator (e.g., `anthropic/claude-opus-4.6`); `claude-opus-4-6` should be treated as correct when passed to Anthropic, and flagged only if it’s used in the OpenRouter path where the dot form is expected.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/__init__.pyautogpt_platform/backend/backend/copilot/tools/models.pyautogpt_platform/backend/backend/copilot/tools/decompose_goal.py
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{tsx,ts} : Structure React components as: ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts (exception: small 3-4 line components can be inline; render-only components can be direct files)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.tsx : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{ts,tsx} : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`, use design system components from `src/components/` (atoms, molecules, organisms), and never use `src/components/__legacy__/*`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.tsx : Use Storybook for design system components in `src/components/`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{stories.tsx,stories.ts} : Add/update Storybook stories for UI components in frontend development
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/components/StepItem.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.tsx : Component props should be `type Props = { ... }` (not exported) unless it needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use function declarations for components and handlers (not arrow functions) in React components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should use `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T21:25:15.983Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12536
File: autogpt_platform/frontend/src/app/api/openapi.json:5770-5790
Timestamp: 2026-03-24T21:25:15.983Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12536`
File: autogpt_platform/frontend/src/app/api/openapi.json
Learning: The OpenAPI spec file is auto-generated; per established convention, endpoints generally declare only 200/201, 401, and 422 responses. Do not suggest adding explicit 403/404 response entries for single operations unless planning a repo-wide spec update. Prefer clarifying such behaviors in endpoint descriptions/docstrings instead of altering response maps.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-03-04T23:57:59.510Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:5593-5593
Timestamp: 2026-03-04T23:57:59.510Z
Learning: In Significant-Gravitas/AutoGPT backend (FastAPI), openapi.json is autogenerated: descriptions come from route docstrings and schemas from response_model/type annotations. To prevent drift when models are renamed (e.g., AdminView variants), avoid embedding specific schema class names in route docstrings; instead describe behavior, or keep names synced via backend edits—never hand-edit frontend/src/app/api/openapi.json.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-03-01T07:58:56.207Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:58:56.207Z
Learning: When a backend field represents sensitive data, use a secret type (e.g., Pydantic SecretStr with length constraints) so OpenAPI marks it as a password/writeOnly field. Apply this pattern to similar sensitive request fields across API schemas so generated TypeScript clients and docs treat them as secrets and do not mishandle sensitivity. Review all openapi.jsons where sensitive inputs are defined and replace plain strings with SecretStr-like semantics with appropriate minLength constraints.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-03-07T07:43:09.871Z
Learnt from: kcze
Repo: Significant-Gravitas/AutoGPT PR: 12328
File: autogpt_platform/frontend/src/app/api/openapi.json:1116-1118
Timestamp: 2026-03-07T07:43:09.871Z
Learning: For autogpt_platform/frontend/src/app/api/openapi.json, preserve the existing behavior: HTTPBearerJWT is declared at the router level with Depends(auth.get_user_id) returning None for unauthenticated users; treat as optional auth. Do not change per-operation security descriptions unless you plan a repo-wide OpenAPI update. If you change this file, prefer clarifying operation descriptions rather than altering security requirements.
Applied to files:
autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Use function declarations (not arrow functions) for components and handlers
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use function declarations for components and handlers, use arrow functions only for callbacks
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/src/**/*.ts : Extract component logic into custom hooks grouped by concern, not by component. Each hook should represent a cohesive domain of functionality (e.g., useSearch, useFilters, usePagination) rather than bundling all state into one useComponentState hook. Put each hook in its own `.ts` file.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.tsx : Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Only use Phosphor Icons (phosphor-icons/react) for icons in frontend components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
📚 Learning: 2026-04-01T16:01:28.873Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx:5-5
Timestamp: 2026-04-01T16:01:28.873Z
Learning: In Significant-Gravitas/AutoGPT, the `IconType` import from `@/components/__legacy__/ui/icons` in `autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx` is pre-existing and used by `MobileNavBar` for icon prop construction. Migrating it to Phosphor Icons requires a separate refactor of `MobileNavBar` and should not be flagged as a blocking issue in PRs that do not touch `MobileNavBar`.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/helpers.tsx
There was a problem hiding this comment.
📋 Automated Review — PR #12731
PR #12731 — feat(copilot): add goal decomposition step before agent building
Author: anvyle | Files: 10
🎯 Verdict: REQUEST_CHANGES
PR Description Quality
What This PR Does
Adds a new decompose_goal copilot tool that breaks a user's high-level goal into a step-by-step build plan (max 10 steps) before the agent is actually constructed. The backend returns a structured TaskDecompositionResponse with numbered steps, and the frontend renders an interactive checklist UI with Approve/Modify buttons. This gates the agent-building process behind explicit user approval, giving users visibility and control over what the copilot will build.
Specialist Findings
🛡️ Security require_approval parameter is LLM-controllable, meaning the LLM can bypass the approval gate by setting it to false (decompose_goal.py:73-76). Input fields (description, action, block_name) lack length/content validation. The action field is documented as an enum but accepts any string (decompose_goal.py:58-63).
🟠 LLM-controllable require_approval undermines the feature's core purpose
🟠 No validation on action values against the documented allowlist
🏗️ Architecture ✅ — Clean design. DecomposeGoalTool follows established BaseTool patterns, tool registration is correct, frontend component structure matches conventions (DecomposeGoal/ + helpers.tsx + components/StepItem.tsx). One notable gap: TypeScript interfaces are hand-rolled in helpers.tsx instead of importing from @/app/api/__generated__/models/, diverging from the pattern used by CreateAgent and other tools.
🟠 Hand-rolled types create drift risk with backend (helpers.tsx:16-32)
🟠 TaskDecompositionResponse missing from ToolResponseUnion — OpenAPI codegen won't export it
⚡ Performance ✅ — No concerns. Pure data transformation bounded by MAX_STEPS=10. O(n) time/space where n≤10. No DB queries, no external calls, no shared mutable state. Singleton tool registration is safe since _execute is stateless.
🧪 Testing helpers.tsx has pure functions with branching logic (parseOutput type discrimination). Both the backend (test_run_mcp_tool.py pattern) and frontend (clarifying-questions.test.ts pattern) have established test infrastructure that makes adding tests straightforward (~130 lines total).
🔴 No backend tests for DecomposeGoalTool._execute() validation paths
🔴 No frontend tests for parseOutput type discrimination and helper functions
📖 Quality action prop in StepItem.tsx:15 (accepted but never rendered), magic string "add_block" default (decompose_goal.py:107), redundant step_count field that can drift from len(steps) (models.py:720), and MAX_STEPS=10 contradicts the guide's "4-8 steps max".
🟠 Dead action prop misleads readers (StepItem.tsx:15)
🟡 step_count redundant with len(steps) (models.py:720)
📦 Product handleModify sends an incomplete sentence ("I'd like to modify the plan. Here are my changes: ") directly into chat with no editing affordance (DecomposeGoal.tsx:47). No double-click protection on Approve/Modify buttons. Hardcoded light-mode colors (bg-white, border-slate-200, text-zinc-800) will break dark mode. Status icons lack aria-label for screen readers (helpers.tsx:120).
🔴 Modify button sends incomplete message — broken UX flow
🟠 No double-click guard on Approve/Modify buttons
🟠 Hardcoded light-mode colors break dark mode (DecomposeGoal.tsx:86, StepItem.tsx:22)
📬 Discussion conflicts). All 6 bot review comments (Sentry + CodeRabbit) are unaddressed with no author response. Most critical: TaskDecompositionResponse not added to ToolResponseUnion. Zero human reviews. All test plan checklist items unchecked.
🔎 QA ✅ — End-to-end validation confirmed the feature works: decompose_goal is registered, returns correct task_decomposition responses via SSE, frontend renders the Build Plan accordion with steps and Approve/Modify buttons, and clicking Approve proceeds to agent creation. Minor observation: LLM occasionally skips decompose_goal on complex requests despite the STOP instruction.
🔴 Blockers
- Modify button sends incomplete message (
DecomposeGoal.tsx:47) —handleModifysends"I'd like to modify the plan. Here are my changes: "directly into chat without letting the user type their modifications. This is a broken UX flow — the user sees a dangling half-sentence and must send a follow-up. Pre-fill the chat input instead, or show an inline text area. (Flagged by: product, discussion — 2) - No tests for new backend tool or frontend helpers — Zero test coverage on validation logic (missing goal, missing steps, max steps) and type discrimination (
parseOutput). The repo has established test patterns that make this straightforward. (Flagged by: testing, architect — 2) - Merge conflicts — PR is in
CONFLICTINGstate and cannot be merged. Must rebase against base branch. (Flagged by: discussion — 1)
🟠 Should Fix
TaskDecompositionResponsemissing fromToolResponseUnion(routes.py) — OpenAPI codegen won't export the schema, leaving frontend types incomplete. This was flagged by CodeRabbit and remains unaddressed. (Flagged by: discussion, architect — 2)- LLM can bypass approval gate (
decompose_goal.py:73-76) —require_approvalis exposed as an LLM-controllable parameter. If set tofalse, Approve/Modify buttons disappear, defeating the feature. Hardcode toTrueor remove the parameter. (Flagged by: security, product — 2) - Hardcoded light-mode colors (
DecomposeGoal.tsx:86,StepItem.tsx:22,30) —bg-white,border-slate-200,text-zinc-800won't adapt to dark mode. Use semantic tokens (bg-background,border-border,text-foreground). (Flagged by: product, architect, quality — 3) - No double-click protection (
DecomposeGoal.tsx:43-48) —handleApproveandhandleModifylack a guard state. Users can spam-click and send duplicate messages. Other copilot tools use ahasSentstate pattern. (Flagged by: product — 1) - Dead
actionprop (StepItem.tsx:15) — Accepted in Props, destructured, but never rendered. Either display it as a badge or remove it. (Flagged by: architect, quality — 2) - Hand-rolled TypeScript types (
helpers.tsx:16-32) — Should import from@/app/api/__generated__/models/after runningpnpm generate:api, matching the pattern inCreateAgent/helpers.tsx. (Flagged by: architect — 1) - Missing screen reader labels on status icons (
helpers.tsx:120-150) —StepStatusIconrenders purely visual icons with noaria-label. (Flagged by: product — 1) - Validate
actionagainst allowlist (decompose_goal.py:58-63) — Currently a free-form string despite documented valid values. (Flagged by: security — 1)
🟡 Nice to Have
- Extract action type constants (
decompose_goal.py:107) —"add_block"is a magic string default also referenced in the parameter schema. Define as a constant. (quality) - Pydantic validator for
step_count(models.py:720) — Redundant withlen(steps); a@model_validatorwould prevent drift. (quality) - Align
MAX_STEPSwith guide (decompose_goal.py:18) — Code says 10, guide says 4-8. Add a comment or reconcile. (quality, discussion) - Strengthen prompt for LLM compliance (
agent_generation_guide.md:31) — LLM occasionally skipsdecompose_goalon complex requests. Consider moving Goal Decomposition before Clarifying section. (ui-reviewer)
🔵 Nits
- Rename
isOperating(DecomposeGoal.tsx:47) — Vague name;isPendingorisWaitingForOutputwould be clearer. "use client"on helpers.tsx (helpers.tsx:1) — File exports only pure functions; directive may be unnecessary.
QA Screenshots
| Screenshot | Description |
|---|---|
![]() |
Copilot page loaded ✅ |
![]() |
decompose_goal renders Build Plan accordion with 3 steps, Approve + Modify buttons ✅ |
![]() |
Clicking Approve proceeds to agent creation ✅ |
Human Review Needed
YES — New copilot tool with LLM-controllable approval gate, hand-rolled types diverging from generated API pattern, and broken Modify button UX. Needs human judgment on the require_approval design decision and the intended Modify workflow.
Risk Assessment
Merge risk: MEDIUM | Rollback: EASY — Feature is additive and isolated to the copilot flow. No DB migrations, no auth changes. Rollback is removing the tool from the registry.
CI Status
❌ 6/6 quality checks failed (frontend lint, backend lint, frontend typecheck, backend tests, frontend tests, frontend build). Note: these may be due to environment issues rather than code defects, but they need investigation.
…e_goal UI - Replace static Approve/Modify buttons with a 99s countdown timer that auto-approves when it expires - Timer ring animates inline within "Starting in [N]s" text using SVG strokeDasharray; hover on the text swaps it to "Start now" via Tailwind named groups (group/label) - Clicking Modify stops the timer, enters editable mode where steps can be renamed, deleted, or inserted between existing steps - In edit mode only Approve is shown; timer and Modify are hidden - showActions gated on isLastMessage (server-derived) so the timer never re-appears when returning to a session with prior messages - Forward isLastMessage through ChatMessagesContainer → MessagePartRenderer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (2)
153-174:⚠️ Potential issue | 🟡 MinorRender error fallback when
part.stateis error but output is absent/unparseable.The error card only renders when
outputexists andisErrorOutput(output)is true. Ifpart.state === "output-error"butoutputisnull/unparseable, users see only the transient status text with no retry action.🔧 Suggested fix
- {isError && output && isErrorOutput(output) && ( + {isError && ( <ToolErrorCard - message={output.message ?? ""} + message={output && isErrorOutput(output) ? (output.message ?? "") : ""} fallbackMessage="Failed to analyze the goal. Please try again." actions={[ { label: "Try again", onClick: () => onSend("Please try decomposing the goal again."), }, ]} /> )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 153 - 174, The UI only shows ToolErrorCard when output exists and passes isErrorOutput, so if part.state indicates an error but output is null/unparseable users get no retry; update the conditional that renders ToolErrorCard in DecomposeGoal.tsx to render whenever isError is true and either output is missing/unparseable or isErrorOutput(output) is true (e.g., change the guard to isError && (!output || isErrorOutput(output)) or check part.state === "output-error" || isErrorOutput(output)); keep the existing props (message fallbackMessage actions with onSend) so the retry action always appears.
89-94:⚠️ Potential issue | 🟠 MajorAdd a guard against double-clicks on approve buttons.
Neither
approve()norhandleModify()disable the buttons after the first click. Users can spam-click "Approve" or "Start now" and send duplicate messages before the component unmounts.🛡️ Suggested fix — add submitted state
const [isEditing, setIsEditing] = useState(false); const [editableSteps, setEditableSteps] = useState<EditableStep[]>([]); + const [hasSubmitted, setHasSubmitted] = useState(false); const approvedRef = useRef(false); // ... function approve() { - if (approvedRef.current) return; + if (approvedRef.current || hasSubmitted) return; approvedRef.current = true; + setHasSubmitted(true); setIsEditing(false); onSendRef.current(buildMessage()); } function handleModify() { + if (hasSubmitted) return; if (!output || !isDecompositionOutput(output)) return; // ... }Then use
hasSubmittedto disable buttons:- <Button variant="primary" onClick={approve}> + <Button variant="primary" onClick={approve} disabled={hasSubmitted}>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 89 - 94, The approve() and handleModify() flows can send duplicate messages on rapid clicks; add a submitted guard state (e.g., hasSubmitted via useState or useRef) and set it true on first submit, then check it at the start of approve() and handleModify() to return early if already submitted, and also pass that flag to the button elements to set disabled={hasSubmitted} (or apply the disabled prop) so UI prevents further clicks; update approve(), handleModify(), and the button renderers to use the new hasSubmitted flag and ensure onSendRef.current(buildMessage()) / onSendRef.current(modifiedMessage) only run once.
🧹 Nitpick comments (2)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (2)
186-186: Use semantic design tokens instead of hardcoded colors.
border-slate-200 bg-whiteare hardcoded light-mode colors that won't adapt to dark mode. Similar hardcoded colors appear in the input (Line 202) and InsertButton (Lines 312, 321).♻️ Suggested fix
- <div className="rounded-lg border border-slate-200 bg-white p-3"> + <div className="rounded-lg border border-border bg-card p-3">Apply similar token replacements throughout:
border-slate-200→border-borderbg-white→bg-cardorbg-backgroundtext-slate-400→text-muted-foregroundbg-slate-100→bg-muted🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx at line 186, Replace hardcoded light-mode color classes in DecomposeGoal.tsx with semantic design tokens so the UI adapts to dark mode: update the container div using className "rounded-lg border border-slate-200 bg-white p-3" to use "border-border" and "bg-card" or "bg-background"; similarly change the input element (around the code referenced at Line 202) to replace "text-slate-400" with "text-muted-foreground" and "bg-slate-100" with "bg-muted"; also update the InsertButton usages (the classNames referenced near Lines 312 and 321) to use the same token mappings (border-border, bg-card/bg-background, text-muted-foreground, bg-muted) so all components use semantic tokens instead of hardcoded colors.
1-46: Consider separating business logic into a custom hook.This file is ~324 lines with significant state management (countdown timer, editing, approval flow). Coding guidelines recommend keeping files under ~200 lines and separating render logic from business logic using the
component.tsx + useComponent.tspattern.Extracting
useDecomposeGoal.tswould house the countdown, editing state, and handlers (approve,handleModify,handleStepChange, etc.), leaving the component focused on rendering.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 1 - 46, Create a new custom hook useDecomposeGoal that encapsulates all non-UI logic currently in DecomposeGoal.tsx: move state (countdown timer constants and timer state, editing mode and EditableStep array, refs like inputRef/typingRef, approval/modify booleans), side-effects (useEffect countdown and output parsing using getDecomposeGoalOutput/isDecompositionOutput/isErrorOutput), and handlers (approve, handleModify, handleStepChange, add/remove step, save/cancel edit, start/stop timer) into the hook; keep the DecomposeGoal component focused on rendering and pass in part and isLastMessage to the hook, return the state values and handler functions from useDecomposeGoal for the component to consume (preserve function names like approve, handleModify, handleStepChange and types such as EditableStep to minimize changes).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 139-141: The effect currently disables the linter because it calls
the external approve function via a ref; remove the eslint-disable and fix the
dependency handling by inlining the auto-approve logic inside the useEffect that
watches secondsLeft and timerActive (use secondsLeft and timerActive directly
instead of calling approve), or alternatively memoize approve with useCallback
and include it in the dependency array; update the useEffect to reference only
stable variables (secondsLeft, timerActive, or the memoized approve) and remove
the // eslint-disable-next-line react-hooks/exhaustive-deps comment.
---
Duplicate comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 153-174: The UI only shows ToolErrorCard when output exists and
passes isErrorOutput, so if part.state indicates an error but output is
null/unparseable users get no retry; update the conditional that renders
ToolErrorCard in DecomposeGoal.tsx to render whenever isError is true and either
output is missing/unparseable or isErrorOutput(output) is true (e.g., change the
guard to isError && (!output || isErrorOutput(output)) or check part.state ===
"output-error" || isErrorOutput(output)); keep the existing props (message
fallbackMessage actions with onSend) so the retry action always appears.
- Around line 89-94: The approve() and handleModify() flows can send duplicate
messages on rapid clicks; add a submitted guard state (e.g., hasSubmitted via
useState or useRef) and set it true on first submit, then check it at the start
of approve() and handleModify() to return early if already submitted, and also
pass that flag to the button elements to set disabled={hasSubmitted} (or apply
the disabled prop) so UI prevents further clicks; update approve(),
handleModify(), and the button renderers to use the new hasSubmitted flag and
ensure onSendRef.current(buildMessage()) / onSendRef.current(modifiedMessage)
only run once.
---
Nitpick comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Line 186: Replace hardcoded light-mode color classes in DecomposeGoal.tsx with
semantic design tokens so the UI adapts to dark mode: update the container div
using className "rounded-lg border border-slate-200 bg-white p-3" to use
"border-border" and "bg-card" or "bg-background"; similarly change the input
element (around the code referenced at Line 202) to replace "text-slate-400"
with "text-muted-foreground" and "bg-slate-100" with "bg-muted"; also update the
InsertButton usages (the classNames referenced near Lines 312 and 321) to use
the same token mappings (border-border, bg-card/bg-background,
text-muted-foreground, bg-muted) so all components use semantic tokens instead
of hardcoded colors.
- Around line 1-46: Create a new custom hook useDecomposeGoal that encapsulates
all non-UI logic currently in DecomposeGoal.tsx: move state (countdown timer
constants and timer state, editing mode and EditableStep array, refs like
inputRef/typingRef, approval/modify booleans), side-effects (useEffect countdown
and output parsing using
getDecomposeGoalOutput/isDecompositionOutput/isErrorOutput), and handlers
(approve, handleModify, handleStepChange, add/remove step, save/cancel edit,
start/stop timer) into the hook; keep the DecomposeGoal component focused on
rendering and pass in part and isLastMessage to the hook, return the state
values and handler functions from useDecomposeGoal for the component to consume
(preserve function names like approve, handleModify, handleStepChange and types
such as EditableStep to minimize changes).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b17a828f-e5eb-4a5c-8342-0d6a1d665f71
📒 Files selected for processing (3)
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Seer Code Review
🧰 Additional context used
📓 Path-based instructions (9)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend developmentFormat frontend code using
pnpm format
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development
autogpt_platform/frontend/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g.graphID,useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Nodark:Tailwind classes — the design system handles dark mode
Use Next.js<Link>for internal navigation — never raw<a>tags
Noanytypes unless the value genuinely can be anything
No linter suppressors (//@ts-ignore``,// eslint-disable) — fix the actual issue
Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer
Use generated API hooks from `@/app/api/generated/endpoints/` with pattern `use{Method}{Version}{OperationName}` and regenerate with `pnpm generate:api`
Do not use `useCallback` or `useMemo` unless asked to optimise a given function
Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from@/app/api/__generated__/endpoints/following the patternuse{Method}{Version}{OperationName}, and regenerate withpnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local/componentsfolder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not useuseCallbackoruseMemounless asked to optimise a given function
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{tsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/src/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Component props should use
interface Props { ... }(not exported) unless the interface needs to be used outside the component
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/src/app/(platform)/**/components/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)
Put sub-components in local
components/folder
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx
autogpt_platform/frontend/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)
autogpt_platform/frontend/**/*.tsx: Component props should betype Props = { ... }(not exported) unless it needs to be used outside the component
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*
Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
🧠 Learnings (29)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
📚 Learning: 2026-03-11T08:40:59.673Z
Learnt from: kcze
Repo: Significant-Gravitas/AutoGPT PR: 12328
File: autogpt_platform/frontend/src/app/(platform)/copilot/useLoadMoreMessages.ts:49-61
Timestamp: 2026-03-11T08:40:59.673Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/copilot/useLoadMoreMessages.ts`, clearing `olderMessages` (and resetting `oldestSequence`/`hasMore`) when `initialOldestSequence` shifts on the same session is intentional. Pages already fetched were based on a now-stale cursor; retaining them risks sequence gaps or duplicates. `ScrollPreserver` keeps the currently visible viewport intact, so only unvisited older pages are dropped. This is a deliberate safe-refetch design tradeoff.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
📚 Learning: 2026-03-17T06:18:51.570Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12445
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx:55-67
Timestamp: 2026-03-17T06:18:51.570Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx`, an explicit `isBusy` guard on the retry handler (`handleRetry`) is not needed. Once `onSend` is invoked, the chat status immediately transitions to "submitted", which causes the `ErrorCard` (containing the retry button) to unmount before a second click can register, making double-send impossible by design.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '@/app/api/__generated__/' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T02:23:31.305Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/RateLimitResetDialog/RateLimitResetDialog.tsx:0-0
Timestamp: 2026-03-24T02:23:31.305Z
Learning: In the Copilot platform UI code, follow the established Orval hook `onError` error-handling convention: first explicitly detect/handle `ApiError`, then read `error.response?.detail` (if present) as the primary message; if not available, fall back to `error.message`; and finally fall back to a generic string message. This convention should be used for generated Orval hooks even if the custom Orval mutator already maps details into `ApiError.message`, to keep consistency across hooks/components (e.g., `useCronSchedulerDialog.ts`, `useRunGraph.ts`, and rate-limit/reset flows).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-31T14:04:42.444Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx:172-177
Timestamp: 2026-03-31T14:04:42.444Z
Learning: In the Copilot frontend components under autogpt_platform/frontend/src/app/(platform)/copilot/, Tailwind dark mode variants (e.g., `dark:*`) are intentional and should be allowed. Do not flag `dark:` utilities in these Copilot UI components as incorrect; they are used to ensure proper contrast and correct behavior in both light and dark themes.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxautogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local `/components` folder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{tsx,ts} : Structure React components as: ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts (exception: small 3-4 line components can be inline; render-only components can be direct files)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.tsx : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{ts,tsx} : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`, use design system components from `src/components/` (atoms, molecules, organisms), and never use `src/components/__legacy__/*`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use function declarations for components and handlers (not arrow functions) in React components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use '<ErrorCard />' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.tsx : Component props should be `type Props = { ... }` (not exported) unless it needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{stories.tsx,stories.ts} : Add/update Storybook stories for UI components in frontend development
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-17T06:48:26.471Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12445
File: autogpt_platform/backend/backend/copilot/sdk/service.py:1071-1072
Timestamp: 2026-03-17T06:48:26.471Z
Learning: In Significant-Gravitas/AutoGPT (autogpt_platform), the AI SDK enforces `z.strictObject({type, errorText})` on SSE `StreamError` responses, so additional fields like `retryable: bool` cannot be added to `StreamError` or serialized via `to_sse()`. Instead, retry signaling for transient Anthropic API errors is done via the `COPILOT_RETRYABLE_ERROR_PREFIX` constant prepended to persisted session messages (in `ChatMessage.content`). The frontend detects retryable errors by checking `markerType === "retryable_error"` from `parseSpecialMarkers()` — no SSE schema changes and no string matching on error text. This pattern was established in PR `#12445`, commit 64d82797b.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No linter suppressors (`// ts-ignore`, `// eslint-disable`) — fix the actual issue
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-07T16:17:42.258Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12699
File: autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx:0-0
Timestamp: 2026-04-07T16:17:42.258Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.ts`, `handleApplyAction` is synchronous and always succeeds from the user's perspective when the node exists; it early-returns (no-op) only if the node is not found, which cannot happen in normal flow. Therefore, setting `applied=true` immediately on click in `ActionItem` (BuilderChatPanel.tsx) is correct UX — do not flag this pattern as a stale/premature state update.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No `dark:` Tailwind classes — the design system handles dark mode
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.tsx : Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,css} : Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use Tailwind CSS utilities only for styling in frontend components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
🔇 Additional comments (5)
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx (2)
49-70: LGTM!The
isLastMessageparameter is cleanly added torenderSegmentsand correctly threaded toMessagePartRenderer. The optional parameter maintains backward compatibility.
372-388: LGTM!Both rendering paths (via
renderSegmentsand the fallbackmap) consistently passisLastAssistantasisLastMessage, ensuring the newDecomposeGoalToolreceives the flag it needs for conditional approval UI.autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx (2)
92-106: LGTM!The
isLastMessageprop is correctly added to the interface and destructured in the component signature, following the existing pattern.
173-180: LGTM!The new
tool-decompose_goalcase follows the established pattern for tool rendering. TheisLastMessageprop is correctly passed to enable conditional approval UI inDecomposeGoalTool.autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (1)
30-30: Verify the 99-second countdown is intentional.
COUNTDOWN_SECONDS = 99seems unusually long for an auto-approve timer. Most auto-proceed UIs use 5–15 seconds. If this is a placeholder or debugging value, consider adjusting before release.
… input - Replace <input type="text"> with <textarea> for step descriptions - Use ref callback to set height from scrollHeight on every render so long descriptions wrap to multiple lines by default without interaction - Bump countdown ring container from 20px to 24px and text from 9px to 11px for better legibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (1)
136-141: 🛠️ Refactor suggestion | 🟠 MajorRemove the eslint-disable suppressor.
The
eslint-disable-next-linecomment violates the coding guidelines. The suggested fix from the previous review (inlining the auto-approve logic) would eliminate the need for this suppression.♻️ Inline the auto-approve logic
// Auto-approve when countdown reaches 0 (only if timer is still active). useEffect(() => { - if (secondsLeft === 0 && timerActive) approve(); - // approve is stable via ref — intentionally omitted - // eslint-disable-next-line react-hooks/exhaustive-deps + if (secondsLeft === 0 && timerActive) { + if (approvedRef.current) return; + approvedRef.current = true; + setIsEditing(false); + onSendRef.current(buildMessage()); + } }, [secondsLeft, timerActive]);Note:
buildMessagereferences refs that are always current, so this is safe.As per coding guidelines: "No linter suppressors (
// ts-ignore,// eslint-disable) — fix the actual issue".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 136 - 141, Remove the eslint-disable and inline the auto-approve logic inside the useEffect: replace the call to approve() in the effect triggered by secondsLeft === 0 && timerActive with the actual logic currently implemented in approve (use the same operations that build and send the approval message via buildMessage and any refs it reads), so the effect no longer depends on an external stable ref function; keep the dependency array as [secondsLeft, timerActive] and ensure you reference buildMessage and any refs directly inside the effect instead of calling approve().
🧹 Nitpick comments (2)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (2)
47-149: Consider extracting business logic into a custom hook.At 330 lines, this file exceeds the ~200 line guideline. The state management, refs, and effects (Lines 65-149) could be extracted into a
useDecomposeGoal.tshook, following thecomponent.tsx + useComponent.ts + helpers.tspattern recommended in the coding guidelines.This would separate render logic from business logic and improve testability.
Based on learnings: "Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 47 - 149, This file's state, refs and effects inside DecomposeGoalTool (states: secondsLeft, timerActive, isEditing, editableSteps; refs: approvedRef, onSendRef, isEditingRef, editableStepsRef; functions: buildMessage, approve, handleModify, handleStepChange, handleStepDelete, handleStepInsert; and effects that manage countdown/auto-approve) should be moved into a new custom hook (e.g., useDecomposeGoal) to follow the component.tsx + useComponent.ts pattern: create useDecomposeGoal that exposes the state values, setters, refs behavior, and handler functions (and encapsulates the two useEffect timers), update DecomposeGoalTool to call useDecomposeGoal and use the returned values/handlers, and keep only rendering/JSX in DecomposeGoalTool to improve readability and testability.
251-296: Hardcoded colors in countdown ring.The countdown ring SVG uses hardcoded color classes:
- Line 271:
text-neutral-300- Line 283:
text-neutral-600- Line 286:
text-neutral-700These should use semantic design tokens for theme consistency.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx around lines 251 - 296, The two SVG <circle> elements and the seconds <span> inside the Button in DecomposeGoal (look for RADIUS, CIRCUMFERENCE, dashOffset and secondsLeft) use hardcoded color utility classes (text-neutral-300, text-neutral-600, text-neutral-700); replace those with your project's semantic design-token classes (e.g., the theme tokens for border/disabled/foreground states) so colors follow the design system — update the className on the first circle, the animated circle, and the seconds span to use the appropriate semantic token names instead of the hardcoded text-neutral-* values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 163-174: The ToolErrorCard currently only renders when isError &&
output && isErrorOutput(output), so when part.state === "output-error" but
output failed to parse (null) there is no retry UI; update the render condition
to show ToolErrorCard whenever isError is true (remove the strict output &&
isErrorOutput(output) requirement), pass a safe fallback message into message
(e.g., empty string or output?.message) and keep the existing actions array
using onSend to trigger retry; ensure the component referenced is ToolErrorCard
and the retry handler stays as onSend("Please try decomposing the goal again.").
---
Duplicate comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 136-141: Remove the eslint-disable and inline the auto-approve
logic inside the useEffect: replace the call to approve() in the effect
triggered by secondsLeft === 0 && timerActive with the actual logic currently
implemented in approve (use the same operations that build and send the approval
message via buildMessage and any refs it reads), so the effect no longer depends
on an external stable ref function; keep the dependency array as [secondsLeft,
timerActive] and ensure you reference buildMessage and any refs directly inside
the effect instead of calling approve().
---
Nitpick comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx:
- Around line 47-149: This file's state, refs and effects inside
DecomposeGoalTool (states: secondsLeft, timerActive, isEditing, editableSteps;
refs: approvedRef, onSendRef, isEditingRef, editableStepsRef; functions:
buildMessage, approve, handleModify, handleStepChange, handleStepDelete,
handleStepInsert; and effects that manage countdown/auto-approve) should be
moved into a new custom hook (e.g., useDecomposeGoal) to follow the
component.tsx + useComponent.ts pattern: create useDecomposeGoal that exposes
the state values, setters, refs behavior, and handler functions (and
encapsulates the two useEffect timers), update DecomposeGoalTool to call
useDecomposeGoal and use the returned values/handlers, and keep only
rendering/JSX in DecomposeGoalTool to improve readability and testability.
- Around line 251-296: The two SVG <circle> elements and the seconds <span>
inside the Button in DecomposeGoal (look for RADIUS, CIRCUMFERENCE, dashOffset
and secondsLeft) use hardcoded color utility classes (text-neutral-300,
text-neutral-600, text-neutral-700); replace those with your project's semantic
design-token classes (e.g., the theme tokens for border/disabled/foreground
states) so colors follow the design system — update the className on the first
circle, the animated circle, and the seconds span to use the appropriate
semantic token names instead of the hardcoded text-neutral-* 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 891c1ae8-02db-411f-a738-45810e3b2ee1
📒 Files selected for processing (1)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Seer Code Review
🧰 Additional context used
📓 Path-based instructions (8)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend developmentFormat frontend code using
pnpm format
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development
autogpt_platform/frontend/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g.graphID,useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Nodark:Tailwind classes — the design system handles dark mode
Use Next.js<Link>for internal navigation — never raw<a>tags
Noanytypes unless the value genuinely can be anything
No linter suppressors (//@ts-ignore``,// eslint-disable) — fix the actual issue
Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer
Use generated API hooks from `@/app/api/generated/endpoints/` with pattern `use{Method}{Version}{OperationName}` and regenerate with `pnpm generate:api`
Do not use `useCallback` or `useMemo` unless asked to optimise a given function
Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from@/app/api/__generated__/endpoints/following the patternuse{Method}{Version}{OperationName}, and regenerate withpnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local/componentsfolder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not useuseCallbackoruseMemounless asked to optimise a given function
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.{tsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/src/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Component props should use
interface Props { ... }(not exported) unless the interface needs to be used outside the component
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
autogpt_platform/frontend/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)
autogpt_platform/frontend/**/*.tsx: Component props should betype Props = { ... }(not exported) unless it needs to be used outside the component
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*
Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
🧠 Learnings (32)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local `/components` folder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{tsx,ts} : Structure React components as: ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts (exception: small 3-4 line components can be inline; render-only components can be direct files)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.tsx : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/src/components/**/*.{ts,tsx} : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`, use design system components from `src/components/` (atoms, molecules, organisms), and never use `src/components/__legacy__/*`
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-17T06:18:51.570Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12445
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx:55-67
Timestamp: 2026-03-17T06:18:51.570Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx`, an explicit `isBusy` guard on the retry handler (`handleRetry`) is not needed. Once `onSend` is invoked, the chat status immediately transitions to "submitted", which causes the `ErrorCard` (containing the retry button) to unmount before a second click can register, making double-send impossible by design.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T02:23:31.305Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/RateLimitResetDialog/RateLimitResetDialog.tsx:0-0
Timestamp: 2026-03-24T02:23:31.305Z
Learning: In the Copilot platform UI code, follow the established Orval hook `onError` error-handling convention: first explicitly detect/handle `ApiError`, then read `error.response?.detail` (if present) as the primary message; if not available, fall back to `error.message`; and finally fall back to a generic string message. This convention should be used for generated Orval hooks even if the custom Orval mutator already maps details into `ApiError.message`, to keep consistency across hooks/components (e.g., `useCronSchedulerDialog.ts`, `useRunGraph.ts`, and rate-limit/reset flows).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use '<ErrorCard />' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-17T06:48:26.471Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12445
File: autogpt_platform/backend/backend/copilot/sdk/service.py:1071-1072
Timestamp: 2026-03-17T06:48:26.471Z
Learning: In Significant-Gravitas/AutoGPT (autogpt_platform), the AI SDK enforces `z.strictObject({type, errorText})` on SSE `StreamError` responses, so additional fields like `retryable: bool` cannot be added to `StreamError` or serialized via `to_sse()`. Instead, retry signaling for transient Anthropic API errors is done via the `COPILOT_RETRYABLE_ERROR_PREFIX` constant prepended to persisted session messages (in `ChatMessage.content`). The frontend detects retryable errors by checking `markerType === "retryable_error"` from `parseSpecialMarkers()` — no SSE schema changes and no string matching on error text. This pattern was established in PR `#12445`, commit 64d82797b.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No linter suppressors (`// ts-ignore`, `// eslint-disable`) — fix the actual issue
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-07T16:17:42.258Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12699
File: autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx:0-0
Timestamp: 2026-04-07T16:17:42.258Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.ts`, `handleApplyAction` is synchronous and always succeeds from the user's perspective when the node exists; it early-returns (no-op) only if the node is not found, which cannot happen in normal flow. Therefore, setting `applied=true` immediately on click in `ActionItem` (BuilderChatPanel.tsx) is correct UX — do not flag this pattern as a stale/premature state update.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No `dark:` Tailwind classes — the design system handles dark mode
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-31T14:04:42.444Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx:172-177
Timestamp: 2026-03-31T14:04:42.444Z
Learning: In the Copilot frontend components under autogpt_platform/frontend/src/app/(platform)/copilot/, Tailwind dark mode variants (e.g., `dark:*`) are intentional and should be allowed. Do not flag `dark:` utilities in these Copilot UI components as incorrect; they are used to ensure proper contrast and correct behavior in both light and dark themes.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.tsx : Tailwind CSS only for styling, use design tokens, Phosphor Icons only
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:27:45.725Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.725Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,css} : Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use Tailwind CSS utilities only for styling in frontend components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-19T11:25:27.842Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12471
File: autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts:48-55
Timestamp: 2026-03-19T11:25:27.842Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts`, the debounced search pattern uses `useRef(debounce(...))` (lodash) rather than `useEffect`+`setTimeout`. The debounced callback atomically applies `setDebouncedSearch(value.trim())` and `setCurrentPage(1)`, so the page reset is deferred along with the filter change and never races ahead. The query is driven by `debouncedSearch` (not the raw `searchQuery`), so no stale-filter fetch occurs on the first keystroke. Do not flag this pattern as incorrect in future reviews.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use function declarations for components and handlers (not arrow functions) in React components
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Do not use `useCallback` or `useMemo` unless asked to optimise a given function
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-19T12:07:49.237Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12462
File: autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentImages/AgentImage.tsx:17-21
Timestamp: 2026-03-19T12:07:49.237Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentImages/AgentImage.tsx`, the `images` array passed to `AgentImages` is static per agent detail page and does not change after mount. Therefore, index-based keying of `loadedThumbs` (a `Set<number>`) is sufficient and will not produce stale entries. Do not flag this as a potential stale-state issue due to index reuse.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-08T17:28:40.824Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.824Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Use function declarations (not arrow functions) for components and handlers
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-03-10T08:39:22.025Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-07T18:08:02.085Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12701
File: .claude/skills/orchestrate/scripts/verify-complete.sh:120-121
Timestamp: 2026-04-07T18:08:02.085Z
Learning: In Significant-Gravitas/AutoGPT, verify-complete.sh (`.claude/skills/orchestrate/scripts/verify-complete.sh`) uses `commits[-1].committedDate` (not `updatedAt`) to identify stale CHANGES_REQUESTED reviews. This is intentional: `updatedAt` changes on any PR activity (bot comments, label changes, description edits), which would falsely classify a reviewer's CHANGES_REQUESTED as stale — a silent false negative. The `committedDate` edge case (commit created locally before a review but pushed after) only causes a false positive (unnecessary re-brief), which is the safer failure mode. Do not suggest switching to `updatedAt` for this comparison.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '@/app/api/__generated__/' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx
🔇 Additional comments (5)
autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx (5)
89-94: Guard only prevents duplicate approvals, not duplicate button clicks.The
approvedRef.currentguard inapprove()prevents double-send at the function level, which is good. However, the buttons at Lines 244, 253, and 298 remain enabled after click. IfonSendis async and takes time, rapid clicks could queue multiple calls beforeapprovedRefis set.Consider adding a local
submittedstate that disables buttons immediately on click.💡 Suggested improvement
const approvedRef = useRef(false); + const [submitted, setSubmitted] = useState(false); const onSendRef = useRef(onSend); function approve() { if (approvedRef.current) return; approvedRef.current = true; + setSubmitted(true); setIsEditing(false); onSendRef.current(buildMessage()); }Then use
disabled={submitted}on the approve/modify buttons.
186-239: Use semantic design tokens instead of hardcoded colors.Multiple hardcoded color classes throughout this section won't adapt to dark mode:
- Line 186:
border-slate-200 bg-white- Line 195:
text-slate-400- Line 208:
border-slate-200,focus:border-neutral-400- Line 214:
text-slate-400 hover:text-red-500Replace with semantic tokens like
bg-background,border-border,text-muted-foreground, etc., that the design system provides.♻️ Example replacements
- <div className="rounded-lg border border-slate-200 bg-white p-3"> + <div className="rounded-lg border border-border bg-card p-3">- <span className="w-5 shrink-0 pt-1 text-xs text-slate-400"> + <span className="w-5 shrink-0 pt-1 text-xs text-muted-foreground">
1-45: LGTM!Imports, constants, and type definitions are well-structured. Props interface follows the
interface Propsconvention, and Phosphor icons are used correctly.
47-78: LGTM!The ref pattern used here (
onSendRef,isEditingRef,editableStepsRef) is a valid approach to avoid stale closures in effects while keeping the effect dependencies minimal. The refs are correctly updated on each render to capture the latest values.
315-330: LGTM for structure; hardcoded colors noted above.The
InsertButtonhelper component is well-structured with proper accessibility (aria-label). The hardcoded color classes (bg-slate-100,text-slate-300, etc.) fall under the same design token concern mentioned earlier.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Significant-Gravitas/AutoGPT into feat/task-decomposition-copilot
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
…n-copilot # Conflicts: # autogpt_platform/backend/backend/copilot/model.py
…Significant-Gravitas/AutoGPT into feat/task-decomposition-copilot
|
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
…wn from timestamp - Route always returns cancelled=True, reason branch was dead code since cancel_auto_approve() unconditionally returns True - Use crypto.randomUUID() for new step IDs to avoid same-millisecond collisions on rapid insert clicks - Re-derive secondsLeft from created_at+auto_approve_seconds on each tick (and on visibilitychange) instead of naive decrement; browsers throttle setInterval in background tabs, causing the displayed countdown to drift far behind wall-clock time
Guard the synchronous recompute() call so only deadline-driven (has created_at) sessions correct stale state on mount. Legacy fallback now waits the first 1s tick instead of snapping 60→59 instantly.
Mirror the failure-path invalidation already in append_and_save_message. Without this, a failed cache write leaves stale session data in Redis, which later predicate checks could act on and produce duplicate messages.
When Redis is unavailable, _get_session_lock yields False — without this guard two concurrent callers could both read the same DB state, both pass the predicate, and both append, producing duplicate messages. append_message_if only powers non-critical fire-and-forget flows (decompose_goal auto-approve), so skipping is safer than risking a duplicate; the user can still trigger the action manually.
The 'STOP — do not proceed until the user approves' instruction in agent_generation_guide.md was purely prompt-level. Observed failure: the LLM called decompose_goal and create_agent in the same turn, building the agent while the user was still mid-countdown — the whole premise of the PR (user-approval before build) was being bypassed. Add has_pending_decomposition(session) which checks session history for an unanswered decompose_goal tool call, and call it from create_agent._execute. When pending, the tool returns an ErrorResponse instructing the LLM to end its turn instead of building.
Previous gate (has_pending_decomposition) only blocked when decompose_goal was called but not yet approved. It missed the case where the LLM skipped decompose_goal entirely on follow-up requests — if a session already had a prior completed decomposition, the gate returned False and let a fresh create_agent through without any new plan/approval. Tighter rule (needs_build_plan_approval): the most recent user message must be an approval (contains 'approved', case-insensitive) AND a decompose_goal tool_call must exist in the session before that approval. This forces the LLM to call decompose_goal for every new build request, end its turn, and only resume building after the user responds.



Why / What / How
Why: When a user asks Copilot to build an agent, it would jump straight into generating the agent JSON with no upfront plan shown to the user. There was no opportunity to review or approve the approach before work began, making the process opaque and hard to course-correct.
What: Adds a
decompose_goaltool that breaks the user's agent-building goal into a step-by-step plan (e.g. "add input block", "add AI summarizer", "wire blocks together") and shows it as an interactive checklist UI before any building starts. The user approves the plan, then Copilot proceeds.How:
DecomposeGoalToolreturns aTaskDecompositionResponsewith a list ofDecompositionStepModelsteps. The tool is registered inTOOL_REGISTRY.prompting.pyintoagent_generation_guide.mdas a hard-gated "Before Building" section with a STOP instruction, so the LLM cannot skip it.DecomposeGoalcomponent renders a step checklist with approve/modify buttons. The tool part is added toCUSTOM_TOOL_TYPES(renders individually, not collapsed) andINTERACTIVE_RESPONSE_TYPES(pinned to the response section after streaming completes so the approve button is not obscured by trailing reasoning).Changes 🏗️
backend/copilot/tools/decompose_goal.py— newDecomposeGoalToolbackend/copilot/tools/models.py—TaskDecompositionResponse,DecompositionStepModel,ResponseType.TASK_DECOMPOSITIONbackend/copilot/tools/__init__.py— registersDecomposeGoalToolbackend/copilot/sdk/agent_generation_guide.md— "Before Building: Goal Decomposition (REQUIRED)" section added before the build workflowbackend/copilot/prompting.py— removed inline decomposition prompt (moved to guide)frontend/.../tools/DecomposeGoal/— newDecomposeGoal.tsx,StepItem.tsx,helpers.tsxcomponentsfrontend/.../ChatMessagesContainer/helpers.ts—tool-decompose_goal→CUSTOM_TOOL_TYPES;task_decomposition→INTERACTIVE_RESPONSE_TYPESfrontend/.../ChatMessagesContainer/components/MessagePartRenderer.tsx— render case fortool-decompose_goalChecklist 📋
For code changes:
For configuration changes:
.env.defaultis updated or already compatible with my changesdocker-compose.ymlis updated or already compatible with my changes