Skip to content

feat(copilot): UX improvements#12258

Merged
kcze merged 22 commits intodevfrom
kpczerwinski/secrt-2055-feature-copilot-chat-ux-improvements-rename-new-chat-button
Mar 6, 2026
Merged

feat(copilot): UX improvements#12258
kcze merged 22 commits intodevfrom
kpczerwinski/secrt-2055-feature-copilot-chat-ux-improvements-rename-new-chat-button

Conversation

@kcze
Copy link
Contributor

@kcze kcze commented Mar 2, 2026

CoPilot conversation UX improvements (SECRT-2055):

  1. Rename conversations β€” Inline rename via the session dropdown menu. New PATCH /sessions/{session_id}/title endpoint with server-side validation (rejects blank/whitespace-only titles, normalizes whitespace). Pressing Enter or clicking away submits; Escape cancels without submitting.

  2. New Chat button moved to top & sticky β€” The 'New Chat' button is now at the top of the sidebar (under 'Your chats') instead of the footer, and stays fixed β€” only the session list below it scrolls. A subtle shadow separator mirrors the original footer style.

  3. Auto-generated title appears live β€” After the first message in a new chat, the sidebar polls for the backend-generated title and animates it in smoothly once available. The backend also guards against auto-title overwriting a user-set title.

  4. External Link popup redesign β€” Replaced the CSS-hacked external link confirmation dialog with a proper AutoGPT Dialog component using the design system (Button, Text, Dialog). Removed the old globals.css workaround.

Screenshot 2026-03-03 at 6 31 50 pm Screenshot 2026-03-02 at 6 39 07 pm Screenshot 2026-03-02 at 6 36 28 pm

Changes πŸ—οΈ

Backend:

  • routes.py: Added PATCH /sessions/{session_id}/title endpoint with UpdateSessionTitleRequest Pydantic model β€” validates non-blank title, normalizes whitespace, returns 404 vs 500 correctly
  • routes_test.py: New test file β€” 7 test cases covering success, whitespace trimming, blank rejection (422), not found (404), internal failure (500)
  • service.py: Auto-title generation now checks if a user-set title already exists before overwriting
  • openapi.json: Updated with new endpoint schema

Frontend:

  • ChatSidebar.tsx: Inline rename (Enter/blur submits, Escape cancels via ref flag); "New Chat" button sticky at top with shadow separator; session title animates when auto-generated title appears (AnimatePresence)
  • useCopilotPage.ts: Polls for auto-generated title after stream ends, stops as soon as title appears in cache
  • MobileDrawer.tsx: Updated to match sidebar layout changes
  • DeleteChatDialog.tsx: Removed redundant onClose prop (controlled Dialog already handles close)
  • message.tsx: Added ExternalLinkModal using AutoGPT design system; removed redundant onClose prop
  • globals.css: Removed old CSS hack for external link modal

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:
    • Create a new chat, send a message β€” verify auto-generated title appears in sidebar without refresh
    • Rename a chat via dropdown β€” Enter submits, Escape reverts, blank title rejected
    • Rename a chat, then send another message β€” verify user title is not overwritten by auto-title
    • With many chats, scroll the sidebar β€” verify "New Chat" button stays fixed at top
    • Click an external link in a message β€” verify the new dialog appears with AutoGPT styling

@kcze kcze requested a review from a team as a code owner March 2, 2026 09:45
@kcze kcze requested review from 0ubbe and majdyz and removed request for a team March 2, 2026 09:45
@github-project-automation github-project-automation bot moved this to πŸ†• Needs initial review in AutoGPT development kanban Mar 2, 2026
@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels Mar 2, 2026
@github-actions github-actions bot added the size/l label Mar 2, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 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 frontend in-place chat rename UI and header tweaks, a PATCH /sessions/{session_id}/title backend route with ownership/validation and retry logic, DB/model helpers to atomically set titles-if-empty (with cache sync), title-polling to detect generated titles, tests, OpenAPI updates, and small UI/style/webhook tweaks.

Changes

Cohort / File(s) Summary
Backend: Session title API & tests
autogpt_platform/backend/backend/api/features/chat/routes.py, autogpt_platform/backend/backend/api/features/chat/routes_test.py
Adds UpdateSessionTitleRequest and PATCH /sessions/{session_id}/title route with ownership validation, calls to model update, re-check logic to distinguish 404 vs 500, and tests covering success, validation, race, and related streaming file_id cases.
Backend: DB, model & service
autogpt_platform/backend/backend/copilot/db.py, autogpt_platform/backend/backend/copilot/model.py, autogpt_platform/backend/backend/copilot/service.py, autogpt_platform/backend/backend/data/db_manager.py
Adds atomic DB op update_chat_session_title_if_empty and model wrapper update_session_title_if_empty; upsert preserves cached title if present; background title-generation uses title-if-empty semantics and logs outcomes; RPC exposure wired.
Frontend: Chat sidebar rename UI & header
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx, autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
Implements in-place renaming state/input with focus/keyboard handlers, uses a patch mutation to update title, adds rename/delete dropdown, moves New Chat into header, and adjusts layout/animations.
Frontend: Title polling & page logic
autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
Adds polling constants and logic to poll sessions list after streams finish to detect asynchronously generated titles; invalidates session list until observed or attempts exhausted.
Frontend: API spec & types
autogpt_platform/frontend/src/app/api/openapi.json, autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
Adds OpenAPI entry and schema for PATCH /api/chat/sessions/{session_id}/title and imports typed list-sessions response for polling.
Frontend: Link safety modal & style tweak
autogpt_platform/frontend/src/components/ai-elements/message.tsx, autogpt_platform/frontend/src/app/globals.css
Adds ExternalLinkModal for link-safety confirmation and removes explicit CSS rule coloring the modal’s link button.
Frontend: Minor dialog behavior
autogpt_platform/frontend/src/app/(platform)/copilot/components/DeleteChatDialog/DeleteChatDialog.tsx
Removed onClose prop from Dialog to avoid automatic onCancel invocation on close events.
Integrations & webhook tweaks
autogpt_platform/backend/backend/data/integrations.py, autogpt_platform/backend/backend/integrations/webhooks/telegram.py
Refactors webhook events handling signature and where-clause logic; Telegram payload validation now maps unknown payloads to message.other without emitting a warning.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FE as "Frontend\nChatSidebar / MobileDrawer"
    participant API as "Backend\nPATCH /sessions/{id}/title"
    participant Service as "Copilot\nModel/Service"
    participant DB as "DB / Cache"

    User->>FE: Click Rename β†’ edit title
    FE->>API: PATCH /sessions/{id}/title (title)
    API->>Service: validate ownership -> request title update
    Service->>DB: atomic update IF title IS NULL
    DB-->>Service: success / no-op / not-found
    Service-->>API: result (success/failure)
    API-->>FE: 200 OK or 404/422/500
    FE->>FE: invalidate sessions list
    loop poll until observed or attempts exhausted
      FE->>API: GET /sessions (poll)
      API-->>FE: sessions list
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Review effort 4/5

Suggested reviewers

  • 0ubbe
  • Pwuts
  • Bentlybro

Poem

πŸ‡ A rabbit taps the title bar so spry,
I nibble whitespace and make it fly.
Rename, poll, a tiny hopβ€”then done,
Titles settle like dew in sun,
Hooray, the chat has a new name!

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

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'feat(copilot): UX improvements' is partially related to the changeset but overly broad and vagueβ€”it doesn't specify the main improvements (rename, auto-title, button relocation, link dialog redesign). Revise the title to be more specific about the primary changes, such as 'feat(copilot): Add inline session rename, sticky New Chat button, and auto-title polling' or similar.
βœ… Passed checks (1 passed)
Check name Status Explanation
Description check βœ… Passed The PR description is comprehensive, well-organized, and clearly related to the changeset. It explains the four main improvements with implementation details, test coverage, and visual references.

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

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kpczerwinski/secrt-2055-feature-copilot-chat-ux-improvements-rename-new-chat-button

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

This comment was marked as spam.

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: 6

🧹 Nitpick comments (1)
autogpt_platform/frontend/src/app/api/openapi.json (1)

13065-13071: Add basic validation constraints to UpdateSessionTitleRequest.title.

Line 13066 currently accepts any string, including empty values. Add at least minLength: 1 (and backend-aligned max length) so generated clients and docs enforce valid titles.

Suggested schema update
-        "properties": { "title": { "type": "string", "title": "Title" } },
+        "properties": {
+          "title": {
+            "type": "string",
+            "minLength": 1,
+            "title": "Title"
+          }
+        },
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@autogpt_platform/frontend/src/app/api/openapi.json` around lines 13065 -
13071, The UpdateSessionTitleRequest schema currently allows empty strings for
the title; update the "title" property inside UpdateSessionTitleRequest to
include validation constraints by adding "minLength": 1 and "maxLength":
<backend_max_length> (replace <backend_max_length> with the actual server-side
limit) so generated clients and docs enforce non-empty, backend-aligned title
lengths.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@autogpt_platform/backend/backend/api/features/chat/routes.py`:
- Around line 134-137: UpdateSessionTitleRequest currently accepts
whitespace-only titles; add server-side normalization and validation by
implementing a Pydantic validator (e.g., `@validator`("title", pre=True,
always=True)) that strips surrounding whitespace and raises a ValueError if the
resulting string is empty, ensuring the model stores the stripped title; apply
the same validator/logic to the other request model in this file that handles
session title updates (the similar request class defined later) so direct API
calls cannot create blank titles.
- Around line 279-285: The code treats a failed update_session_title result as a
404 even after _validate_and_get_session passed; change this to treat update
failures as server errors: in the block after calling
update_session_title(session_id, request.title) (referencing
_validate_and_get_session and update_session_title), log the failure and raise
an HTTPException with a 500 (or appropriate 5xx) status and a clear detail like
"Failed to update session title" (optionally include internal error/info if
available) instead of returning 404 so persistence/cache failures aren’t masked
as "not found."
- Around line 251-287: Add a new test module that covers the PATCH
/sessions/{session_id}/title route: write tests for update_session_title_route
using the UpdateSessionTitleRequest model to send payloads, mocking or patching
_validate_and_get_session and update_session_title to simulate success and
not-found, and exercising an unauthorized request by omitting authentication (or
asserting Security(auth.requires_user) behavior) plus a validation-error case
with invalid request data; ensure tests follow existing naming conventions
(e.g., test_update_session_title.py or _test.py), use the same test
fixtures/helpers used by other feature tests, assert correct HTTP status codes
and response bodies for success (200 {"status":"ok"}), 404 when
update_session_title returns False, 401/403 for unauthorized, and 422 for
request validation errors.

In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx:
- Around line 283-291: The input handlers currently cause duplicate or
unintended submits because onBlur always calls handleRenameSubmit while
onKeyDown also invokes it (Enter) and Escape sets editing state but still
triggers blur; update the component to track user action with a ref/flag (e.g.,
renameHandledRef) so onKeyDown sets renameHandledRef.current = true when
handling Enter or Escape (call handleRenameSubmit(session.id) for Enter,
setEditingSessionId(null) for Escape), and modify onBlur to only call
handleRenameSubmit(session.id) if renameHandledRef.current is false; reset
renameHandledRef.current = false after handling to allow future edits. Use the
existing symbols handleRenameSubmit, setEditingSessionId, onKeyDown, and onBlur
to locate and apply the change.
- Line 30: Remove the unused useCallback import and convert the
handleRenameSubmit handler from an arrow function to a plain function
declaration; specifically, remove useCallback from the import list at the top of
ChatSidebar.tsx and replace the current arrow/const handleRenameSubmit = (...)
=> { ... } with function handleRenameSubmit(event) { ... } (or matching
parameters) so the handler is a normal function declaration and no longer
memoized. Ensure all internal references to handleRenameSubmit remain unchanged
and update any types/closures as needed.

In `@autogpt_platform/frontend/src/components/ai-elements/message.tsx`:
- Around line 329-336: The Dialog is using both controlled mode and the
standalone onClose prop which causes duplicate close calls; remove the redundant
onClose prop and rely solely on the controlled.set callback. In message.tsx,
delete the onClose={onClose} passed to the Dialog (or conditionalize it) so only
the controlled object with its set: async (open) => { if (!open) onClose(); }
triggers closing; ensure any references to onClose remain available to the
controlled.set closure but are not passed as a separate prop to Dialog.

---

Nitpick comments:
In `@autogpt_platform/frontend/src/app/api/openapi.json`:
- Around line 13065-13071: The UpdateSessionTitleRequest schema currently allows
empty strings for the title; update the "title" property inside
UpdateSessionTitleRequest to include validation constraints by adding
"minLength": 1 and "maxLength": <backend_max_length> (replace
<backend_max_length> with the actual server-side limit) so generated clients and
docs enforce non-empty, backend-aligned title lengths.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1c51dd1 and 0acae97.

πŸ“’ Files selected for processing (6)
  • autogpt_platform/backend/backend/api/features/chat/routes.py
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/api/openapi.json
  • autogpt_platform/frontend/src/app/globals.css
  • autogpt_platform/frontend/src/components/ai-elements/message.tsx
πŸ’€ Files with no reviewable changes (1)
  • autogpt_platform/frontend/src/app/globals.css
πŸ“œ 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). (7)
  • GitHub Check: types
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
  • GitHub Check: end-to-end tests
🧰 Additional context used
πŸ““ Path-based instructions (19)
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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/components/ai-elements/message.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)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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/ai-elements/message.tsx
autogpt_platform/backend/**/*.py

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/backend/api/features/**/*.py

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/**/*.{py,txt}

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/backend/api/**/*.py

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

autogpt_platform/backend/backend/api/**/*.py: Use FastAPI for building REST and WebSocket endpoints
Use JWT-based authentication with Supabase integration

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/backend/**/*.py

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/**/*.py

πŸ“„ CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
🧠 Learnings (12)
πŸ““ Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Fill out the Changes section and checklist in pull requests
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Use conventional commit titles with a scope (e.g. `feat(frontend): add feature`) in pull requests
πŸ“š Learning: 2026-02-26T10:12:58.845Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12207
File: autogpt_platform/frontend/src/components/ai-elements/conversation.tsx:0-0
Timestamp: 2026-02-26T10:12:58.845Z
Learning: Guideline: Do not apply dark mode CSS classes (e.g., dark:text-*) to copilot UI components until dark mode support is implemented. Applies to all copilot-related components (paths containing /copilot/). When reviewing, search for dark:* class names within copilot components and refactor to use conditional class sets or feature-flag gates, ensuring no dark-mode styles are present in the code paths that render copilot UI unless dark mode support is officially enabled.

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '@/app/api/__generated__/' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-02-26T21:29:44.094Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.094Z
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)/copilot/components/ChatSidebar/ChatSidebar.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 React Query for server state (via generated hooks) in frontend development

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-03-01T07:58:56.207Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:58:56.207Z
Learning: When a backend field represents sensitive data, use a secret type (e.g., Pydantic SecretStr with length constraints) so OpenAPI marks it as a password/writeOnly field. Apply this pattern to similar sensitive request fields across API schemas so generated TypeScript clients and docs treat them as secrets and do not mishandle sensitivity. Review all openapi.jsons where sensitive inputs are defined and replace plain strings with SecretStr-like semantics with appropriate minLength constraints.

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
πŸ“š Learning: 2026-02-26T21:29:44.094Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-26T21:29:44.094Z
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/components/ai-elements/message.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/components/ai-elements/message.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/backend/backend/api/features/**/*.py : Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
🧬 Code graph analysis (3)
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx (2)
autogpt_platform/frontend/src/components/atoms/Text/Text.tsx (1)
  • Text (16-36)
autogpt_platform/frontend/src/components/ui/sidebar.tsx (1)
  • SidebarTrigger (776-776)
autogpt_platform/frontend/src/components/ai-elements/message.tsx (1)
autogpt_platform/frontend/src/components/atoms/Text/Text.tsx (1)
  • Text (16-36)
autogpt_platform/backend/backend/api/features/chat/routes.py (3)
autogpt_platform/backend/backend/copilot/model.py (1)
  • update_session_title (678-715)
autogpt_platform/backend/backend/blocks/apollo/models.py (1)
  • BaseModel (10-20)
autogpt_platform/backend/backend/util/request.py (2)
  • patch (584-585)
  • request (365-402)
πŸ”‡ Additional comments (5)
autogpt_platform/frontend/src/components/ai-elements/message.tsx (3)

11-13: Good move to shared design-system primitives.

This keeps modal UI elements consistent with the app’s component system.

As per coding guidelines: "Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development."


23-23: No actionable issue in this import update.


371-371: Clean modal integration point.

Using a dedicated modal component here keeps the MessageResponse render path tidy.

autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx (1)

74-84: Good UX improvement with clean implementation.

Placing β€œNew Chat” in the header makes the primary action easier to find on mobile, and this implementation is consistent with the component/style/icon conventions in this codebase.

As per coding guidelines: β€œUse design system components from src/components/,” β€œUse Tailwind CSS utilities only for styling,” and β€œUse Phosphor Icons only.”

autogpt_platform/frontend/src/app/api/openapi.json (1)

1304-1356: Looks good: new session-title PATCH route is consistent with adjacent chat endpoints.

Security, path param, request body reference, and error response set are coherent.

@kcze kcze marked this pull request as draft March 2, 2026 09:57
@kcze kcze marked this pull request as ready for review March 3, 2026 10:29
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: 3

🧹 Nitpick comments (1)
autogpt_platform/backend/backend/api/features/chat/routes_test.py (1)

120-147: Strengthen 422 tests with β€œno DB call” assertions.

For Line 120-147, also assert update_session_title is not called when validation fails. That prevents regressions where invalid titles accidentally reach persistence.

βœ… Test hardening snippet
 def test_update_title_blank_rejected(
@@
-    _mock_validate_and_get_session(mocker)
+    _mock_validate_and_get_session(mocker)
+    mock_update = _mock_update_session_title(mocker, success=True)
@@
     assert response.status_code == 422
+    mock_update.assert_not_called()
@@
 def test_update_title_empty_rejected(
@@
-    _mock_validate_and_get_session(mocker)
+    _mock_validate_and_get_session(mocker)
+    mock_update = _mock_update_session_title(mocker, success=True)
@@
     assert response.status_code == 422
+    mock_update.assert_not_called()
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@autogpt_platform/backend/backend/api/features/chat/routes_test.py` around
lines 120 - 147, Update both test_update_title_blank_rejected and
test_update_title_empty_rejected to assert the DB updater is not invoked: after
calling client.patch with the invalid title (whitespace or empty) and asserting
status_code == 422, also assert that the mocked update_session_title function
was not called (use the mock returned/created by _mock_validate_and_get_session
or patch update_session_title directly). This ensures update_session_title
remains uninvoked when validation fails.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@autogpt_platform/backend/backend/copilot/service.py`:
- Around line 456-459: The logger.info call that prints the full user-provided
title (logger.info(...) referencing captured_session_id and existing.title)
should be changed to avoid exposing raw user content; replace the detailed title
with safe metadata such as a redacted marker or the title length (e.g., "title
redacted" or f"title length={len(existing.title)}") and keep captured_session_id
for context, ensuring no raw existing.title is included in logs.
- Around line 452-461: The current flow reads the session via
get_chat_session(captured_session_id, captured_user_id) then unconditionally
calls update_session_title(captured_session_id, title), which can overwrite a
concurrent user rename; change this to an atomic compare-and-set at the
persistence layer (e.g., add and call a new method like
update_session_title_if_empty or update_session_title_conditional that performs
an atomic DB update only if title IS NULL/empty or matches an expected value,
returning a boolean indicating success), then branch on that result to log
whether the auto-title was applied or skipped; do not perform the unconditional
update in service.py anymoreβ€”use the new conditional persistence API and handle
its success/failure.

In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx:
- Around line 117-125: When starting a rename in handleRenameClick you must
clear the escape-cancel flag so future blur events aren’t ignored; set
renameCancelledRef.current = false alongside setEditingSessionId(id) and
setEditingTitle(title || "") to reset the cancel state. Apply the same reset in
any other handlers that open the edit UI (the handler around lines 291-297 that
also calls setEditingSessionId/setEditingTitle) so renameCancelledRef is always
cleared when beginning a new edit.

---

Nitpick comments:
In `@autogpt_platform/backend/backend/api/features/chat/routes_test.py`:
- Around line 120-147: Update both test_update_title_blank_rejected and
test_update_title_empty_rejected to assert the DB updater is not invoked: after
calling client.patch with the invalid title (whitespace or empty) and asserting
status_code == 422, also assert that the mocked update_session_title function
was not called (use the mock returned/created by _mock_validate_and_get_session
or patch update_session_title directly). This ensures update_session_title
remains uninvoked when validation fails.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 0acae97 and e924c6e.

πŸ“’ Files selected for processing (8)
  • autogpt_platform/backend/backend/api/features/chat/routes.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/DeleteChatDialog/DeleteChatDialog.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/components/ai-elements/message.tsx
πŸ’€ Files with no reviewable changes (1)
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/DeleteChatDialog/DeleteChatDialog.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • autogpt_platform/frontend/src/components/ai-elements/message.tsx
πŸ“œ Review details
🧰 Additional context used
πŸ““ Path-based instructions (22)
autogpt_platform/backend/**/*.py

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/**/*.{py,txt}

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/backend/**/*.py

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/**/*.py

πŸ“„ CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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/app/(platform)/copilot/useCopilotPage.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/app/(platform)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/useCopilotPage.ts
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
autogpt_platform/frontend/src/**/use*.ts

πŸ“„ CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

autogpt_platform/frontend/src/**/use*.ts: Extract component logic into custom hooks grouped by concern, with each hook in its own .ts file
Do not type hook returns; let TypeScript infer types as much as possible

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
autogpt_platform/backend/backend/api/features/**/*.py

πŸ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/**/*_test.py

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

autogpt_platform/backend/**/*_test.py: Always review snapshot changes with git diff before committing when updating snapshots with poetry run pytest --snapshot-update
Use pytest with snapshot testing for API responses in test files
Colocate test files with source files using the *_test.py naming convention

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
autogpt_platform/backend/backend/api/**/*.py

πŸ“„ CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

autogpt_platform/backend/backend/api/**/*.py: Use FastAPI for building REST and WebSocket endpoints
Use JWT-based authentication with Supabase integration

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
autogpt_platform/backend/**/*test*.py

πŸ“„ CodeRabbit inference engine (AGENTS.md)

Run poetry run test for backend testing (runs pytest with docker based postgres + prisma)

Files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
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)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/ChatSidebar/ChatSidebar.tsx
🧠 Learnings (24)
πŸ““ Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.495Z
Learning: Use conventional commit titles with a scope (e.g. `feat(frontend): add feature`) in pull requests
πŸ“š Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.

Applied to files:

  • autogpt_platform/backend/backend/copilot/service.py
  • autogpt_platform/backend/backend/copilot/model.py
  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes_test.py
  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use function declarations for components and handlers (not arrow functions) in React components

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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 function declarations (not arrow functions) for components and handlers

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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} : Do not use `useCallback` or `useMemo` unless asked to optimize a specific function

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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} : Use arrow functions only for callbacks, not for component declarations

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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} : Do not use `useCallback` or `useMemo` unless asked to optimize a given function

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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)/copilot/components/ChatSidebar/ChatSidebar.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 arrow functions for small inline lambdas (map, filter, etc.) in React components

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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} : Avoid large hooks, abstract logic into `helpers.ts` files when sensible

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-02-26T10:12:58.845Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12207
File: autogpt_platform/frontend/src/components/ai-elements/conversation.tsx:0-0
Timestamp: 2026-02-26T10:12:58.845Z
Learning: Guideline: Do not apply dark mode CSS classes (e.g., dark:text-*) to copilot UI components until dark mode support is implemented. Applies to all copilot-related components (paths containing /copilot/). When reviewing, search for dark:* class names within copilot components and refactor to use conditional class sets or feature-flag gates, ensuring no dark-mode styles are present in the code paths that render copilot UI unless dark mode support is officially enabled.

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
πŸ“š Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '@/app/api/__generated__/' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.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/backend/backend/blocks/**/*.py : Write tests alongside block implementation when adding new blocks in backend

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/*_test.py : Always review snapshot changes with `git diff` before committing when updating snapshots with `poetry run pytest --snapshot-update`

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-01-28T18:29:34.362Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-01-28T18:29:34.362Z
Learning: Applies to autogpt_platform/frontend/src/tests/src/tests/**/*.spec.ts : Place E2E tests (Playwright) in a centralized location for critical user journeys

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/**/test/**/*.py : Use snapshot testing with '--snapshot-update' flag in backend tests when output changes; always review with 'git diff'

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/*_test.py : Colocate test files with source files using the `*_test.py` naming convention

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/*_test.py : Use pytest with snapshot testing for API responses in test files

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-01-28T18:29:34.362Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-01-28T18:29:34.362Z
Learning: Applies to autogpt_platform/frontend/src/tests/src/tests/**/*.spec.ts : Use E2E tests (Playwright) for authentication flows (login, signup, logout) that MUST work in a real browser

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Run 'poetry run test' before committing backend changes to ensure all tests pass

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
πŸ“š Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/api/**/*.py : Use FastAPI for building REST and WebSocket endpoints

Applied to files:

  • autogpt_platform/backend/backend/api/features/chat/routes.py
🧬 Code graph analysis (3)
autogpt_platform/backend/backend/copilot/service.py (2)
autogpt_platform/backend/backend/copilot/model.py (1)
  • get_chat_session (342-394)
autogpt_platform/backend/backend/copilot/db.py (1)
  • get_chat_session (26-32)
autogpt_platform/backend/backend/api/features/chat/routes_test.py (3)
autogpt_platform/backend/backend/copilot/model.py (1)
  • ChatSession (126-302)
autogpt_platform/backend/backend/util/exceptions.py (1)
  • NotFoundError (43-44)
autogpt_platform/backend/backend/api/conftest.py (1)
  • mock_jwt_user (20-27)
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx (4)
autogpt_platform/frontend/src/components/molecules/Toast/use-toast.tsx (1)
  • toast (116-116)
autogpt_platform/frontend/src/components/ui/sidebar.tsx (3)
  • SidebarHeader (761-761)
  • SidebarTrigger (776-776)
  • SidebarContent (755-755)
autogpt_platform/frontend/src/components/atoms/Text/Text.tsx (1)
  • Text (16-36)
autogpt_platform/frontend/src/lib/utils/time.ts (1)
  • formatDate (21-29)
πŸ”‡ Additional comments (4)
autogpt_platform/backend/backend/copilot/model.py (1)

472-483: Good cache-title preservation guard.

This best-effort merge before cache_chat_session reduces accidental title loss during concurrent stream updates and keeps cache state closer to user intent.

autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts (1)

206-230: Polling lifecycle looks solid.

Nice job bounding attempts and explicitly clearing intervals on both restart and teardown; this avoids orphan timers and keeps title reconciliation predictable.

Also applies to: 355-361

autogpt_platform/backend/backend/api/features/chat/routes.py (2)

134-145: Validation at request boundary is well implemented.

The validator trims and rejects blank/whitespace-only titles before persistence, which closes the direct API bypass path cleanly.


294-306: Good 404 vs 500 failure split.

The post-update re-check avoids misreporting internal update failures as not-found after successful ownership validation.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

…ux-improvements-rename-new-chat-button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Copy link

@autogpt-reviewer autogpt-reviewer left a comment

Choose a reason for hiding this comment

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

PR #12258 β€” feat(copilot): UX improvements
Author: kcze | Files: 16 changed (+616/-120)

🎯 Verdict: APPROVE_WITH_CONDITIONS

What This PR Does

Adds four CoPilot UX improvements: (1) inline rename conversations via a new PATCH /sessions/{session_id}/title backend endpoint with ownership validation and atomic conditional updates, (2) sticky "New Chat" button moved from footer to always-visible sidebar header, (3) auto-generated title polling that detects when the backend has asynchronously generated a title after the first message, and (4) external link safety dialog redesigned using proper design system Dialog/Button components instead of CSS hacks.

Specialist Findings

πŸ›‘οΈ Security βœ… β€” Auth/authz correctly enforced: new PATCH endpoint uses Security(auth.requires_user) + Security(auth.get_user_id), DB WHERE clause scopes by both session_id AND userId. No injection risks (Prisma ORM), no secrets exposure, XSS mitigated by React auto-escaping. One should-fix: no max_length on title field allows arbitrarily large titles.

πŸ—οΈ Architecture βœ… β€” Clean RESTful sub-resource pattern (PATCH /sessions/{id}/title). Three-layer separation (route β†’ model β†’ db) is well-maintained. Atomic UPDATE WHERE title IS NULL eliminates the TOCTOU race for auto-titles. Should-fix: untyped -> dict response loses OpenAPI type safety; cache-title preservation in upsert_chat_session adds fragile coupling; ChatSidebar.tsx at 384 lines should extract rename logic into useRenameSession hook.

⚑ Performance βœ… β€” Prior claim of query key mismatch is FALSE (verified: title polling consistently uses {limit: 50} key). AnimatePresence correctly scoped to title span only. Should-fix: extra Redis GET on every upsert_chat_session call adds hot-path overhead during streaming; title polling fires even for follow-up messages in already-titled conversations (unnecessary API calls).

πŸ§ͺ Testing ⚠️ β€” 5 backend route tests cover the happy path and validation. However: update_chat_session_title DB function has zero test coverage (atomic conditional update, ownership scoping untested); update_session_title model function's new only_if_empty parameter untested; auto-title race guard in both service.py files untested; cache race guard in upsert_chat_session untested; zero frontend tests for rename keyboard flow, title polling, or ExternalLinkModal.

πŸ“– Quality βœ… β€” Good docstrings on new Python functions. Should-fix: hardcoded { limit: 50 } repeated 5 times across 2 files (cache correctness risk if one changes); inline style={} on collapsed-state button should use Tailwind classes; arbitrary shadow value should be extracted. ExternalLinkModal should be its own file.

πŸ“¦ Product βœ… β€” All four features follow industry-standard UX patterns (Slack/VS Code inline rename, sticky primary action, progressive title reveal). Keyboard accessibility good (Enter submits, Escape cancels, aria-label present). Tab-key submits via blur which matches VS Code convention. Missing: maxLength on rename input, optimistic update for snappier rename feel.

πŸ“¬ Discussion ⚠️ β€” kcze addressed all 5 of majdyz's inline comments (unified functions, added only_if_empty flag, clarified race condition comments). majdyz dismissed their changes_requested review. One unanswered comment: majdyz asked "why remove this?" about telegram.py changes (change may have been absorbed by merge from dev). PR has active merge conflicts (CONFLICTING label). Most CodeRabbit issues fixed across 4 rounds; remaining: no minLength in OpenAPI spec.

πŸ”Ž QA βœ… β€” Full live testing passed: signup flow works, New Chat button visible at top and sticky, inline rename with Enter/Escape works correctly, auto-title polling generates titles after first message, external link dialog uses proper design system components. 12 screenshots captured. No console errors (only expected LaunchDarkly dev warnings).

QA Screenshots

landing
after-signup
chat-sent
rename-input
rename-success
escape-cancel
auto-title
external-link-dialog

Conditions for Approval

  1. routes.py β€” Add max_length to title field (UpdateSessionTitleRequest.title): Add Field(max_length=200) to prevent storage of arbitrarily large titles. Also add maxLength to the <input> in ChatSidebar.tsx. (Security + Product)
  2. Resolve merge conflicts β€” PR is currently in CONFLICTING state. (Discussion)
  3. Answer majdyz's telegram.py question β€” Unanswered comment from reviewer. (Discussion)

Should Fix (Follow-up OK)

  1. db.py β€” Add unit tests for update_chat_session_title β€” Atomic conditional update with ownership scoping has zero test coverage. Test cases: title already exists β†’ no-op, title null β†’ updates, wrong user_id β†’ no-op. (Testing)
  2. model.py:479-481 β€” Optimize Redis read in upsert_chat_session β€” Only perform cache read when in-memory session has no title (if not session.title:), avoiding unnecessary Redis round-trips on every message during streaming. (Performance)
  3. useCopilotPage.ts β€” Skip title polling for already-titled sessions β€” Add guard if (currentSession?.title) return; to avoid 5 unnecessary API calls on follow-up messages. (Performance)
  4. ChatSidebar.tsx β€” Extract rename logic into useRenameSession hook β€” Component at 384 lines; rename state + handlers + mutation is a self-contained ~40-line hook. (Architecture + Quality)
  5. routes.py β€” Type the response model β€” Replace -> dict with a proper UpdateSessionTitleResponse(BaseModel) for OpenAPI codegen. (Architecture)
  6. Standardize query key usage β€” Extract { limit: 50 } into a shared constant to prevent cache-key mismatches if the value changes. (Quality + Performance)

Risk Assessment

Merge risk: LOW β€” Well-scoped UX changes with proper auth, atomic DB operations, and bounded polling. No schema migrations.
Rollback: EASY β€” Pure feature addition, no breaking changes to existing APIs.

@ntindle Clean UX PR with good security practices and atomic title handling. Three conditions: add max_length on title field, resolve merge conflicts, and answer the open telegram.py reviewer question. After that, good to merge.

ntindle
ntindle previously approved these changes Mar 6, 2026
…ux-improvements-rename-new-chat-button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

@Abhi1992002 Abhi1992002 self-requested a review March 6, 2026 06:00
@kcze kcze added this pull request to the merge queue Mar 6, 2026
Merged via the queue into dev with commit 08c49a7 Mar 6, 2026
29 checks passed
@kcze kcze deleted the kpczerwinski/secrt-2055-feature-copilot-chat-ux-improvements-rename-new-chat-button branch March 6, 2026 06:18
@github-project-automation github-project-automation bot moved this to Done in Frontend Mar 6, 2026
@github-project-automation github-project-automation bot moved this from πŸ‘πŸΌ Mergeable to βœ… Done in AutoGPT development kanban Mar 6, 2026
majdyz pushed a commit that referenced this pull request Mar 6, 2026
CoPilot conversation UX improvements (SECRT-2055):

1. **Rename conversations** β€” Inline rename via the session dropdown
menu. New `PATCH /sessions/{session_id}/title` endpoint with server-side
validation (rejects blank/whitespace-only titles, normalizes
whitespace). Pressing Enter or clicking away submits; Escape cancels
without submitting.

2. **New Chat button moved to top & sticky** β€” The 'New Chat' button is
now at the top of the sidebar (under 'Your chats') instead of the
footer, and stays fixed β€” only the session list below it scrolls. A
subtle shadow separator mirrors the original footer style.

3. **Auto-generated title appears live** β€” After the first message in a
new chat, the sidebar polls for the backend-generated title and animates
it in smoothly once available. The backend also guards against
auto-title overwriting a user-set title.

4. **External Link popup redesign** β€” Replaced the CSS-hacked external
link confirmation dialog with a proper AutoGPT `Dialog` component using
the design system (`Button`, `Text`, `Dialog`). Removed the old
`globals.css` workaround.

<img width="321" height="263" alt="Screenshot 2026-03-03 at 6 31 50 pm"
src="https://github.com/user-attachments/assets/3cdd1c6f-cca6-4f16-8165-15a1dc2d53f7"
/>

<img width="374" height="74" alt="Screenshot 2026-03-02 at 6 39 07 pm"
src="https://github.com/user-attachments/assets/6f9fc953-5fa7-4469-9eab-7074e7604519"
/>

<img width="548" height="293" alt="Screenshot 2026-03-02 at 6 36 28 pm"
src="https://github.com/user-attachments/assets/0f34683b-7281-4826-ac6f-ac7926e67854"
/>

**Backend:**
- `routes.py`: Added `PATCH /sessions/{session_id}/title` endpoint with
`UpdateSessionTitleRequest` Pydantic model β€” validates non-blank title,
normalizes whitespace, returns 404 vs 500 correctly
- `routes_test.py`: New test file β€” 7 test cases covering success,
whitespace trimming, blank rejection (422), not found (404), internal
failure (500)
- `service.py`: Auto-title generation now checks if a user-set title
already exists before overwriting
- `openapi.json`: Updated with new endpoint schema

**Frontend:**
- `ChatSidebar.tsx`: Inline rename (Enter/blur submits, Escape cancels
via ref flag); "New Chat" button sticky at top with shadow separator;
session title animates when auto-generated title appears
(`AnimatePresence`)
- `useCopilotPage.ts`: Polls for auto-generated title after stream ends,
stops as soon as title appears in cache
- `MobileDrawer.tsx`: Updated to match sidebar layout changes
- `DeleteChatDialog.tsx`: Removed redundant `onClose` prop (controlled
Dialog already handles close)
- `message.tsx`: Added `ExternalLinkModal` using AutoGPT design system;
removed redundant `onClose` prop
- `globals.css`: Removed old CSS hack for external link modal

- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Create a new chat, send a message β€” verify auto-generated title
appears in sidebar without refresh
- [x] Rename a chat via dropdown β€” Enter submits, Escape reverts, blank
title rejected
- [x] Rename a chat, then send another message β€” verify user title is
not overwritten by auto-title
- [x] With many chats, scroll the sidebar β€” verify "New Chat" button
stays fixed at top
- [x] Click an external link in a message β€” verify the new dialog
appears with AutoGPT styling

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
majdyz pushed a commit that referenced this pull request Mar 8, 2026
CoPilot conversation UX improvements (SECRT-2055):

1. **Rename conversations** β€” Inline rename via the session dropdown
menu. New `PATCH /sessions/{session_id}/title` endpoint with server-side
validation (rejects blank/whitespace-only titles, normalizes
whitespace). Pressing Enter or clicking away submits; Escape cancels
without submitting.

2. **New Chat button moved to top & sticky** β€” The 'New Chat' button is
now at the top of the sidebar (under 'Your chats') instead of the
footer, and stays fixed β€” only the session list below it scrolls. A
subtle shadow separator mirrors the original footer style.

3. **Auto-generated title appears live** β€” After the first message in a
new chat, the sidebar polls for the backend-generated title and animates
it in smoothly once available. The backend also guards against
auto-title overwriting a user-set title.

4. **External Link popup redesign** β€” Replaced the CSS-hacked external
link confirmation dialog with a proper AutoGPT `Dialog` component using
the design system (`Button`, `Text`, `Dialog`). Removed the old
`globals.css` workaround.

<img width="321" height="263" alt="Screenshot 2026-03-03 at 6 31 50 pm"
src="https://github.com/user-attachments/assets/3cdd1c6f-cca6-4f16-8165-15a1dc2d53f7"
/>

<img width="374" height="74" alt="Screenshot 2026-03-02 at 6 39 07 pm"
src="https://github.com/user-attachments/assets/6f9fc953-5fa7-4469-9eab-7074e7604519"
/>

<img width="548" height="293" alt="Screenshot 2026-03-02 at 6 36 28 pm"
src="https://github.com/user-attachments/assets/0f34683b-7281-4826-ac6f-ac7926e67854"
/>

### Changes πŸ—οΈ

**Backend:**
- `routes.py`: Added `PATCH /sessions/{session_id}/title` endpoint with
`UpdateSessionTitleRequest` Pydantic model β€” validates non-blank title,
normalizes whitespace, returns 404 vs 500 correctly
- `routes_test.py`: New test file β€” 7 test cases covering success,
whitespace trimming, blank rejection (422), not found (404), internal
failure (500)
- `service.py`: Auto-title generation now checks if a user-set title
already exists before overwriting
- `openapi.json`: Updated with new endpoint schema

**Frontend:**
- `ChatSidebar.tsx`: Inline rename (Enter/blur submits, Escape cancels
via ref flag); "New Chat" button sticky at top with shadow separator;
session title animates when auto-generated title appears
(`AnimatePresence`)
- `useCopilotPage.ts`: Polls for auto-generated title after stream ends,
stops as soon as title appears in cache
- `MobileDrawer.tsx`: Updated to match sidebar layout changes
- `DeleteChatDialog.tsx`: Removed redundant `onClose` prop (controlled
Dialog already handles close)
- `message.tsx`: Added `ExternalLinkModal` using AutoGPT design system;
removed redundant `onClose` prop
- `globals.css`: Removed old CSS hack for external link modal

### Checklist πŸ“‹

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Create a new chat, send a message β€” verify auto-generated title
appears in sidebar without refresh
- [x] Rename a chat via dropdown β€” Enter submits, Escape reverts, blank
title rejected
- [x] Rename a chat, then send another message β€” verify user title is
not overwritten by auto-title
- [x] With many chats, scroll the sidebar β€” verify "New Chat" button
stays fixed at top
- [x] Click an external link in a message β€” verify the new dialog
appears with AutoGPT styling

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end size/l size/xl

Projects

Status: βœ… Done
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants