Skip to content

feat(backend/copilot): gate decompose_goal on library-similarity check - #13242

Merged
goodluck1103 merged 100 commits into
devfrom
feat/decompose-goal-after-library-check
Jun 3, 2026
Merged

feat(backend/copilot): gate decompose_goal on library-similarity check#13242
goodluck1103 merged 100 commits into
devfrom
feat/decompose-goal-after-library-check

Conversation

@goodluck1103

@goodluck1103 goodluck1103 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Why / What / How

Why: On feat/task-decomposition-copilot, the agent-generation guide told the LLM to call decompose_goal before the similar-library check. That ordering is wrong: if find_library_agent(for_creation=true, …) returns a strong match, we should offer the user the existing agent instead of building a new one. Showing the "Build Plan" card first wastes tokens, flashes UI for an agent that will never be built, and primes the user toward "build new" before they've seen the match.

What: Reorder the agent-generation guide so the library check runs before decompose_goal, and tighten the surrounding prose so the load-bearing sections are as scannable as the rest of the workflow.

How: Prompt-only — no code gate. We initially shipped a programmatic require_library_check gate on DecomposeGoalTool, but reverted it after concluding that the guide's narrative ordering is sufficient and a stale claim in the prompt was actively misleading the model. The net code diff is now a single markdown file.

  • The guide's "Workflow for Creating/Editing Agents" section keeps the library-check step in position 1 and decompose_goal in position 2 — but both sections are rewritten for density.
  • Step 1 drops the response-class names (AgentsFoundResponse/NoResultsResponse), the require_library_check parenthetical, and the duplicated library_check_ack rule.
  • Step 2 drops the stale "Decomposition is gated on require_library_check" claim (the gate no longer exists), the duplicate UI-rendering reasoning, and the verbose field-separation list.
  • The standalone "Clarifying — Before or During Building" section is collapsed from 22 → 12 lines.
  • Step 10 deduplicates the library_check_ack rule already covered in step 1.
  • Net: agent_generation_guide.md shrinks by 47 lines (+41 / −88) with every load-bearing rule preserved (find_library_agent first, [N% match] prefix, never set library_check_ack proactively, builder-bound bypass, decompose_goal writes no surrounding text and doesn't wait, description plain English while block_name/action carry technical detail).

Changes 🏗️

  • backend/copilot/sdk/agent_generation_guide.md — Clarifying section, Workflow step 1, Workflow step 2, and Workflow step 10 condensed; stale require_library_check reference removed.

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:
    • poetry run pytest backend/copilot/tools/decompose_goal_test.py backend/copilot/tools/create_agent_test.py — 23/23 pass
    • poetry run pytest backend/copilot/tools/helpers_test.py — passes (no regression in gates that still apply to create_agent)
    • grep -n require_library_check backend/copilot/sdk/agent_generation_guide.md returns nothing
    • Frontend pnpm format && pnpm lint && pnpm types clean
    • Manual smoke (recommended before merge): in a fresh dev stack, ask the copilot to "build me a YouTube summarizer agent" and confirm in the streamed tool calls that find_library_agent(for_creation=true, goal_summary=…) fires before decompose_goal
    • Manual smoke: in a builder-bound session (open an existing agent in the Builder, then talk to the copilot), confirm decompose_goal runs without any pre-flight library call

For configuration changes:

  • .env.default is updated or already compatible with my changes
  • docker-compose.yml is updated or already compatible with my changes
  • I have included a list of my configuration changes in the PR description (under Changes)

goodluck1103 and others added 30 commits April 6, 2026 19:00
…_model_parameter

Some AI-category blocks do not expose a "model" input property in their
inputSchema. The fixer was injecting a default model value into these blocks,
which is incorrect. Now checks for the presence of "model" in inputSchema
properties before attempting to set or validate the model field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a decompose_goal tool that breaks user goals into sub-instructions
before building. Users see a plan checklist and can approve or modify
before the agent is created, improving transparency and control.

- Backend: DecomposeGoalTool, TaskDecompositionResponse model, system prompt update
- Frontend: DecomposeGoal component with StepItem checklist, approve/modify buttons

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ss companion text

- Move decomposition prompt from prompting.py to agent_generation_guide.md as a required pre-build gate
- Add tool-decompose_goal to CUSTOM_TOOL_TYPES so it renders individually (not collapsed)
- Add task_decomposition to INTERACTIVE_RESPONSE_TYPES so the box is pinned to response after streaming
- Filter out text parts (table) from response when decompose_goal is pinned
- Hide decompose_goal during streaming so the box only appears once all reasoning is complete and Approve is immediately actionable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ming render

- Revert ChatMessagesContainer streaming filter — decompose_goal now visible during stream
- Remove text suppression in splitReasoningAndResponse — table message is allowed alongside sub-instructions box

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e_goal UI

- Replace static Approve/Modify buttons with a 99s countdown timer that
  auto-approves when it expires
- Timer ring animates inline within "Starting in [N]s" text using SVG
  strokeDasharray; hover on the text swaps it to "Start now" via Tailwind
  named groups (group/label)
- Clicking Modify stops the timer, enters editable mode where steps can be
  renamed, deleted, or inserted between existing steps
- In edit mode only Approve is shown; timer and Modify are hidden
- showActions gated on isLastMessage (server-derived) so the timer never
  re-appears when returning to a session with prior messages
- Forward isLastMessage through ChatMessagesContainer → MessagePartRenderer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… input

- Replace <input type="text"> with <textarea> for step descriptions
- Use ref callback to set height from scrollHeight on every render so
  long descriptions wrap to multiple lines by default without interaction
- Bump countdown ring container from 20px to 24px and text from 9px to
  11px for better legibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add TaskDecompositionResponse to ToolResponseUnion for OpenAPI codegen
- Remove LLM-controllable require_approval param (hardcoded to True)
- Validate each step is a dict before calling .get()
- Validate step descriptions are non-empty
- Validate action values against allowlist, coerce unknown to DEFAULT_ACTION
- Align MAX_STEPS=8 with agent_generation_guide.md (was 10)
- Add DEFAULT_ACTION constant; use enum in schema
- Add model_validator to sync step_count with len(steps)
- Fix handleModify: pre-fill chat input via setInitialPrompt instead of sending dangling message
- Add approvedRef guard on handleModify to prevent double-clicks
- Fix eslint-disable: rewrite auto-approve effect without dependency suppression
- Fix hardcoded light-mode colors (bg-white, border-slate-200, text-zinc-800) → semantic tokens
- Fix error card: render ToolErrorCard whenever isError=true, not only when output is present
- Fix hint text: only show approve hint when requires_approval=true
- Remove dead `action` prop from StepItem
- Add aria-label to all StepStatusIcon states
- Tighten parseOutput type guards (Array.isArray check, no false positives)
- Rename isOperating → isPending for clarity
- Add backend unit tests for DecomposeGoalTool (16 cases)
- Add frontend unit tests for helpers.tsx (20 cases)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ssage changes

Add showActions to the auto-approve useEffect dependency array and
condition. This prevents the approval from firing after isLastMessage
becomes false (e.g. when a new message arrives just as the timer
expires), closing the race condition flagged by Sentry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… steps from approval

- Prevent simultaneous pending + error state when output-error has null payload:
  isPending is now false when isError is true
- Filter out steps with empty descriptions before building the approval
  message, preventing malformed input from reaching the LLM

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s.py

Merge upstream dev changes (Graphiti memory responses) alongside the
TaskDecompositionResponse added in this PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…esponse schema

The API schema was missing DecompositionStepModel and TaskDecompositionResponse
after the merge. Regenerated with export-api-schema and formatted with prettier.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ssions.py

The ToolName Literal must stay in sync with TOOL_REGISTRY keys. Adds
'decompose_goal' to the platform tools section to fix CI test failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t mode on new message

- Remove setInitialPrompt() from handleModify() — the inline editor is the
  sole editing UX; pre-filling the chat input simultaneously creates a
  conflicting interface where chat-input submission loses inline edits
- Add useEffect to reset isEditing when showActions goes false (new message
  arrives while editing), preventing users from being stuck in edit mode with
  no way to submit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The decompose_goal countdown was purely client-side: if the user closed the
tab before the timer ran out, the agent never got built. Add a server-side
timer that fires the same approval message even when no client is connected.

- backend/copilot/model.py: add append_message_if helper that appends a
  message inside the session lock only if a predicate is satisfied. Used
  by the auto-approve task to no-op when the user has already acted.
- backend/copilot/tools/decompose_goal.py: when the tool returns, schedule
  a fire-and-forget asyncio task (same _background_tasks pattern as
  agent_browser.py) that sleeps 90s, re-checks the session, and if no user
  message has appeared since, appends "Approved. Please build the agent."
  and enqueues a new copilot turn. Stays in process; restart-resilience
  is a documented follow-up.
- backend/copilot/tools/models.py: expose auto_approve_seconds on
  TaskDecompositionResponse so the frontend countdown is sourced from the
  backend instead of a hard-coded constant.
- frontend DecomposeGoal.tsx: seed secondsLeft from output.auto_approve_seconds
  with a 60s fallback for older sessions.
- Regenerate openapi.json with the new field.
- Tests: 9 new unit tests covering the predicate, the auto-approve flow
  (idle / user-acted / errors swallowed) and _schedule_auto_approve.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reopening a session was restarting the client countdown from a fresh 60s,
even though the server had been counting the whole time. Now the timer
reflects real elapsed time so the user sees the actual remaining seconds
(or 0, which auto-approves immediately).

- backend: stamp UTC created_at on TaskDecompositionResponse via a default
  factory. The timestamp is set when the tool returns and persisted in the
  message content JSON, so it survives DB round-trips.
- frontend: lazy-init secondsLeft from (auto_approve_seconds -
  (Date.now() - created_at)), clamped to [0, total]. Older messages
  without created_at fall back to a fresh full countdown (existing
  behaviour).
- Test: assert created_at is stamped within the duration of _execute().

Note: openapi.json regen is skipped in this commit because the existing
REST server is in use; the frontend reads tool output as opaque JSON via
custom helpers, so the regen is not required for the feature to work.
Regen later for completeness.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…streaming

After the build plan box appears, the assistant continues streaming a
short summary text. Clicking Approve or Modify in that 1-2s window failed
because the chat session is locked to the in-flight turn — sending a new
user message gets rejected.

- ChatMessagesContainer now forwards isCurrentlyStreaming through
  renderSegments → MessagePartRenderer → DecomposeGoalTool.
- DecomposeGoalTool computes actionsEnabled = showActions && !streaming
  and uses it to (a) disable the Approve, Modify, and timer buttons and
  (b) gate the auto-approve effect so the timer can hit 0 mid-stream
  without firing — the effect re-runs and approves once streaming ends.
- The countdown ring keeps ticking during streaming so it stays in sync
  with the server-side timer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…timer

The auto-approve task was firing a duplicate "Approved" message after the
agent had already been built manually. The predicate compared
ChatMessage.sequence against a baseline, but _save_session_to_db assigns
sequences in the DB without writing them back to the in-memory message
objects, and cache_chat_session writes those (sequence=None) objects to
Redis. So the predicate's loaded-from-cache view had None sequences for
freshly-appended messages, treated them as 0, and missed the user's
"Approved" entirely — leaving the timer to fire after the build had
already completed and re-injecting "Approved" for a duplicate turn.

Fix: capture len(session.messages) at schedule time and check for any
user-role message at index >= baseline. Indices are monotonic and require
no DB-side sequence bookkeeping.

Adds a regression test that constructs a session with sequence=None on
the user message, asserting the predicate detects it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… already passed

If the user reopened the tab between 60s and 90s after a decomposition
was created, the lazy initializer for ``secondsLeft`` would return 0
(server-stamped deadline already elapsed). The auto-approve useEffect
fires whenever ``secondsLeft === 0``, so it would silently send the
"Approved" message on mount with no user interaction — even if the user
came back specifically to click Modify.

Track in a ref whether the lazy init returned 0 because the deadline
had already passed (vs. 0 because the timer counted down from a
positive value), and skip the auto-approve in that case. The server's
own fallback timer (running 30s longer than the client) handles the
"user never returns" path, so the client doesn't need to silently fire
on mount. The user can still click Approve or Modify manually; the
server will inject its own approval at 90s if neither happens.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pre-existing formatting issue inherited from the dev merge — black wants
one blank line between TestUsdToMicrodollars and TestMaskEmail, not two.
This is unrelated to the decomposition feature but blocks CI lint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se.created_at

The created_at field was added to TaskDecompositionResponse a few commits
back but openapi.json was never regenerated, so the check-api-types CI
job (which re-exports the schema and asserts no diff) was failing.
Re-exporting via poetry run export-api-schema and prettier.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the 30s grace period — both client and server now fire at 60s.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se generated types

Blocker fix: the server-side auto-approve timer fired even when the user
was editing steps via Modify, potentially building an agent against a plan
the user had explicitly chosen to change.

- backend: change _auto_approve_tasks set → _pending_auto_approvals dict
  keyed by session_id. Add cancel_auto_approve(session_id) that looks up
  and cancels the pending asyncio task.
- backend: new POST /sessions/{id}/cancel-auto-approve endpoint in
  chat/routes.py, following the existing cancel_session_task pattern.
- frontend: handleModify() now fires postV2CancelAutoApproveTask
  (generated hook) as a best-effort cancel before entering edit mode.
- helpers.tsx: import DecompositionStepModel from generated API types
  instead of hand-rolling the interface. TaskDecompositionOutput stays
  hand-rolled (runtime shape differs from generated type for created_at).
- Add session_id to TaskDecompositionOutput so the cancel call has it.
- Default step.status to "pending" where the generated type is optional.
- 2 new tests: cancel_auto_approve cancels pending task + returns false
  for unknown session.
- Regenerate openapi.json with the new endpoint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The cancel endpoint runs in the AgentServer process while the asyncio
auto-approve task lives in the CoPilotExecutor process — separate memory.
The in-process dict cancel from the previous commit was a no-op across
processes.

- cancel_auto_approve now SETs a Redis key with TTL as the primary cancel
  signal, plus best-effort in-process task.cancel() for single-worker.
- _run_auto_approve checks the Redis key before firing. If set, skips.
- Tests stub get_redis_async with a fake to avoid real Redis connections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ssages

Both the client and server fired "Approved. Please build the agent." at
~60s, producing two messages and two agent-build turns.

The server-side timer is now the sole auto-approver. The client countdown
is purely visual — when it hits 0, the server's synthetic message arrives
via SSE. User clicks (Start now / Approve in edit mode) still call
approve() directly and send the message; the server's predicate sees
the user message and skips its own.

Removes wasInitiallyPastDeadlineRef (no longer needed since the client
never fires auto-approve on its own) and the auto-approve useEffect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…approve

Sentry correctly identified that after a user clicks Modify (which sets
a Redis cancel flag) and then the LLM calls decompose_goal again for a
new plan, the stale cancel flag would suppress the new auto-approve.

_schedule_auto_approve is now async and DELETEs the Redis cancel key
before scheduling the new task. Also fixes the autouse test fixture to
use an async no-op (matching the now-async function signature).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s are empty

If the user cleared all step descriptions without deleting the steps,
buildMessage() produced "Approved with modifications. Please build the
agent following these steps: " — a dangling colon with no actual steps.
Now falls back to the standard "Approved. Please build the agent." when
filledSteps is empty after filtering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… UI not updating

When the server was the sole auto-approver (both at 60s, client removed),
users who stayed in the session saw nothing happen — the server fired
the turn but the frontend had no SSE subscription to receive the events.

Restore the client-side auto-approve effect so it fires at 60s (creating
the SSE subscription), and add a 5s server grace (server fires at 65s).
When the client IS present, it fires first → SSE → user sees the build.
The server wakes 5s later, sees the client's message, skips. When the
client is gone (tab closed), the server fires at 65s as the fallback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ter-library-check

# Conflicts:
#	autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
#	autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
#	autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
@goodluck1103
goodluck1103 requested a review from a team as a code owner May 28, 2026 21:03
@goodluck1103
goodluck1103 requested review from Bentlybro and kcze and removed request for a team May 28, 2026 21:03
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban May 28, 2026
@github-actions github-actions Bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end size/l labels May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR updates the agent-generation guide to restructure when goal decomposition occurs. The "Clarifying — Before or During Building" section is streamlined, a library-similarity check gate is added as a prerequisite step, and the plan-showing step is incorporated into the main workflow. Editing flow is clarified to require UUID-based agent retrieval with include_graph=true, and subsequent workflow steps are renumbered accordingly.

Changes

Agent Generation Guide Restructuring

Layer / File(s) Summary
Workflow documentation restructuring
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
Guide streamlines ambiguity-resolution guidance, adds a library-similarity check gate and conditional plan-showing step that constrains decompose_goal invocation, clarifies editing flow to require UUID scoping and full-graph retrieval with include_graph=true cautions, and renumbers block discovery, composition lookup, JSON generation, validation, saving, and dry-run verification steps to align with the new workflow sequence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

size/l, documentation

Suggested reviewers

  • Bentlybro
  • kcze
  • 0ubbe

Poem

🐰 A guide takes shape, refined with care,
Where decompose awaits its library snare,
UUID paths through edits flow,
Plans now in the workflow show,
Steps renumbered, crystal clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: gating the decompose_goal function to execute only after a library-similarity check, which is the primary objective of the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the problem (decompose_goal ordering wastes tokens and biases users), the solution (reorder guide and gate with library check), and provides implementation details with test results.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/decompose-goal-after-library-check

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.

Actionable comments posted: 2

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/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts (1)

1-498: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

File length exceeds guideline limit by 2.5×.

This file is 498 lines, which exceeds the guideline of ~200 lines for frontend TypeScript files. Consider splitting by responsibility into separate modules:

  • Marker parsing utilities (lines 224-286) → markers.ts
  • Artifact extraction/processing (lines 288-360, 400-453) → artifacts.ts
  • Workspace URL resolution (lines 455-497) → workspace-urls.ts
  • Message segmentation/splitting (lines 110-207) → current file

As per coding guidelines, keep files under ~200 lines and extract helpers or sub-modules when files grow beyond this.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/components/ChatMessagesContainer/helpers.ts
around lines 1 - 498, This file is too large; refactor by extracting cohesive
helper modules and updating imports: move marker-related code (escapeRegExp,
RETRYABLE_ERROR_MARKER_RE, ERROR_MARKER_RE, SYSTEM_MARKER_RE,
parseSpecialMarkers and COPILOT_* constants) into a new markers.ts; move
artifact-related code (FULL_UUID, defaultWorkspaceFileUrl,
filePartToArtifactRef, extractWorkspaceArtifacts, getMessageArtifacts,
getMostRecentArtifact and WORKSPACE_FILE_PATTERN/WORKSPACE_URI_PATTERN) into
artifacts.ts; move resolveWorkspaceUrls into workspace-urls.ts (keep
defaultWorkspaceFileUrl exported or duplicated as needed); keep message
segmentation and related helpers (isReasoningToolPart, isCompletedToolPart,
isInteractiveToolPart, buildRenderSegments, splitReasoningAndResponse,
splitReasoningAndResponse helpers) in the original file; export/import the moved
functions/constants from their new modules and update any call sites accordingly
so behavior is unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@autogpt_platform/backend/backend/copilot/tools/decompose_goal.py`:
- Around line 94-96: The gate message loop happens because decompose_goal's tool
schema lacks the optional library_check_ack flag but the handler always calls
require_library_check(session, "decompose_goal"); fix by adding an optional
boolean parameter "library_check_ack" to decompose_goal's tool parameters and
make decompose_goal read that flag from the incoming payload and pass it into
require_library_check (i.e., call require_library_check(session,
"decompose_goal", library_check_ack=payload.get("library_check_ack", False))).
Update any input validation/typing for the decompose_goal handler to accept this
new field so the gate can be honored like in create_agent.

In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/components/ChatMessagesContainer/helpers.ts:
- Around line 158-168: The codebase inconsistently uses
Array.prototype.findLastIndex despite the manual reverse-loop workaround in
ChatMessagesContainer/helpers.ts; replace all uses of messages.findLastIndex in
getTurnMessages (in ChatMessagesContainer/helpers.ts) and the other modules
mentioned (useCopilotPage.ts and helpers/convertChatSessionToUiMessages.ts) with
the same explicit reverse-loop pattern used around isReasoningBoundary, or
alternately update the existing comment to justify why only the
reasoning-boundary case uses the loop; also split
ChatMessagesContainer/helpers.ts into smaller modules (e.g., turn-parsing,
rendering-helpers, boundary-checks) to bring the file down toward the ~200-line
guideline, keeping function names like getTurnMessages and isReasoningBoundary
intact for callers.

---

Outside diff comments:
In
`@autogpt_platform/frontend/src/app/`(platform)/copilot/components/ChatMessagesContainer/helpers.ts:
- Around line 1-498: This file is too large; refactor by extracting cohesive
helper modules and updating imports: move marker-related code (escapeRegExp,
RETRYABLE_ERROR_MARKER_RE, ERROR_MARKER_RE, SYSTEM_MARKER_RE,
parseSpecialMarkers and COPILOT_* constants) into a new markers.ts; move
artifact-related code (FULL_UUID, defaultWorkspaceFileUrl,
filePartToArtifactRef, extractWorkspaceArtifacts, getMessageArtifacts,
getMostRecentArtifact and WORKSPACE_FILE_PATTERN/WORKSPACE_URI_PATTERN) into
artifacts.ts; move resolveWorkspaceUrls into workspace-urls.ts (keep
defaultWorkspaceFileUrl exported or duplicated as needed); keep message
segmentation and related helpers (isReasoningToolPart, isCompletedToolPart,
isInteractiveToolPart, buildRenderSegments, splitReasoningAndResponse,
splitReasoningAndResponse helpers) in the original file; export/import the moved
functions/constants from their new modules and update any call sites accordingly
so behavior is unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df284532-a5c3-42fc-b86b-2a3bfb5cb714

📥 Commits

Reviewing files that changed from the base of the PR and between 2cad7c4 and a0dbaaa.

📒 Files selected for processing (4)
  • autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: check API types
  • GitHub Check: integration_test
  • GitHub Check: lint
  • GitHub Check: test (3.13)
  • GitHub Check: Analyze (python)
  • GitHub Check: end-to-end tests
  • GitHub Check: type-check (3.11)
  • GitHub Check: lint
  • GitHub Check: types
  • GitHub Check: Analyze (typescript)
  • GitHub Check: type-check (3.12)
  • GitHub Check: test (3.12)
  • GitHub Check: type-check (3.13)
  • GitHub Check: test (3.11)
  • GitHub Check: lint
  • GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (13)
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

autogpt_platform/backend/**/*.py: Use poetry run ... command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies like openpyxl
Use absolute imports with from backend.module import ... for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoid hasattr/getattr/isinstance for type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no # type: ignore, # noqa, # pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use %s for deferred interpolation in debug log statements for efficiency; use f-strings elsewhere for readability (e.g., logger.debug("Processing %s items", count) vs logger.info(f"Processing {count} items"))
Sanitize error paths by using os.path.basename() in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Use transaction=True for Redis pipelines to ensure atomicity on multi-step operations
Use max(0, value) guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...

Files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
autogpt_platform/{backend,autogpt_libs}/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.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

Format frontend code using pnpm format

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
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/ChatMessagesContainer/helpers.ts
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}: Use function declarations (not arrow functions) for components/handlers
No any types unless the value genuinely can be anything
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
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

autogpt_platform/frontend/src/**/*.{ts,tsx}: Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Always import the -Icon-suffixed alias from @phosphor-icons/react (e.g. TrashIcon, PlusIcon, SquareIcon) — bare exports are deprecated
Do not use useCallback or useMemo unless asked to optimize a given function
Never use src/components/__legacy__/* — use design system components from src/components/

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/frontend/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

No barrel files or index.ts re-exports in the frontend

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/frontend/src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not type hook returns, let Typescript infer as much as possible

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

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.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/components/ChatMessagesContainer/helpers.ts
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}

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

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}

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

Avoid index and barrel files

Files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
autogpt_platform/backend/**/*_test.py

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

autogpt_platform/backend/**/*_test.py: Use pytest with snapshot testing for API responses
Colocate test files with source files using *_test.py naming convention
Mock at boundaries — mock where the symbol is used, not where it's defined; after refactoring, update mock targets to match new module paths
Use AsyncMock from unittest.mock for async functions in tests
When writing tests, use Test-Driven Development (TDD): write failing tests marked with @pytest.mark.xfail before implementation, then remove the marker once the implementation is complete
When creating snapshots in tests, use poetry run pytest path/to/test.py --snapshot-update; always review snapshot changes with git diff before committing

Files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
autogpt_platform/backend/**/*.md

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Document agent responsibilities and interfaces in markdown files

Files:

  • autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
🧠 Learnings (18)
📚 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/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
  • autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-04T08:04:35.881Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12273
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:216-220
Timestamp: 2026-03-04T08:04:35.881Z
Learning: In the AutoGPT Copilot backend, ensure that SVG images are not treated as vision image types by excluding 'image/svg+xml' from INLINEABLE_MIME_TYPES and MULTIMODAL_TYPES in tool_adapter.py; the Claude API supports PNG, JPEG, GIF, and WebP for vision. SVGs (XML text) should be handled via the text path instead, not the vision path.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-04-01T04:17:41.600Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12632
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-01T04:17:41.600Z
Learning: When reviewing AutoGPT Copilot tool implementations, accept that `readOnlyHint=True` (provided via `ToolAnnotations`) may be applied unconditionally to *all* tools—even tools that have side effects (e.g., `bash_exec`, `write_workspace_file`, or other write/save operations). Do **not** flag these tools for having `readOnlyHint=True`; this is intentional to enable fully-parallel dispatch by the Anthropic SDK/CLI and has been E2E validated. Only flag `readOnlyHint` issues if they conflict with the established `ToolAnnotations` behavior (e.g., missing/incorrect propagation relative to the intended annotation mechanism).

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-04T12:19:39.243Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12279
File: autogpt_platform/backend/backend/copilot/tools/base.py:184-188
Timestamp: 2026-03-04T12:19:39.243Z
Learning: In autogpt_platform/backend/backend/copilot/tools/, ensure that anonymous users always pass user_id=None to tool execution methods. The anon_ prefix (e.g., anon_123) is used only for PostHog/analytics distinct_id and must not be used as an actual user_id. Use a simple truthiness check on user_id (e.g., if user_id: ... else: ... or a dedicated is_authenticated flag) to distinguish anonymous from authenticated users, and review all tool execution call sites within this directory to prevent accidentally forwarding an anon_ user_id to tools.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-31T14:22:26.566Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:26.566Z
Learning: In files under autogpt_platform/backend/backend/copilot/tools/, ensure agent graph enrichment uses the typed Pydantic model `backend.data.graph.Graph` for `AgentInfo.graph` (i.e., `Graph | None`), not `dict[str, Any]`. When enriching with graph data (e.g., `_enrich_agents_with_graph`), prefer calling `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly to retrieve the typed `Graph` object rather than routing through JSON conversions like `get_agent_as_json()` / `graph_to_json()`.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-05T15:42:08.207Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12297
File: .claude/skills/backend-check/SKILL.md:14-16
Timestamp: 2026-03-05T15:42:08.207Z
Learning: In Python files under autogpt_platform/backend (recursively), rely on poetry run format to perform formatting (Black + isort) and linting (ruff). Do not run poetry run lint as a separate step after poetry run format, since format already includes linting checks.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-16T16:35:40.236Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/api/features/workflow_import.py:54-63
Timestamp: 2026-03-16T16:35:40.236Z
Learning: Avoid using the word 'competitor' in public-facing identifiers and text. Use neutral naming for API paths, model names, function names, and UI text. Examples: rename 'CompetitorFormat' to 'SourcePlatform', 'convert_competitor_workflow' to 'convert_workflow', '/competitor-workflow' to '/workflow'. Apply this guideline to files under autogpt_platform/backend and autogpt_platform/frontend.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-31T15:37:38.626Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/backend/backend/copilot/tools/agent_generator/fixer.py:37-47
Timestamp: 2026-03-31T15:37:38.626Z
Learning: When validating/constructing Anthropic API model IDs in Significant-Gravitas/AutoGPT, allow the hyphen-separated Claude Opus 4.6 model ID `claude-opus-4-6` (it corresponds to `LlmModel.CLAUDE_4_6_OPUS` in `autogpt_platform/backend/backend/blocks/llm.py`). Do NOT require the dot-separated form in Anthropic contexts. Only OpenRouter routing variants should use the dot separator (e.g., `anthropic/claude-opus-4.6`); `claude-opus-4-6` should be treated as correct when passed to Anthropic, and flagged only if it’s used in the OpenRouter path where the dot form is expected.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-04-15T02:43:36.890Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12780
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-15T02:43:36.890Z
Learning: When reviewing Python exception handlers, do not flag `isinstance(e, X)` checks as dead/unreachable if the caught exception `X` is a subclass of the exception type being handled. For example, if `X` (e.g., `VirusScanError`) inherits from `ValueError` (directly or via an intermediate class) and it can be raised within an `except ValueError:` block, then `isinstance(e, X)` inside that handler is reachable and should not be treated as dead code.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-05-23T05:29:43.085Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13200
File: autogpt_platform/backend/backend/executor/scheduler.py:590-593
Timestamp: 2026-05-23T05:29:43.085Z
Learning: When reviewing Python code that uses Pydantic discriminated/tagged unions (e.g., `Annotated[Union[...], Field(discriminator="kind")]`), recognize that using `isinstance(x, SomeVariantInfo)` to narrow the union is an intentional and correct runtime guard and should also enable static type narrowing in tools like Pyright. Do not recommend replacing such `isinstance`-based narrowing with `cast(...)` when the check already proves the variant at runtime.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-04-22T11:46:04.431Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/config.py:0-0
Timestamp: 2026-04-22T11:46:04.431Z
Learning: Do not flag the Claude Sonnet 4.6 model ID as incorrect when it uses the project’s established hyphenated convention: `anthropic/claude-sonnet-4-6`. This hyphen form is the intentional, production convention and should be treated as valid (including in files like llm.py, blocks tests, reasoning.py, `_is_anthropic_model` tests, and config defaults). Note that OpenRouter also accepts the dot variant `anthropic/claude-sonnet-4.6`, so either form may be tolerated, but `anthropic/claude-sonnet-4-6` should be considered the standard to match project usage.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-04-22T11:46:12.892Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/baseline/service.py:322-332
Timestamp: 2026-04-22T11:46:12.892Z
Learning: In this codebase (Significant-Gravitas/AutoGPT), OpenRouter-routed Anthropic model IDs should use the hyphen-separated convention (e.g., `anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-6`). Although OpenRouter may accept both hyphen and dot variants, treat the hyphen-separated form as the intended, correct codebase-wide convention and do not flag it as an error. Only flag the dot-separated variant (e.g., `anthropic/claude-sonnet-4.6`) as incorrect when reviewing/validating model ID strings for OpenRouter-routed Anthropic models.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-05-07T18:48:14.242Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13040
File: autogpt_platform/backend/backend/blocks/llm.py:0-0
Timestamp: 2026-05-07T18:48:14.242Z
Learning: In this repository, isort may split imports from the same module into separate blocks when some imports are aliased (e.g., `from module import X as Y`) and others are not. Preserve the two-block layout when it results from isort (such as keeping `from openai.types.chat import ChatCompletion as OpenAIChatCompletion` separate from non-aliased imports from `openai.types.chat`). Do not treat that split as a style issue during review; merging them into a single block can fail CI with `Imports are incorrectly sorted and/or formatted`.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-05-26T14:24:34.866Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13217
File: autogpt_platform/backend/backend/api/features/search/service.py:137-137
Timestamp: 2026-05-26T14:24:34.866Z
Learning: In the Significant-Gravitas/AutoGPT backend, treat `user_id` (an opaque UUID used only for correlation/tracing) as non-PII. Do not flag direct logging of `user_id` in `logger.warning`/`logger.info` statements as a PII exposure issue, as the established convention is to log `user_id` for tracing while reserving PII for fields like email or display name.

Applied to files:

  • autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
  • autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py
📚 Learning: 2026-03-24T02:23:31.305Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/components/RateLimitResetDialog/RateLimitResetDialog.tsx:0-0
Timestamp: 2026-03-24T02:23:31.305Z
Learning: In the Copilot platform UI code, follow the established Orval hook `onError` error-handling convention: first explicitly detect/handle `ApiError`, then read `error.response?.detail` (if present) as the primary message; if not available, fall back to `error.message`; and finally fall back to a generic string message. This convention should be used for generated Orval hooks even if the custom Orval mutator already maps details into `ApiError.message`, to keep consistency across hooks/components (e.g., `useCronSchedulerDialog.ts`, `useRunGraph.ts`, and rate-limit/reset flows).

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 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/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 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/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
📚 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/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
🔇 Additional comments (4)
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts (1)

174-180: LGTM!

autogpt_platform/backend/backend/copilot/tools/decompose_goal_test.py (1)

257-307: LGTM!

autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md (2)

56-83: LGTM!


84-123: LGTM!

Comment thread autogpt_platform/backend/backend/copilot/tools/decompose_goal.py Outdated
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.46%. Comparing base (2cad7c4) to head (35e4d1f).
⚠️ Report is 8 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #13242      +/-   ##
==========================================
+ Coverage   72.43%   72.46%   +0.03%     
==========================================
  Files        2313     2338      +25     
  Lines      173401   174561    +1160     
  Branches    17569    17674     +105     
==========================================
+ Hits       125596   126492     +896     
- Misses      44079    44309     +230     
- Partials     3726     3760      +34     
Flag Coverage Δ
platform-backend 80.46% <ø> (+0.08%) ⬆️
platform-frontend-e2e 31.03% <ø> (-0.24%) ⬇️

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

Components Coverage Δ
Platform Backend 80.46% <ø> (+0.08%) ⬆️
Platform Frontend 43.87% <ø> (-0.25%) ⬇️
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.

Rely on agent_generation_guide prompt ordering to ensure
find_library_agent(for_creation=true) runs before decompose_goal, instead
of the require_library_check call in DecomposeGoalTool. Revert the
splitReasoningAndResponse bundler workaround in ChatMessagesContainer
helpers since it was tied to the gated flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/m and removed platform/frontend AutoGPT Platform - Front end size/l labels May 29, 2026
…y-check gate

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels May 30, 2026
@goodluck1103
goodluck1103 requested a review from majdyz June 1, 2026 00:53
@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to 👍🏼 Mergeable in AutoGPT development kanban Jun 2, 2026
@goodluck1103
goodluck1103 added this pull request to the merge queue Jun 3, 2026
Merged via the queue into dev with commit 3db29bc Jun 3, 2026
37 checks passed
@goodluck1103
goodluck1103 deleted the feat/decompose-goal-after-library-check branch June 3, 2026 01:27
@github-project-automation github-project-automation Bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Jun 3, 2026
@github-project-automation github-project-automation Bot moved this to Done in Frontend Jun 3, 2026
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 size/l

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants