Skip to content

refactor(frontend): use CredentialsGroupedView in builder nodes & remove dead code - #12382

Closed
Otto-AGPT wants to merge 1 commit into
devfrom
otto/secrt-2107-builder-credentials-grouped-view
Closed

refactor(frontend): use CredentialsGroupedView in builder nodes & remove dead code#12382
Otto-AGPT wants to merge 1 commit into
devfrom
otto/secrt-2107-builder-credentials-grouped-view

Conversation

@Otto-AGPT

@Otto-AGPT Otto-AGPT commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Refactors the builder's per-node credential rendering to use the centralised CredentialsGroupedView component instead of directly using CredentialsInput. This ensures consistent credential display (type badges, action buttons, system/user grouping) across all contexts — including multi-auth providers (OAuth + API Key).

Changes

CredentialField.tsx (builder node renderer):

  • Replaced direct CredentialsInput usage with CredentialsGroupedView
  • Converts the single credential schema to the CredentialField[] format expected by the grouped view
  • Preserves all existing behavior: optional toggle, node store integration, title rendering

CredentialsGroupedView.tsx:

  • Added variant and showTitle props, passed through to inner CredentialsInput instances
  • Enables use in both dialog contexts (default) and node-level contexts (node variant)

Dead code removal:

  • Deleted agent-run-draft-view.tsx — exported AgentRunDraftView but never imported anywhere
  • Deleted agent-status-chip.tsx — only consumed by the above dead file

Context

Related to #12378 which adds multi-auth credential type selection. This PR ensures the builder uses the same centralised component as run dialogs, copilot, and library views.

Resolves SECRT-2107


Co-authored-by: Ubbe (@0ubbe) hi@ubbe.dev

…ove dead code

- Refactor CredentialField to use the centralised CredentialsGroupedView
  instead of directly using CredentialsInput, ensuring consistent
  credential display (type badges, action buttons, system/user grouping)
  across all contexts including multi-auth providers (OAuth + API Key).

- Add variant and showTitle props to CredentialsGroupedView so it can be
  used in both dialog and node-level contexts.

- Delete dead legacy files:
  - agent-run-draft-view.tsx (exported but never imported)
  - agent-status-chip.tsx (only used by agent-run-draft-view)

Related: #12378
@Otto-AGPT
Otto-AGPT requested a review from a team as a code owner March 12, 2026 08:37
@Otto-AGPT
Otto-AGPT requested review from 0ubbe, Abhi1992002, Pwuts and majdyz and removed request for a team March 12, 2026 08:37
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Mar 12, 2026
@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Mar 12, 2026
@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR removes two legacy builder components (AgentRunDraftView and AgentStatusChip) and refactors credential input handling by replacing CredentialsInput with CredentialsGroupedView in CredentialField while adding new variant and showTitle props to credential components.

Changes

Cohort / File(s) Summary
Legacy Component Removals
agent-run-draft-view.tsx, agent-status-chip.tsx
Deleted AgentRunDraftView (810 lines) including preset creation/editing logic, agent execution, scheduling, and trigger management. Removed AgentStatusChip component and AgentStatus type definition (41 lines).
Credential Input Refactoring
CredentialsGroupedView/CredentialsGroupedView.tsx
Added variant ("default" | "node") and showTitle optional props; propagated these props to all CredentialsInput instances in both user and system credential groups.
Credential Field Rewiring
InputRenderer/custom/CredentialField/CredentialField.tsx
Replaced CredentialsInput with CredentialsGroupedView; introduced isRequired logic, unified handleCredentialChange callback, and credentialFields derived schema; added credential input mapping and requiredCredentials set; retained optional credentials toggle for builder mode.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

size/l, platform/frontend, Review effort 4/5

Suggested reviewers

  • 0ubbe
  • Abhi1992002
  • Pwuts

Poem

🐰 A legacy builder bids farewell with grace,
As credentials find their new resting place,
With variant props and grouped views so neat,
The UI refactoring is now complete! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: refactoring to use CredentialsGroupedView in builder nodes and removing dead code files.
Description check ✅ Passed The pull request description clearly explains the refactoring of credential rendering components and dead code removal, directly aligned with the changeset.

✏️ 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 otto/secrt-2107-builder-credentials-grouped-view

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.tsx (1)

72-89: Consider removing useCallback unless performance issues are observed.

The coding guidelines recommend avoiding useCallback unless optimization is needed. However, since this file already uses useMemo (lines 33-40) and the callback is passed as a prop, this is a reasonable pattern to follow for consistency.

🤖 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/custom/CredentialField/CredentialField.tsx`
around lines 72 - 89, The handleCredentialChange function is unnecessarily
wrapped in useCallback; replace the useCallback wrapper around
handleCredentialChange with a plain function declaration (keep the same name and
internal logic that calls onChange with the constructed object or undefined
using fieldPathId?.path) so it’s a normal const handleCredentialChange = (...)
=> { ... } and remove the dependency array; keep references to onChange and
fieldPathId?.path inside the function as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.tsx`:
- Around line 72-89: The handleCredentialChange function is unnecessarily
wrapped in useCallback; replace the useCallback wrapper around
handleCredentialChange with a plain function declaration (keep the same name and
internal logic that calls onChange with the constructed object or undefined
using fieldPathId?.path) so it’s a normal const handleCredentialChange = (...)
=> { ... } and remove the dependency array; keep references to onChange and
fieldPathId?.path inside the function as before.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf1a67c1-7026-4834-846b-7a7acad5b40d

📥 Commits

Reviewing files that changed from the base of the PR and between ade2baa and 5e2547d.

📒 Files selected for processing (4)
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/agent-status-chip.tsx
  • autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.tsx
💤 Files with no reviewable changes (2)
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/agent-status-chip.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/agent-run-draft-view.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). (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 (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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:59:02.311Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — For MCP manual token storage, backend model autogpt_platform/backend/backend/api/features/mcp/routes.py defines MCPStoreTokenRequest.token as Pydantic SecretStr with a min length constraint, which generates OpenAPI schema metadata (format: "password", writeOnly: true, minLength: 1) in autogpt_platform/frontend/src/app/api/openapi.json. Prefer SecretStr (with length constraints) for sensitive request fields so generated TS clients and docs treat them as secrets.
📚 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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.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/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx
🔇 Additional comments (6)
autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView.tsx (2)

29-42: LGTM!

The new variant and showTitle props are well-typed with proper JSDoc documentation. The default value for variant maintains backward compatibility, and both props are consistently passed through to all CredentialsInput instances below.


140-141: LGTM!

The new props are consistently propagated to both user credential and system credential CredentialsInput instances, ensuring uniform behavior across all rendered credentials.

Also applies to: 183-184

autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/CredentialField.tsx (4)

3-4: LGTM!

Good use of import type for the CredentialField type and extracting the key into a named constant to avoid magic strings.

Also applies to: 14-15


42-55: LGTM!

The logic correctly differentiates between builder canvas context (where credentialsOptional toggle controls requirement) and run dialogs (where schema's required array controls it). The credentialFields tuple correctly matches the CredentialField type signature [string, any] from helpers.ts.


57-70: LGTM!

The inputCredentials mapping correctly transforms formData into the Record<string, CredentialsMetaInput | undefined> format expected by CredentialsGroupedView, with proper conditional handling when no credential is selected.


100-108: LGTM!

The CredentialsGroupedView integration is correct:

  • showTitle={false} is appropriate since CredentialFieldTitle already renders the title above
  • variant="node" correctly indicates the builder node context
  • All required props are properly provided

@Otto-AGPT

Copy link
Copy Markdown
Contributor Author

Closing in favor of #12378 — Abhi's PR fixes the root issue in CredentialsInput which is used by both nodes and CredentialsGroupedView. Per Ubbe's request.

@Otto-AGPT Otto-AGPT closed this Mar 12, 2026
@github-project-automation github-project-automation Bot moved this to Done in Frontend Mar 12, 2026
@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to ✅ Done in AutoGPT development kanban Mar 12, 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/xl

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant