Skip to content

fix(frontend): stop silently destroying dict entries when key cleared - #12847

Open
djpjronline-netizen wants to merge 2 commits into
Significant-Gravitas:devfrom
djpjronline-netizen:a11y/dict-key-destructive-blur
Open

fix(frontend): stop silently destroying dict entries when key cleared#12847
djpjronline-netizen wants to merge 2 commits into
Significant-Gravitas:devfrom
djpjronline-netizen:a11y/dict-key-destructive-blur

Conversation

@djpjronline-netizen

Copy link
Copy Markdown
Contributor

Why / What / How

Why: WrapIfAdditionalTemplate (the RJSF template for dict / additional-properties fields) wired onBlur on the key input to call onRemoveProperty whenever the field was empty. A user who tabbed through a populated entry and briefly cleared the key — or pressed Delete by accident — would lose the entry with no warning, no confirmation, and no announcement to assistive tech. An explicit Remove button already exists immediately below the entry; the implicit blur-to-delete path was pure data-loss risk. WCAG 3.2.2 (On Focus), 3.3.4 (Error Prevention).

What: Keep the convenient "abandoned new entry cleans up on blur" flow, but stop destroying populated entries when the key is cleared.

How: Track whether the key has ever been non-empty with a ref initialized from the mount-time label:

  • New entry (never populated) + blur with empty key → auto-remove (preserves original UX)
  • Populated entry + user clears the key + blur → fall through to onKeyRenameBlur (entry stays, RJSF surfaces empty key as a validation error)

User has to use the explicit Remove button to actually delete a populated entry.

Changes 🏗️

One file: src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx (+19 / −3 lines).

Preserves the abandoned-new-entry cleanup. Removes the silent-destruction hazard for populated entries.

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • pnpm types passes
    • Block with a dict field (e.g., HTTP Request headers). Click Add Item → new empty entry appears. Click away without typing → entry auto-removes (unchanged behavior)
    • Add an entry, type a key, type a value, click away. Then clear the key and click away → entry stays with empty key (RJSF shows validation error) instead of disappearing silently
    • Click the explicit Remove button on a populated entry → entry is removed (unchanged)

Part of a six-branch accessibility pass. Does not depend on the other five branches.

WrapIfAdditionalTemplate wired `onBlur` on the dict-key input to call
`onRemoveProperty` whenever the field was empty. A user who tabbed
through a populated entry and briefly cleared the key (or pressed
Delete by accident) would lose the value with no warning, no
confirmation, and no announcement to assistive tech. An explicit
Remove button already exists right below — the implicit path was pure
data-loss risk.

Fix: track whether the key has ever been non-empty. Auto-remove still
fires for the "added a new entry, blurred without typing anything"
flow (so brand new empty entries clean up as before), but once a user
has entered a key, clearing and blurring just renames to empty string.
RJSF surfaces an empty key as a validation error, and the user has to
use the Remove button to actually delete.

Preserves the convenience of the abandoned-new-entry cleanup. Removes
the silent-destruction hazard for populated entries.
@djpjronline-netizen
djpjronline-netizen requested a review from a team as a code owner April 18, 2026 13:54
@djpjronline-netizen
djpjronline-netizen requested review from Pwuts and Swiftyos and removed request for a team April 18, 2026 13:54
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Apr 18, 2026
@CLAassistant

CLAassistant commented Apr 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

This PR targets the master branch but does not come from dev or a hotfix/* branch.

Automatically setting the base branch to dev.

@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Apr 18, 2026
@github-actions
github-actions Bot changed the base branch from master to dev April 18, 2026 13:54
@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Modified blur event handling in an object property input component to better track whether a key field has been populated, improving logic for deciding whether to remove or retain properties when the input is cleared.

Changes

Cohort / File(s) Summary
Object Input Property Management
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
Added useRef to track whether the key field ever had a non-empty value. Updated handleBlur logic to distinguish between never-populated keys (removes property) versus previously-populated keys (retains entry by calling onKeyRenameBlur instead of onRemoveProperty).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/s, platform/frontend

Suggested reviewers

  • ntindle

Poem

🐰 A key that whispered, then forgot to stay,
Now tracked with care through blur and day,
The ref remembers what was typed before,
So empty fields won't vanish anymore!
Smart logic hops where data flows.

🚥 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 and concisely describes the main change: preventing silent destruction of dictionary entries when keys are cleared.
Description check ✅ Passed The description provides clear context about why the change was made (accessibility and data-loss prevention), what was changed, how it was implemented, and includes a detailed test plan and checklist.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx (1)

48-67: ⚠️ Potential issue | 🟠 Major

Move hadKeyRef above the conditional return.

useRef is called only when additional is true (line 67, after the early return on line 49). This violates React's rules of hooks — hooks must be called unconditionally and in the same order on every render. Move const hadKeyRef = useRef(Boolean(label)) to the top of the component, before the if (!additional) check.

Use a function declaration for handleBlur instead of an arrow function.

Per the coding guidelines, handlers in React components should use function declarations, not arrow functions (reserve arrow functions for small inline callbacks like map/filter).

🤖 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/object/WrapIfAdditionalTemplate.tsx`
around lines 48 - 67, The hook useRef is currently called conditionally (const
hadKeyRef = useRef(Boolean(label)) after the early return for additional), which
breaks React's Rules of Hooks; move the declaration of hadKeyRef to the top of
the component body so it executes unconditionally before the if (!additional)
return. Also replace the arrow-function handler for handleBlur with a named
function declaration (e.g., function handleBlur(event) { ... }) per the
project's handler style; ensure references to id, label, keyId and
generateObjectPropertyTitleId remain unchanged and that handleBlur continues to
update hadKeyRef and perform the same blur logic.
🧹 Nitpick comments (1)
autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx (1)

69-83: Use a function declaration for the modified handler.

This handler is part of the changed blur behavior, so it should follow the frontend handler style.

♻️ Proposed refactor
-  const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
+  function handleBlur(e: React.FocusEvent<HTMLInputElement>) {
     if (e.target.value !== "") {
       hadKeyRef.current = true;
       onKeyRenameBlur(e);
       return;
@@
     } else {
       onRemoveProperty();
     }
-  };
+  }

As per coding guidelines, autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations (not arrow functions) for components and handlers.

🤖 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/object/WrapIfAdditionalTemplate.tsx`
around lines 69 - 83, Convert the arrow handler to a function declaration:
replace the const arrow "handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>
{ ... }" in WrapIfAdditionalTemplate.tsx with a function declaration "function
handleBlur(e: React.FocusEvent<HTMLInputElement>) { ... }" keeping the exact
existing logic and references to hadKeyRef.current, onKeyRenameBlur(e), and
onRemoveProperty(); ensure the signature uses React.FocusEvent<HTMLInputElement>
and that the function is used the same way by any JSX props or event bindings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx`:
- Around line 48-67: The hook useRef is currently called conditionally (const
hadKeyRef = useRef(Boolean(label)) after the early return for additional), which
breaks React's Rules of Hooks; move the declaration of hadKeyRef to the top of
the component body so it executes unconditionally before the if (!additional)
return. Also replace the arrow-function handler for handleBlur with a named
function declaration (e.g., function handleBlur(event) { ... }) per the
project's handler style; ensure references to id, label, keyId and
generateObjectPropertyTitleId remain unchanged and that handleBlur continues to
update hadKeyRef and perform the same blur logic.

---

Nitpick comments:
In
`@autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx`:
- Around line 69-83: Convert the arrow handler to a function declaration:
replace the const arrow "handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>
{ ... }" in WrapIfAdditionalTemplate.tsx with a function declaration "function
handleBlur(e: React.FocusEvent<HTMLInputElement>) { ... }" keeping the exact
existing logic and references to hadKeyRef.current, onKeyRenameBlur(e), and
onRemoveProperty(); ensure the signature uses React.FocusEvent<HTMLInputElement>
and that the function is used the same way by any JSX props or event bindings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e3106f3-eddc-4170-86fd-9c10b327de9d

📥 Commits

Reviewing files that changed from the base of the PR and between 1c0c7a6 and 2ac3bb7.

📒 Files selected for processing (1)
  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Seer Code Review
🧰 Additional context used
📓 Path-based instructions (11)
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

Format frontend code using pnpm format

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.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/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

autogpt_platform/frontend/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
Use function declarations (not arrow functions) for components and handlers
No dark: Tailwind classes — the design system handles dark mode
Use Next.js <Link> for internal navigation — never raw <a> tags
No any types unless the value genuinely can be anything
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue
Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer
Use generated API hooks from `@/app/api/generated/endpoints/` with pattern `use{Method}{Version}{OperationName}` and regenerate with `pnpm generate:api`
Do not use `useCallback` or `useMemo` unless asked to optimise a given function
Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions in the frontend

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.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/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/src/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts, use design system components from src/components/ (atoms, molecules, organisms), and never use src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from @/app/api/__generated__/endpoints/ following the pattern use{Method}{Version}{OperationName}, and regenerate with pnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local /components folder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not use useCallback or useMemo unless asked to optimise a given function

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Component props should use interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.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/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/**/*.tsx

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/**/*.tsx: Component props should be type Props = { ... } (not exported) unless it needs to be used outside the component
Use design system components from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/*
Tailwind CSS only for styling, use design tokens, Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
autogpt_platform/frontend/src/components/**/*.tsx

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/src/components/**/*.tsx: Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts
Use Storybook for design system components in src/components/

Files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
🧠 Learnings (12)
📓 Common learnings
Learnt from: kcze
Repo: Significant-Gravitas/AutoGPT PR: 0
File: :0-0
Timestamp: 2026-04-15T10:17:09.341Z
Learning: In `Significant-Gravitas/AutoGPT` (`autogpt_platform/frontend`), `vitest.config.mts` does NOT set `globals: true`, and `src/tests/integrations/vitest.setup.tsx` does NOT register the `testing-library/react` auto-cleanup hook. Therefore, integration test files (e.g., under `__tests__/`) MUST include an explicit `afterEach(cleanup)` call from `testing-library/react` to reset the DOM between tests — without it, tests fail with "multiple elements found" errors from the prior test's DOM. Do NOT flag `afterEach(cleanup)` as redundant in this codebase.
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: 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.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12577
File: autogpt_platform/frontend/src/app/(platform)/admin/components/AdminUserSearch.tsx:0-0
Timestamp: 2026-03-26T13:40:13.262Z
Learning: In `autogpt_platform/frontend`, the non-legacy `Input` component (`TextField`) requires `label` and `id` props and has a fundamentally different API from the legacy `@/components/__legacy__/ui/input`. The entire admin section intentionally continues to use the legacy `Input` for simple form inputs (e.g., search boxes) where those props are unnecessary. Do not flag the use of `@/components/__legacy__/ui/input` in admin components as a blocking issue until a lightweight non-legacy Input alternative is available.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.841Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No linter suppressors (`// ts-ignore`, `// eslint-disable`) — fix the actual issue
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12471
File: autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts:48-55
Timestamp: 2026-03-19T11:25:27.842Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts`, the debounced search pattern uses `useRef(debounce(...))` (lodash) rather than `useEffect`+`setTimeout`. The debounced callback atomically applies `setDebouncedSearch(value.trim())` and `setCurrentPage(1)`, so the page reset is deferred along with the filter change and never races ahead. The query is driven by `debouncedSearch` (not the raw `searchQuery`), so no stale-filter fetch occurs on the first keystroke. Do not flag this pattern as incorrect in future reviews.
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:09.987Z
Learning: In Significant-Gravitas/AutoGPT `autogpt_platform/frontend`, `executionID` values used as URL query params (e.g. `activeItem=` in `SitrepItem.tsx`) are always UUIDs (e.g. `550e8400-e29b-41d4-a716-446655440000`). Their character set `[0-9a-f-]` contains no reserved URL characters, so `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Do not flag direct UUID string interpolation into query strings as a URL-encoding issue.
📚 Learning: 2026-03-26T13:40:13.262Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12577
File: autogpt_platform/frontend/src/app/(platform)/admin/components/AdminUserSearch.tsx:0-0
Timestamp: 2026-03-26T13:40:13.262Z
Learning: In `autogpt_platform/frontend`, the non-legacy `Input` component (`TextField`) requires `label` and `id` props and has a fundamentally different API from the legacy `@/components/__legacy__/ui/input`. The entire admin section intentionally continues to use the legacy `Input` for simple form inputs (e.g., search boxes) where those props are unnecessary. Do not flag the use of `@/components/__legacy__/ui/input` in admin components as a blocking issue until a lightweight non-legacy Input alternative is available.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-13T13:10:33.180Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.ts:264-294
Timestamp: 2026-04-13T13:10:33.180Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.ts`, the `consecutiveEmptyPagesRef` and `prevFilteredLengthRef` refs used to track filtered-pagination exhaustion are intentional. The one-render lag in `filteredExhausted` (which reads `consecutiveEmptyPagesRef.current` synchronously) is by design — refs are preferred here to avoid triggering extra re-renders for internal fetch-state bookkeeping. Do not flag this as a stale-ref bug in future reviews.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.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/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-03-19T11:25:27.842Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12471
File: autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts:48-55
Timestamp: 2026-03-19T11:25:27.842Z
Learning: In `autogpt_platform/frontend/src/app/(platform)/admin/users/useAdminUsersPage.ts`, the debounced search pattern uses `useRef(debounce(...))` (lodash) rather than `useEffect`+`setTimeout`. The debounced callback atomically applies `setDebouncedSearch(value.trim())` and `setCurrentPage(1)`, so the page reset is deferred along with the filter change and never races ahead. The query is driven by `debouncedSearch` (not the raw `searchQuery`), so no stale-filter fetch occurs on the first keystroke. Do not flag this pattern as incorrect in future reviews.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-08T17:28:40.841Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:40.841Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No linter suppressors (`// ts-ignore`, `// eslint-disable`) — fix the actual issue

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-13T13:11:07.445Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:07.445Z
Learning: In `autogpt_platform/frontend`, do not flag direct interpolation of `executionID` UUID strings into URL query parameters (e.g., `activeItem=${executionID}` in JSX/Next links). If the value is a UUID string matching `[0-9a-f-]`, it contains no reserved URL characters, so additional `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Only treat it as an encoding issue if the query-param value is not guaranteed to be UUID-formatted (i.e., may include characters outside `[0-9a-f-]`).

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx
📚 Learning: 2026-04-15T22:49:06.896Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/components/ExecutionsTable.tsx:0-0
Timestamp: 2026-04-15T22:49:06.896Z
Learning: In the AutoGPT frontend (React Query + toast/ErrorCard patterns), do not require `Sentry.captureException` in React Query mutation `catch` blocks. React Query handles error propagation for mutation paths, so follow the established pattern: show toast notifications for mutation errors and use `ErrorCard` for render/fetch errors. Only add `Sentry.captureException` for truly manual/unexpected exception paths that are outside React Query’s control (e.g., standalone async utilities or event handlers not wired through React Query).

Applied to files:

  • autogpt_platform/frontend/src/components/renderers/InputRenderer/base/object/WrapIfAdditionalTemplate.tsx

Comment thread autogpt_platform/backend/backend/copilot/prompting.py
@Pwuts

Pwuts commented Jul 17, 2026

Copy link
Copy Markdown
Member

Could you please post a short video of you doing the test specified in the test checklist? Saves us a lot of time checking out & running your branch for testing :) Thanks in advance!

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.99%. Comparing base (6975941) to head (6d0c84b).
⚠️ Report is 77 commits behind head on dev.

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #12847      +/-   ##
==========================================
- Coverage   76.03%   75.99%   -0.05%     
==========================================
  Files        2694     2694              
  Lines      204308   204312       +4     
  Branches    19676    19677       +1     
==========================================
- Hits       155351   155257      -94     
- Misses      44609    44704      +95     
- Partials     4348     4351       +3     
Flag Coverage Δ
platform-frontend 46.13% <0.00%> (-0.05%) ⬇️
platform-frontend-e2e 30.76% <0.00%> (-0.81%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 82.82% <ø> (ø)
Platform Frontend 49.89% <0.00%> (-0.28%) ⬇️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the cla: signed CLA signed by all contributors label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: signed CLA signed by all contributors platform/frontend AutoGPT Platform - Front end size/m

Projects

Status: 🆕 Needs initial review
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants