Skip to content

feat(frontend): auto-expand agent config sections when the agent fills them#5260

Merged
ardaerzin merged 2 commits into
big-agentsfrom
fe-fixes/agent-config-auto-expand
Jul 12, 2026
Merged

feat(frontend): auto-expand agent config sections when the agent fills them#5260
ardaerzin merged 2 commits into
big-agentsfrom
fe-fixes/agent-config-auto-expand

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

When the agent added a tool, skill, or trigger, the config panel committed a new revision but left that section collapsed, so the change was invisible. People asked "did the agent do anything?" even with a commit showing.

Changes

The four list sections (Tools, MCP, Skills, Triggers) are now controlled, and a small hook opens a section when its item count crosses from zero to non-zero and collapses it when it returns to zero. The trigger is the boundary crossing, not the level, so manually collapsing a populated section sticks across unrelated re-renders. Singleton and drawer sections are untouched.

Tests / notes

  • Unit test for the pure computeSectionCrossings (open on 0 to >0, close on >0 to 0, no-op when it does not cross zero).
  • The accordion primitive already supported controlled open state, so it did not change.

What to QA

  • Load an agent that already has tools or triggers. Those sections render expanded.
  • Ask the agent to add a tool. When it lands, the Tools section expands on its own.
  • Manually collapse a populated section, then edit another field. It stays collapsed.
  • Remove the last item from a section. It collapses on its own.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 12, 2026
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 12, 2026 8:48pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a1eb8fd3-e794-417f-bca8-601242330d31

📥 Commits

Reviewing files that changed from the base of the PR and between 4e241ff and fe6bb25.

📒 Files selected for processing (2)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentSectionAutoExpand.ts
  • web/packages/agenta-entity-ui/tests/unit/agentSectionAutoExpand.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/packages/agenta-entity-ui/tests/unit/agentSectionAutoExpand.test.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentSectionAutoExpand.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Sections for tools, MCP, skills, and triggers now automatically open when populated and close when emptied.
    • Other accordion sections retain their existing opening behavior.
  • Bug Fixes
    • Improved handling of sections whose items are added, removed, or become empty.
  • Tests
    • Added coverage for section open/close transitions, unchanged counts, multiple sections, and removed sections.

Walkthrough

The change adds zero-crossing detection for section counts and applies controlled auto-expansion to the tools, MCP, skills, and triggers accordions while preserving existing behavior for other sections.

Changes

Section auto-expand controls

Layer / File(s) Summary
Count crossing utility and validation
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentSectionAutoExpand.ts, web/packages/agenta-entity-ui/tests/unit/agentSectionAutoExpand.test.ts
Adds count-crossing types, detection logic, a React hook, and tests for opening, closing, and unchanged counts.
Controlled accordion integration
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
Controls tools, MCP, skills, and triggers accordions from current counts while retaining default-open behavior for other sections.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AgentTemplateControl
  participant useAutoExpandOnPopulate
  participant Accordion
  AgentTemplateControl->>useAutoExpandOnPopulate: pass section counts
  useAutoExpandOnPopulate->>AgentTemplateControl: update sectionOpen on zero crossings
  AgentTemplateControl->>Accordion: provide controlled open state
  Accordion-->>AgentTemplateControl: report manual open-state changes
Loading

Possibly related PRs

  • Agenta-AI/agenta#4923: Both changes modify agent-template tools, MCP, and skills section rendering in AgentTemplateControl.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: auto-expanding agent config sections based on populated items.
Description check ✅ Passed The description matches the implemented controlled sections, auto-expand hook, and tests in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 fe-fixes/agent-config-auto-expand

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.

@dosubot dosubot Bot added enhancement New feature or request Frontend labels Jul 12, 2026
@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 25a2063d-3765-4c04-860c-010be97a6e04

📥 Commits

Reviewing files that changed from the base of the PR and between cc07623 and 4e241ff.

📒 Files selected for processing (3)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentSectionAutoExpand.ts
  • web/packages/agenta-entity-ui/tests/unit/agentSectionAutoExpand.test.ts

@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ardaerzin ardaerzin merged commit efef25a into big-agents Jul 12, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Frontend size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant