fix(frontend/builder): handle discriminated unions and improve node layout#12354
Conversation
When deleting a node, React Flow fires onNodesChange and onEdgesChange as separate callbacks, each pushing to the undo history. This created intermediate states that broke undo β requiring multiple undos and restoring inconsistent graph states (e.g. edges pointing to deleted nodes). Use microtask-based batching in pushState so all calls within the same synchronous execution are coalesced into a single history entry, keeping only the first pre-change snapshot. Fixes #10999
- Add toggle state for nested object expansion - Display expand/collapse icons for objects with properties - Nested properties now collapsed by default - Simplify recursive rendering with conditional expansion check
β¦ock-discriminated-union-renders-unusable
|
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 oneOf/discriminated-union support and registry entry, normalizes anyOf/oneOf handling in templates, introduces advanced-field detection and conditional toggle UI, implements expandable nested outputs, and includes minor styling and debug cleanup. Changes
Sequence DiagramsequenceDiagram
participant User
participant OneOfField as "OneOfField"
participant SchemaUtils as "schema-utils"
participant SelectWidget as "Select widget"
participant EdgeManager as "Edge manager"
participant SchemaField as "SchemaField"
User->>OneOfField: Render with schema containing oneOf
OneOfField->>SchemaUtils: Resolve discriminator & variant schemas
SchemaUtils-->>OneOfField: Return variants info
OneOfField->>SelectWidget: Render variant options
User->>SelectWidget: Choose variant
SelectWidget-->>OneOfField: Selected index change
OneOfField->>EdgeManager: clear edges for field handle prefix
EdgeManager-->>OneOfField: edges cleared
OneOfField->>OneOfField: Build default form state + attach discriminator
OneOfField->>SchemaField: Render filtered variant schema
SchemaField-->>User: Variant UI rendered
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~25 minutes Possibly related PRs
Suggested labels
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 |
π PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. π΄ Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
Summary: 1 conflict(s), 0 medium risk, 0 low risk (out of 1 PRs with file overlap) Auto-generated on push. Ignores: |
...gpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 5
π€ 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)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx:
- Around line 26-30: The advanced-field detection only checks top-level
schema.properties in hasAdvancedFields and thus misses nested advanced flags in
objects, arrays, anyOf/oneOf/allOf variants; update hasAdvancedFields to perform
a recursive schema walk that inspects schema.properties, schema.items,
schema.anyOf, schema.oneOf, schema.allOf (and nested array/object schemas) and
returns true if any nested prop has advanced===true; then use this updated
hasAdvancedFields wherever NodeAdvancedToggle visibility is decided (the
NodeAdvancedToggle suppression logic) so the toggle is shown whenever any nested
schema contains an advanced field.
In
`@autogpt_platform/frontend/src/app/`(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx:
- Around line 58-59: The collapsed branch hides connected/broken child handles
because descendants are only rendered when isExpanded is true; change the logic
in OutputHandler.tsx so branches auto-expand or keep descendants rendered when
they contain connections: add a helper (e.g., hasConnectedDescendant(fullKey) or
similar) that walks the schema/handles state to detect any connected or broken
descendant outputs and then compute isExpandedEffective = isExpanded ||
hasConnectedDescendant(fullKey) (or render descendants even if collapsed when
that helper returns true); update uses of isExpanded (the rendering block that
checks isExpanded and the descendant rendering at the bottom) to use
isExpandedEffective so connected/broken nested outputs remain visible when their
parent appears collapsed.
In
`@autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`:
- Around line 67-79: selectedIndex is only derived once via getInitialIndex and
then never updated when formData changes; update the component to derive or sync
selectedIndex from the current discriminator value on every render by either (A)
removing local mount-only state and computing selectedIndex =
enumOptions.findIndex(o => o.discriminatorValue ===
formData?.[discriminatorProp]) each render, or (B) keep state but add a
useEffect keyed to formData?.[discriminatorProp] that recalculates the index
(using getInitialIndex logic or the same findIndex) and calls setSelectedIndex
when it differs; apply the same fix to the other instance around lines 147-159
that manages the oneOf branch selection.
- Around line 122-145: handleVariantChange currently rebuilds the new branch
from an empty object, discarding values shared between the old and new schemas;
instead, follow the same sanitization approach used in useAnyOfField.ts to
preserve overlapping data: obtain the current form data (from props.formData /
the component's form state), sanitize it against the old variant and the new
variant schemas (as done in
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/anyof/useAnyOfField.ts)
and use that sanitized object as the base when calling
schemaUtils.getDefaultFormState for newVariant (keep references to
handleVariantChange, variants, discriminatorProp, cleanUpHandleId,
useEdgeStore.removeEdgesByHandlePrefix, schemaUtils.getDefaultFormState, and
onChange to locate and update the logic).
- Around line 16-19: Replace all uses of the loose any type for JSON Schema
parameters with the RJSFSchema type from `@rjsf/utils`: import RJSFSchema and
change the signature of getDiscriminatorPropName(schema: any) to use RJSFSchema,
and likewise update the parameter and property types in the other schema-related
helpers in this file (the functions that handle discriminator resolution,
variant filtering, and form state such as getDiscriminatorPropName,
resolveSelectedVariant, filterVariants, and any onFormData change/handler
functions) so properties like schema.discriminator and schema.properties are
typed as RJSFSchema; ensure you update all casts at the mentioned locations and
adjust any property accesses to satisfy the stricter typing.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e28608c6-4ce9-4b31-a4d1-6f3c5dfe6bc4
π Files selected for processing (10)
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/anyof/useAnyOfField.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
π€ Files with no reviewable changes (1)
- autogpt_platform/frontend/src/components/renderers/InputRenderer/base/anyof/useAnyOfField.ts
π 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). (5)
- GitHub Check: types
- GitHub Check: Seer Code Review
- GitHub Check: end-to-end tests
- GitHub Check: Analyze (python)
- GitHub Check: Check PR Status
π§° 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 development
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Runpnpm formatto auto-fix formatting issues before completing work
Runpnpm lintto check for lint errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.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/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.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 developmentRun
pnpm typesto check for type errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}
π CodeRabbit inference engine (.github/copilot-instructions.md)
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)
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code usingpnpm format
Never use components fromsrc/components/__legacy__/*
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components asComponentName/ComponentName.tsx+useComponentName.ts+helpers.tsand use design system components fromsrc/components/(atoms, molecules, organisms)
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}and regenerate withpnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local/componentsfolder
Avoid large hooks, abstract logic intohelpers.tsfiles when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not useuseCallbackoruseMemounless asked to optimize a given function
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components and handlers
Use type-safe generated API hooks via Orval + React Query for data fetching
Use React Query for server state management and co-locate UI state in components/hooks
Separate render logic (.tsx) from business logic (use*.tshooks)
Use only shadcn/ui (Radix UI primitives) with Tailwind CSS for UI components
Use Phosphor Icons only for all icon implementations
Use ErrorCard component for render errors, toast for mutations, and Sentry for exceptions
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*components
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not useuseCallbackoruseMemounless asked to optimize a specific function
Never type withanyunless a variable/attribute can actually be of any type
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,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/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/*.ts
π CodeRabbit inference engine (AGENTS.md)
Do not type hook returns, let Typescript infer as much as possible
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
autogpt_platform/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Fully capitalize acronyms in symbols, e.g.
graphID,useBackendAPI
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Put sub-components in a local
components/folder within the feature directory
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/[A-Z]*/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.tsautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
Component props should be
interface Props { ... }(not exported) unless the interface needs to be used outside the componentUse
type Props = { ... }(not exported) for component props unless used outside the component
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
autogpt_platform/frontend/src/app/(platform)/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
If adding protected frontend routes, update
frontend/lib/supabase/middleware.ts
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
π§ Learnings (18)
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.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/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/[A-Z]*/**/*.{ts,tsx} : Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use only shadcn/ui (Radix UI primitives) with Tailwind CSS for UI components
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts` and use design system components from `src/components/` (atoms, molecules, organisms)
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Use `type Props = { ... }` (not exported) for component props unless used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*[Ww]orkflow*/**/*.{ts,tsx} : Use xyflow/react for visual graph editor implementation in the Workflow Builder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.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)/build/components/FlowEditor/nodes/OutputHandler.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 design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.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 PascalCase for component names and camelCase with 'use' prefix for hook names in React
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use design system components from `src/components/` (atoms, molecules, organisms)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use React Query for server state management and co-locate UI state in components/hooks
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.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)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsxautogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Run `pnpm types` to check for type errors and fix any that appear before completing work
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.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/components/renderers/InputRenderer/FormRenderer.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Never type with `any` unless a variable/attribute can actually be of any type
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
...form/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
Show resolved
Hide resolved
...gpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
Show resolved
Hide resolved
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
Show resolved
Hide resolved
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
Show resolved
Hide resolved
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
Show resolved
Hide resolved
Filter nested outputs to show only connected/broken fields when collapsed, while still displaying all children when explicitly expanded by the user.
Ensure selectedIndex stays synchronized when the discriminator value changes outside the component (e.g., undo/redo, loading saved state).
When changing discriminated union variants, sanitize the current form data against the old schema before applying defaults for the new variant. This preserves any shared fields between variants instead of losing them during the switch.
There was a problem hiding this comment.
Actionable comments posted: 1
β»οΈ Duplicate comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)
122-145:β οΈ Potential issue | π MajorPreserve overlapping values when switching variants.
Line 137 rebuilds the next branch from
{}, so flipping between variants drops any fields that are valid in both schemas.AnyOfFieldalready sanitizes the old branch into the new schema first;OneOfFieldshould do the same to avoid needless data loss.Suggested fix
function handleVariantChange(option?: string) { const newIndex = option !== undefined ? parseInt(option, 10) : -1; if (newIndex === selectedIndex || newIndex < 0) return; setSelectedIndex(newIndex); const newVariant = variants.current[newIndex]; + const oldVariant = + selectedIndex >= 0 ? variants.current[selectedIndex] : undefined; const discValue = (newVariant.properties?.[discriminatorProp] as any) ?.const; @@ - let newFormData = schemaUtils.getDefaultFormState( - newVariant, - {}, - "excludeObjectChildren", - ) as any; + let newFormData = schemaUtils.sanitizeDataForNewSchema( + newVariant, + oldVariant, + formData, + ) as Record<string, unknown>; + newFormData = schemaUtils.getDefaultFormState( + newVariant, + newFormData, + "excludeObjectChildren", + ) as Record<string, unknown>; newFormData = { ...newFormData, [discriminatorProp]: discValue };
π€ 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`:
- Around line 147-173: The sync effect in OneOfField only updates selectedIndex
when formData has a known discriminator; change the effect that watches
currentDiscValue to also handle cleared or unknown values by resetting
selectedIndex to a safe default and updating the hidden discriminator field: if
currentDiscValue is falsy or not found in enumOptions, call setSelectedIndex(0)
(or the chosen default index) and call onChange to set
formData[discriminatorProp] to enumOptions[0].discriminatorValue (using
props.fieldPathId.path and field_id as currently done) so the form and
selectedIndex cannot drift out of sync; keep the existing branch that updates
selectedIndex when a valid discriminator is found.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2ecfed96-a569-4273-bc19-afe812a26b24
π Files selected for processing (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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). (4)
- GitHub Check: types
- GitHub Check: end-to-end tests
- GitHub Check: Seer Code Review
- GitHub Check: Check PR Status
π§° Additional context used
π Path-based instructions (12)
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 development
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Runpnpm formatto auto-fix formatting issues before completing work
Runpnpm lintto check for lint errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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/components/renderers/InputRenderer/base/oneof/OneOfField.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 developmentRun
pnpm typesto check for type errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}
π CodeRabbit inference engine (.github/copilot-instructions.md)
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)
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code usingpnpm format
Never use components fromsrc/components/__legacy__/*
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components asComponentName/ComponentName.tsx+useComponentName.ts+helpers.tsand use design system components fromsrc/components/(atoms, molecules, organisms)
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}and regenerate withpnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local/componentsfolder
Avoid large hooks, abstract logic intohelpers.tsfiles when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not useuseCallbackoruseMemounless asked to optimize a given function
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components and handlers
Use type-safe generated API hooks via Orval + React Query for data fetching
Use React Query for server state management and co-locate UI state in components/hooks
Separate render logic (.tsx) from business logic (use*.tshooks)
Use only shadcn/ui (Radix UI primitives) with Tailwind CSS for UI components
Use Phosphor Icons only for all icon implementations
Use ErrorCard component for render errors, toast for mutations, and Sentry for exceptions
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*components
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not useuseCallbackoruseMemounless asked to optimize a specific function
Never type withanyunless a variable/attribute can actually be of any type
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
Component props should be
interface Props { ... }(not exported) unless the interface needs to be used outside the componentUse
type Props = { ... }(not exported) for component props unless used outside the component
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Fully capitalize acronyms in symbols, e.g.
graphID,useBackendAPI
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Put sub-components in a local
components/folder within the feature directory
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/[A-Z]*/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π§ Learnings (12)
π Common learnings
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.
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.
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
π Learning: 2026-03-10T06:34:10.984Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-03-10T06:22:52.942Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx:26-30
Timestamp: 2026-03-10T06:22:52.942Z
Learning: In the AutoGPT platform frontend (autogpt_platform/frontend/), `advanced=true` fields are always declared directly on the top-level `Input` class for every block. Advanced fields are never nested inside objects, arrays, anyOf, oneOf, or allOf variants. Therefore, a top-level-only check of `schema.properties` (as done in `hasAdvancedFields` in `CustomNode.tsx`) is sufficient and correct; a recursive schema walk is not needed.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Never type with `any` unless a variable/attribute can actually be of any type
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/**/*.{ts,tsx} : Never type with `any`, if no types available use `unknown`
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Run `pnpm types` to check for type errors and fix any that appear before completing work
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Use `type Props = { ... }` (not exported) for component props unless used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/use*.ts : Do not type hook returns; let TypeScript infer types as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.ts : Do not type hook returns, let Typescript infer as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
Show resolved
Hide resolved
When the discriminator value becomes unknown or is cleared, reset to the first variant and update formData accordingly, instead of leaving the field in an inconsistent state.
There was a problem hiding this comment.
Actionable comments posted: 1
π€ 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`:
- Around line 157-175: The effect that handles an unknown/cleared discriminator
currently sets selectedIndex and writes the discriminator only in some cases,
leaving branch-specific fields stale; update the fallback path in the useEffect
so that when idx < 0 and enumOptions.length > 0 you always perform the same
variant-change cleanup as handleVariantChange (not just setSelectedIndex or
write the discriminator). Specifically, call the same sanitation/cleanup routine
(reuse handleVariantChange or the logic it uses) to reset formData,
setSelectedIndex(0), and write the default discriminator via onChange({
...sanitizedFormData, [discriminatorProp]: defaultDisc },
props.fieldPathId.path, undefined, field_id) so hidden branch fields are removed
and state is fully consistent with enumOptions[0].
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: caa019d9-2d97-41f2-a297-dde92e17cfa3
π Files selected for processing (2)
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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). (3)
- GitHub Check: types
- GitHub Check: end-to-end tests
- GitHub Check: Check PR Status
π§° Additional context used
π Path-based instructions (13)
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 development
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Runpnpm formatto auto-fix formatting issues before completing work
Runpnpm lintto check for lint errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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 developmentRun
pnpm typesto check for type errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code usingpnpm format
Never use components fromsrc/components/__legacy__/*
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components asComponentName/ComponentName.tsx+useComponentName.ts+helpers.tsand use design system components fromsrc/components/(atoms, molecules, organisms)
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}and regenerate withpnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local/componentsfolder
Avoid large hooks, abstract logic intohelpers.tsfiles when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not useuseCallbackoruseMemounless asked to optimize a given function
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components and handlers
Use type-safe generated API hooks via Orval + React Query for data fetching
Use React Query for server state management and co-locate UI state in components/hooks
Separate render logic (.tsx) from business logic (use*.tshooks)
Use only shadcn/ui (Radix UI primitives) with Tailwind CSS for UI components
Use Phosphor Icons only for all icon implementations
Use ErrorCard component for render errors, toast for mutations, and Sentry for exceptions
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*components
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not useuseCallbackoruseMemounless asked to optimize a specific function
Never type withanyunless a variable/attribute can actually be of any type
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,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)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
Component props should be
interface Props { ... }(not exported) unless the interface needs to be used outside the componentUse
type Props = { ... }(not exported) for component props unless used outside the component
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/app/(platform)/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
If adding protected frontend routes, update
frontend/lib/supabase/middleware.ts
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Fully capitalize acronyms in symbols, e.g.
graphID,useBackendAPI
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Put sub-components in a local
components/folder within the feature directory
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/[A-Z]*/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}
π CodeRabbit inference engine (.github/copilot-instructions.md)
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)
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π§ Learnings (22)
π Common learnings
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.
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*[Ww]orkflow*/**/*.{ts,tsx} : Use xyflow/react for visual graph editor implementation in the Workflow Builder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-03-10T06:22:52.942Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx:26-30
Timestamp: 2026-03-10T06:22:52.942Z
Learning: In the AutoGPT platform frontend (autogpt_platform/frontend/), `advanced=true` fields are always declared directly on the top-level `Input` class for every block. Advanced fields are never nested inside objects, arrays, anyOf, oneOf, or allOf variants. Therefore, a top-level-only check of `schema.properties` (as done in `hasAdvancedFields` in `CustomNode.tsx`) is sufficient and correct; a recursive schema walk is not needed.
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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)/build/components/FlowEditor/nodes/OutputHandler.tsxautogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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)/build/components/FlowEditor/nodes/OutputHandler.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 design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.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 PascalCase for component names and camelCase with 'use' prefix for hook names in React
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use design system components from `src/components/` (atoms, molecules, organisms)
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use React Query for server state management and co-locate UI state in components/hooks
Applied to files:
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.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)/build/components/FlowEditor/nodes/OutputHandler.tsx
π Learning: 2026-03-10T06:34:10.984Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Never type with `any` unless a variable/attribute can actually be of any type
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/**/*.{ts,tsx} : Never type with `any`, if no types available use `unknown`
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Run `pnpm types` to check for type errors and fix any that appear before completing work
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Use `type Props = { ... }` (not exported) for component props unless used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/use*.ts : Do not type hook returns; let TypeScript infer types as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.ts : Do not type hook returns, let Typescript infer as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-03-05T19:50:36.724Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 0
File: :0-0
Timestamp: 2026-03-05T19:50:36.724Z
Learning: In `autogpt_platform/frontend/src/app/api/helpers.ts`, the `getPaginationNextPageNumber()` function includes an intentional defensive null check (`if (!pagination) return undefined`) after destructuring `lastPage.data.pagination`. This was proven necessary in production because React Query calls `getNextPageParam` even with error responses (e.g., 401s) that lack the expected pagination structure. Returning `undefined` signals React Query to treat it as "no next page" and stop pagination instead of throwing a TypeError. This is valid and should not be flagged in future reviews.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Additional comments (7)
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx (6)
33-41: LGTM!State management for expandable objects is clean and correctly typed. The toggle function is simple and effective.
43-61: LGTM!The
hasConnectedOrBrokenDescendanthelper correctly traverses nested schema properties to detect connected or broken descendants. Recursion is properly bounded by schema depth and terminates when nopropertiesexist.
82-91: LGTM!The visibility and rendering logic correctly implements:
- Connected/broken descendants remain visible when parent is collapsed (via
descendantIsRelevant)- User-expanded branches show all children; auto-expanded branches filter to connected-only
- The
connectedOnlyflag properly controls filtering during recursive descent
100-112: LGTM!The expansion toggle is accessible (aria-label), uses appropriate Phosphor Icons, and the interaction is intuitive with standard caret direction conventions.
159-167: LGTM!The recursive rendering correctly:
- Resets
titlePrefixto show short names for nested keys- Uses
!isExpandedto filter children to connected-only when auto-expanded vs. showing all when user-expanded
195-195: LGTM!Passing
!isOutputVisibleasconnectedOnlyensures that when the Output section is collapsed, only connected or broken outputs remain visible at the root level, consistent with the nested behavior.autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)
135-148: Nice preservation of shared values on variant switches.Sanitizing against the old/new schemas before applying defaults avoids wiping overlapping fields when users flip the discriminator. Good change.
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
β»οΈ Duplicate comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)
157-166:β οΈ Potential issue | π MajorUnknown discriminator still isn't repaired when branch
0is already selected.If
formData[discriminatorProp]is cleared whileselectedIndex === 0, this effect now does nothing, so the hidden discriminator stays unset and the form can drift back into an invalid/incomplete state.π§ Suggested change
- } else if (enumOptions.length > 0 && selectedIndex !== 0) { - // Unknown or cleared discriminator β full reset via same cleanup path - handleVariantChange("0"); + } else if (enumOptions.length > 0) { + const defaultDisc = enumOptions[0].discriminatorValue; + if (selectedIndex !== 0) { + handleVariantChange("0"); + } else if ( + defaultDisc !== undefined && + currentDiscValue !== defaultDisc + ) { + onChange( + { ...formData, [discriminatorProp]: defaultDisc }, + props.fieldPathId.path, + undefined, + field_id, + ); + } }π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx` around lines 157 - 166, The effect that handles discriminator changes (useEffect referencing currentDiscValue, enumOptions, selectedIndex, and handleVariantChange) skips repairing a cleared/unknown discriminator when selectedIndex === 0; remove the selectedIndex !== 0 guard so that in the else branch (enumOptions.length > 0) you always call handleVariantChange("0") to force a full reset and restore formData[discriminatorProp], even if branch 0 is already selected.
π€ 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`:
- Around line 51-55: The current OneOfField uses useRef to store variants:
remove the useRef wrapper so variants is recomputed each render by calling
schemaUtils.retrieveSchema(opt, formData) over schema.oneOf (i.e., replace const
variants = useRef(... ) with a plain const variants = (schema.oneOf ||
[]).map(...)); update all later accesses from variants.current[...] to
variants[...] (affecting enumOptions and filteredSchema calculations) so
conditional schemas re-resolve when formData changes.
---
Duplicate comments:
In
`@autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`:
- Around line 157-166: The effect that handles discriminator changes (useEffect
referencing currentDiscValue, enumOptions, selectedIndex, and
handleVariantChange) skips repairing a cleared/unknown discriminator when
selectedIndex === 0; remove the selectedIndex !== 0 guard so that in the else
branch (enumOptions.length > 0) you always call handleVariantChange("0") to
force a full reset and restore formData[discriminatorProp], even if branch 0 is
already selected.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1eb6bf5e-8171-4c74-bb95-fa8d66c8b702
π Files selected for processing (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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). (6)
- GitHub Check: lint
- GitHub Check: types
- GitHub Check: Seer Code Review
- GitHub Check: end-to-end tests
- GitHub Check: Check PR Status
- GitHub Check: Analyze (python)
π§° Additional context used
π Path-based instructions (12)
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 development
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Runpnpm formatto auto-fix formatting issues before completing work
Runpnpm lintto check for lint errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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/components/renderers/InputRenderer/base/oneof/OneOfField.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 developmentRun
pnpm typesto check for type errors and fix any that appear before completing work
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}
π CodeRabbit inference engine (.github/copilot-instructions.md)
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)
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code usingpnpm format
Never use components fromsrc/components/__legacy__/*
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components asComponentName/ComponentName.tsx+useComponentName.ts+helpers.tsand use design system components fromsrc/components/(atoms, molecules, organisms)
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}and regenerate withpnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local/componentsfolder
Avoid large hooks, abstract logic intohelpers.tsfiles when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not useuseCallbackoruseMemounless asked to optimize a given function
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components and handlers
Use type-safe generated API hooks via Orval + React Query for data fetching
Use React Query for server state management and co-locate UI state in components/hooks
Separate render logic (.tsx) from business logic (use*.tshooks)
Use only shadcn/ui (Radix UI primitives) with Tailwind CSS for UI components
Use Phosphor Icons only for all icon implementations
Use ErrorCard component for render errors, toast for mutations, and Sentry for exceptions
Use design system components fromsrc/components/(atoms, molecules, organisms)
Never usesrc/components/__legacy__/*components
Use generated API hooks from@/app/api/__generated__/endpoints/with patternuse{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not useuseCallbackoruseMemounless asked to optimize a specific function
Never type withanyunless a variable/attribute can actually be of any type
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.tsx
π CodeRabbit inference engine (AGENTS.md)
Component props should be
interface Props { ... }(not exported) unless the interface needs to be used outside the componentUse
type Props = { ... }(not exported) for component props unless used outside the component
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/**/*.{ts,tsx}
π CodeRabbit inference engine (AGENTS.md)
Never type with
any, if no types available useunknown
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Fully capitalize acronyms in symbols, e.g.
graphID,useBackendAPI
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Put sub-components in a local
components/folder within the feature directory
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
autogpt_platform/frontend/src/**/[A-Z]*/**/*.{ts,tsx}
π CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)
Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π§ Learnings (15)
π Common learnings
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.
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
π Learning: 2026-03-10T06:34:10.984Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx:16-19
Timestamp: 2026-03-10T06:34:10.984Z
Learning: In `autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx`, the schema parameters in functions like `getDiscriminatorPropName` use `any` intentionally because `discriminator`, `const`, and `advanced` are custom JSON Schema extensions not present in `RJSFSchema` from `rjsf/utils`. A typed intersection `RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }` is the preferred alternative over bare `any` to maintain type safety while accommodating these extensions.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-03-10T06:22:52.942Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12354
File: autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx:26-30
Timestamp: 2026-03-10T06:22:52.942Z
Learning: In the AutoGPT platform frontend (autogpt_platform/frontend/), `advanced=true` fields are always declared directly on the top-level `Input` class for every block. Advanced fields are never nested inside objects, arrays, anyOf, oneOf, or allOf variants. Therefore, a top-level-only check of `schema.properties` (as done in `hasAdvancedFields` in `CustomNode.tsx`) is sufficient and correct; a recursive schema walk is not needed.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Never type with `any` unless a variable/attribute can actually be of any type
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/**/*.{ts,tsx} : Never type with `any`, if no types available use `unknown`
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Run `pnpm types` to check for type errors and fix any that appear before completing work
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Use `type Props = { ... }` (not exported) for component props unless used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-26T21:29:44.105Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.105Z
Learning: Applies to autogpt_platform/frontend/src/**/use*.ts : Do not type hook returns; let TypeScript infer types as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.ts : Do not type hook returns, let Typescript infer as much as possible
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-02-04T16:50:51.495Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Learning: 2026-03-05T19:50:36.724Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 0
File: :0-0
Timestamp: 2026-03-05T19:50:36.724Z
Learning: In `autogpt_platform/frontend/src/app/api/helpers.ts`, the `getPaginationNextPageNumber()` function includes an intentional defensive null check (`if (!pagination) return undefined`) after destructuring `lastPage.data.pagination`. This was proven necessary in production because React Query calls `getNextPageParam` even with error responses (e.g., 401s) that lack the expected pagination structure. Returning `undefined` signals React Query to treat it as "no next page" and stop pagination instead of throwing a TypeError. This is valid and should not be flagged in future reviews.
Applied to files:
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.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/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π 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/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
π Additional comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)
16-19: Replace bareanywith an extended schema type.These helpers only rely on a small set of custom JSON Schema extensions, so
anyis broader than necessary and drops useful checking across discriminator resolution and filtered-schema construction. A localExtendedRJSFSchemaintersection plusRecord<string, unknown>for form data would keep the custom fields while staying inside the repo's no-anyrule.Based on learnings: in
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx,anywas intentional becausediscriminator,const, andadvancedare custom extensions, but a typed intersection likeRJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean }is the preferred alternative. As per coding guidelines: "Never type withany, if no types available useunknown."Also applies to: 52-60, 98-107, 143-147
Summary
OneOfFieldcomponent that properlyrenders Pydantic discriminated unions. Hides the unusable parent object handle, auto-populates
the discriminator value, shows a dropdown with variant titles (e.g., "Username" / "UserId"), and
filters out the internal discriminator field from the form. Non-discriminated
oneOfschemasfall back to existing
AnyOfFieldbehavior.PersonLookupResponse.Url,PersonLookupResponse.profile) are now collapsed by default behind acaret toggle. Nested keys show short names instead of the full
Parent.Keyprefix.mb-6) fromFormRenderer, hide theAdvanced toggle when no advanced fields exist, and add rounded bottom corners on OUTPUT-type
blocks.
Test plan
no unusable parent handle, discriminator field is hidden, and the block can run without staying
INCOMPLETE
collapsed by default and expand on click with short labels
anyOfschemas (optional types, 3+ variant unions) still render correctly