Skip to content

fix(frontend/builder): handle discriminated unions and improve node layout#12354

Merged
Abhi1992002 merged 11 commits intodevfrom
abhimanyuyadav/secrt-2089-twitter-get-user-block-discriminated-union-renders-unusable
Mar 10, 2026
Merged

fix(frontend/builder): handle discriminated unions and improve node layout#12354
Abhi1992002 merged 11 commits intodevfrom
abhimanyuyadav/secrt-2089-twitter-get-user-block-discriminated-union-renders-unusable

Conversation

@Abhi1992002
Copy link
Contributor

@Abhi1992002 Abhi1992002 commented Mar 10, 2026

Summary

  • Discriminated union support (oneOf): Added a new OneOfField component that properly
    renders 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 oneOf schemas
    fall back to existing AnyOfField behavior.
  • Collapsible object outputs: Object-type outputs with nested keys (e.g.,
    PersonLookupResponse.Url, PersonLookupResponse.profile) are now collapsed by default behind a
    caret toggle. Nested keys show short names instead of the full Parent.Key prefix.
  • Node layout cleanup: Removed excessive bottom margin (mb-6) from FormRenderer, hide the
    Advanced toggle when no advanced fields exist, and add rounded bottom corners on OUTPUT-type
    blocks.
Screenshot 2026-03-10 at 11 31 55β€―AM Screenshot 2026-03-10 at 11 36 52β€―AM

Test plan

  • Add a Twitter Get User block β€” verify "Identifier" shows a dropdown (Username/UserId) with
    no unusable parent handle, discriminator field is hidden, and the block can run without staying
    INCOMPLETE
  • Add any block with object outputs (e.g., PersonLookupResponse) β€” verify nested keys are
    collapsed by default and expand on click with short labels
  • Verify blocks without advanced fields don't show the Advanced toggle
  • Verify existing anyOf schemas (optional types, 3+ variant unions) still render correctly
  • Check OUTPUT-type blocks have rounded bottom corners

Pwuts and others added 4 commits March 8, 2026 10:25
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
@Abhi1992002 Abhi1992002 requested a review from a team as a code owner March 10, 2026 05:59
@Abhi1992002 Abhi1992002 requested review from Pwuts and ntindle and removed request for a team March 10, 2026 05:59
@github-project-automation github-project-automation bot moved this to πŸ†• Needs initial review in AutoGPT development kanban Mar 10, 2026
@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Mar 10, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▢️ Resume reviews
  • πŸ” Trigger review

Walkthrough

Adds 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

Cohort / File(s) Summary
OneOf support & registry
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx, autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts, autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
Add OneOfField component implementing discriminated-union handling, register it in the base registry, and introduce isOneOfSchema() utility.
Union schema normalization
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx, autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
Treat oneOf like anyOf by using combined union checks for title/children visibility and spacing logic.
Advanced fields UI
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx, autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
Add internal hasAdvancedFields(schema) helper; pass isLastSection and hasAdvancedFields to NodeAdvancedToggle. Update NodeAdvancedToggle props, early-return when no advanced fields, and conditional rounded-corner styling.
Nested output expansion
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
Introduce per-field expansion state, caret expand/collapse UI, descendant-connected detection, and recursive/conditional rendering for nested object properties with connected-only filtering.
Styling & cleanup
autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx, autogpt_platform/frontend/src/components/renderers/InputRenderer/base/anyof/useAnyOfField.ts
Remove bottom margin from FormRenderer container and remove a debug console.log in useAnyOfField.
Renderer templates
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/*
Update templates to include oneOf in union checks used across title/children rendering and spacing logic.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Review effort 3/5

Suggested reviewers

  • 0ubbe
  • ntindle

Poem

πŸ‡ I hopped through schemas, picked a single way,
OneOf carrots glimmered in the field of play.
Toggles click, nested branches unfold,
I cleared old edges and let choices hold.
Hop, select, expand β€” small rabbit, code bold.

πŸš₯ Pre-merge checks | βœ… 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (2 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly and concisely summarizes the main changes: discriminated union support and node layout improvements, which directly correspond to the core features in the changeset.
Description check βœ… Passed The description is comprehensive and directly related to the changeset, detailing all three major features (discriminated unions, collapsible outputs, layout cleanup) with test plan and visual examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • πŸ“ Generate docstrings (stacked PR)
  • πŸ“ Generate docstrings (commit on current branch)
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch abhimanyuyadav/secrt-2089-twitter-get-user-block-discriminated-union-renders-unusable

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

πŸ” PR Overlap Detection

This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.

πŸ”΄ Merge Conflicts Detected

The 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: openapi.json, lock files.

@Abhi1992002 Abhi1992002 changed the title Abhimanyuyadav/secrt 2089 twitter get user block discriminated union renders unusable fix(frontend/builder): handle discriminated unions and improve node layout Mar 10, 2026
@Abhi1992002 Abhi1992002 requested a review from 0ubbe March 10, 2026 06:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between d0a1d72 and fbc49a8.

πŸ“’ Files selected for processing (10)
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/anyof/useAnyOfField.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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}: Run pnpm format to auto-fix formatting issues before completing work
Run pnpm lint to check for lint errors and fix any that appear before completing work

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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 development

Run pnpm types to check for type errors and fix any that appear before completing work

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_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 using pnpm format
Never use components from src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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 as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm 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 /components folder
Avoid large hooks, abstract logic into helpers.ts files 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 use useCallback or useMemo unless 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*.ts hooks)
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 from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not use useCallback or useMemo unless asked to optimize a specific function
Never type with any unless a variable/attribute can actually be of any type

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_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 use unknown

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/utils/schema-utils.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/base-registry.ts
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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 component

Use type Props = { ... } (not exported) for component props unless used outside the component

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/FieldTemplate.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_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.tsx
  • autogpt_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.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/FormRenderer.tsx
  • autogpt_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.tsx
  • autogpt_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.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_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.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/standard/TitleField.tsx
  • autogpt_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.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeAdvancedToggle.tsx
  • autogpt_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

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.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)

122-145: ⚠️ Potential issue | 🟠 Major

Preserve 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. AnyOfField already sanitizes the old branch into the new schema first; OneOfField should 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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 098622d and 9ed62e9.

πŸ“’ 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}: Run pnpm format to auto-fix formatting issues before completing work
Run pnpm lint to 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 development

Run pnpm types to 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 using pnpm format
Never use components from src/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 as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm 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 /components folder
Avoid large hooks, abstract logic into helpers.ts files 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 use useCallback or useMemo unless 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*.ts hooks)
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 from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not use useCallback or useMemo unless asked to optimize a specific function
Never type with any unless 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 component

Use 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 use unknown

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

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.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

πŸ€– Prompt for all review comments with AI agents
Verify each finding against 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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9ed62e9 and 87a6cf6.

πŸ“’ Files selected for processing (2)
  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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). (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}: Run pnpm format to auto-fix formatting issues before completing work
Run pnpm lint to check for lint errors and fix any that appear before completing work

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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 development

Run pnpm types to check for type errors and fix any that appear before completing work

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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 using pnpm format
Never use components from src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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 as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm 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 /components folder
Avoid large hooks, abstract logic into helpers.ts files 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 use useCallback or useMemo unless 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*.ts hooks)
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 from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not use useCallback or useMemo unless asked to optimize a specific function
Never type with any unless a variable/attribute can actually be of any type

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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 component

Use type Props = { ... } (not exported) for component props unless used outside the component

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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 use unknown

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • autogpt_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.tsx
  • 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/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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
🧠 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.tsx
  • 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/app/(platform)/build/components/FlowEditor/nodes/OutputHandler.tsx
  • 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} : 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 hasConnectedOrBrokenDescendant helper correctly traverses nested schema properties to detect connected or broken descendants. Recursion is properly bounded by schema depth and terminates when no properties exist.


82-91: LGTM!

The visibility and rendering logic correctly implements:

  1. Connected/broken descendants remain visible when parent is collapsed (via descendantIsRelevant)
  2. User-expanded branches show all children; auto-expanded branches filter to connected-only
  3. The connectedOnly flag 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 titlePrefix to show short names for nested keys
  • Uses !isExpanded to filter children to connected-only when auto-expanded vs. showing all when user-expanded

195-195: LGTM!

Passing !isOutputVisible as connectedOnly ensures 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx (1)

157-166: ⚠️ Potential issue | 🟠 Major

Unknown discriminator still isn't repaired when branch 0 is already selected.

If formData[discriminatorProp] is cleared while selectedIndex === 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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 87a6cf6 and 18f28cc.

πŸ“’ 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}: Run pnpm format to auto-fix formatting issues before completing work
Run pnpm lint to 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 development

Run pnpm types to 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 using pnpm format
Never use components from src/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 as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm 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 /components folder
Avoid large hooks, abstract logic into helpers.ts files 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 use useCallback or useMemo unless 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*.ts hooks)
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 from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling with design tokens
Do not use useCallback or useMemo unless asked to optimize a specific function
Never type with any unless 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 component

Use 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 use unknown

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 bare any with an extended schema type.

These helpers only rely on a small set of custom JSON Schema extensions, so any is broader than necessary and drops useful checking across discriminator resolution and filtered-schema construction. A local ExtendedRJSFSchema intersection plus Record<string, unknown> for form data would keep the custom fields while staying inside the repo's no-any rule.

Based on learnings: in autogpt_platform/frontend/src/components/renderers/InputRenderer/base/oneof/OneOfField.tsx, any was intentional because discriminator, const, and advanced are custom extensions, but a typed intersection like RJSFSchema & { discriminator?: string | { propertyName: string }; const?: unknown; advanced?: boolean } is the preferred alternative. As per coding guidelines: "Never type with any, if no types available use unknown."

Also applies to: 52-60, 98-107, 143-147

@github-project-automation github-project-automation bot moved this from πŸ†• Needs initial review to πŸ‘πŸΌ Mergeable in AutoGPT development kanban Mar 10, 2026
@Abhi1992002 Abhi1992002 added this pull request to the merge queue Mar 10, 2026
Merged via the queue into dev with commit 684845d Mar 10, 2026
21 checks passed
@Abhi1992002 Abhi1992002 deleted the abhimanyuyadav/secrt-2089-twitter-get-user-block-discriminated-union-renders-unusable branch March 10, 2026 14:31
@github-project-automation github-project-automation bot moved this from πŸ‘πŸΌ Mergeable to βœ… Done in AutoGPT development kanban Mar 10, 2026
@github-project-automation github-project-automation bot moved this to Done in Frontend Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/frontend AutoGPT Platform - Front end size/l

Projects

Status: βœ… Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants