Skip to content

feat(frontend): collapsible advanced config sections#4935

Draft
mmabrouk wants to merge 2 commits into
feat/agent-builder-tools-4919-v2from
feat/advanced-collapsible-change1
Draft

feat(frontend): collapsible advanced config sections#4935
mmabrouk wants to merge 2 commits into
feat/agent-builder-tools-4919-v2from
feat/advanced-collapsible-change1

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

What changed

The three advanced committed-config groups in the agent Advanced drawer — Authentication, Execution environment, and Permissions — were flat border-t-separated <div> blocks that stacked into a long scroll.

They are now independent collapsible accordion items, matching the pattern the existing "Playground build kit" section already uses.

Before: three sections always visible, stacked vertically, separated by a top border.

After: three bordered card rows, each collapsed by default. Clicking the header expands only that section. Multiple sections can be open at once. The collapsed header shows a one-line summary on the right (Authentication → Agenta-managed or Self-managed; Execution environment → Sandbox: <kind>; Permissions → Auto). A CaretRight chevron rotates 90° when open.

Scope

One file changed: web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx.

No contract change. No commit-logic change. No new components — reuses the same button/CaretRight/cn pattern the build-kit section already uses. The buildKitSection itself is untouched.

Verification

  • tsc --noEmit on @agenta/entity-ui: clean.
  • pnpm lint-fix in web/: 11/11 tasks successful, no warnings or errors.
  • vitest run on @agenta/entity-ui: 126/126 tests pass.

What to review

  1. Accordion behavior: each group collapses and expands independently (not single-open).
  2. Summaries: Authentication shows the connection mode label, Execution environment shows the sandbox kind, Permissions shows "Auto".
  3. No commit-logic path was touched — only the advancedControls JSX block changed.

@mmabrouk mmabrouk added the needs-review Agent updated; awaiting Mahmoud's review label Jun 29, 2026
@vercel

vercel Bot commented Jun 29, 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 Jun 29, 2026 8:51pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 12ace2a7-9162-4979-88c4-77db619fad82

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

In useModelHarness.tsx, three boolean useState variables are added to track collapsed/expanded state for the Advanced section's Authentication, Execution environment, and Permissions groups. The rendering is refactored from always-visible content into collapsible panels with clickable headers, rotating caret icons, and compact summary labels when collapsed.

Collapsible Advanced panels

Layer / File(s) Summary
State and icon setup
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
Adds CaretRight and additional icon imports; introduces authExpanded, execExpanded, permsExpanded useState booleans.
Collapsible panel rendering
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
Replaces static group content with clickable header buttons (rotating caret + summary label) and conditionally rendered body content for Auth, Execution, and Permissions groups.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Agenta-AI/agenta#4923: Directly refactored useModelHarness into the hook that this PR extends with collapsible Advanced section panels.
  • Agenta-AI/agenta#4932: Also modifies useModelHarness.tsx's Advanced section rendering, updating permissions plumbing and ClaudePermissionsControl integration.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.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 summarizes the main change: collapsible advanced config sections in the frontend.
Description check ✅ Passed The description accurately matches the changeset and verification details for the collapsible advanced sections.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/advanced-collapsible-change1

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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

This PR is ready for review. Please check:

  1. Accordion behavior — Authentication, Execution environment, and Permissions each collapse and expand independently. Opening one does not close another. Default state is collapsed.
  2. Summaries — The collapsed header shows a right-aligned one-line summary: Authentication shows Agenta-managed or Self-managed (from connection.mode), Execution environment shows Sandbox: <kind> (from sandbox.kind), and Permissions shows Auto.
  3. No commit-logic change — only the advancedControls JSX block in useModelHarness.tsx was touched. The buildKitSection (Playground build kit) is unchanged. No API contracts, no state shape, no save/commit path changed.
  4. Pattern reuse — uses the exact same button + CaretRight + cn accordion pattern the build-kit section already uses, so it stays visually consistent.

@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 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: 83b020f2-22a0-4446-8477-c679d6b751a1

📥 Commits

Reviewing files that changed from the base of the PR and between cc2e131 and f669fa9.

📒 Files selected for processing (1)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx

Comment on lines +703 to +883
<button
type="button"
onClick={() => setAuthExpanded((open) => !open)}
className="flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2.5 text-left"
>
<Key size={15} className="text-[var(--ag-c-586673,#586673)]" />
<span className="text-[13px] font-medium">Authentication</span>
</div>
<p className="mb-2.5 ml-[22px] text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
Where the model credential comes from when this agent runs.
</p>
<div className="ml-[22px]">{authControls}</div>
{!authExpanded ? (
<span className="ml-auto text-[11px] text-[var(--ag-c-97A4B0,#97a4b0)]">
{props.llm
? connection.mode === "agenta"
? "Agenta-managed"
: "Self-managed"
: ""}
</span>
) : (
<span className="ml-auto" />
)}
<CaretRight
size={14}
className={cn(
"text-[var(--ag-c-97A4B0,#97a4b0)] transition-transform",
authExpanded && "rotate-90",
)}
/>
</button>
{authExpanded ? (
<div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,#eaeff5)] px-3 pb-3 pt-2.5">
<p className="mb-2.5 text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
Where the model credential comes from when this agent runs.
</p>
{authControls}
</div>
) : null}
</div>
) : null}

{hasExecutionGroup ? (
<div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,#eaeff5)] pt-4">
<div className="mb-0.5 flex items-center gap-1.5">
<div className="rounded border border-solid border-[var(--ag-c-EAEFF5,#eaeff5)]">
<button
type="button"
onClick={() => setExecExpanded((open) => !open)}
className="flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2.5 text-left"
>
<Cube size={15} className="text-[var(--ag-c-586673,#586673)]" />
<span className="text-[13px] font-medium">Execution environment</span>
</div>
<p className="mb-2.5 ml-[22px] text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
Where the agent&apos;s tools and code run, and what that sandbox may touch.
</p>
<div className="ml-[22px] flex flex-col gap-2.5">
{sandboxProps.kind && (
<EnumSelectControl
schema={sandboxProps.kind}
label="Sandbox"
value={(sandbox.kind as string | null) ?? null}
onChange={(v) => setSection("sandbox", {...sandbox, kind: v})}
withTooltip={withTooltip}
disabled={disabled}
/>
{!execExpanded ? (
<span className="ml-auto text-[11px] text-[var(--ag-c-97A4B0,#97a4b0)]">
{sandbox.kind ? `Sandbox: ${String(sandbox.kind)}` : ""}
</span>
) : (
<span className="ml-auto" />
)}
{sandboxProps.permissions ? (
<div className="flex flex-col gap-1.5">
{permissionOverrideHint}
<SandboxPermissionControl
value={
(sandbox.permissions as Record<string, unknown> | null) ??
null
}
onChange={(v) =>
setSection("sandbox", {...sandbox, permissions: v})
}
disabled={disabled}
/>
<CaretRight
size={14}
className={cn(
"text-[var(--ag-c-97A4B0,#97a4b0)] transition-transform",
execExpanded && "rotate-90",
)}
/>
</button>
{execExpanded ? (
<div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,#eaeff5)] px-3 pb-3 pt-2.5">
<p className="mb-2.5 text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
Where the agent&apos;s tools and code run, and what that sandbox may
touch.
</p>
<div className="flex flex-col gap-2.5">
{sandboxProps.kind && (
<EnumSelectControl
schema={sandboxProps.kind}
label="Sandbox"
value={(sandbox.kind as string | null) ?? null}
onChange={(v) =>
setSection("sandbox", {...sandbox, kind: v})
}
withTooltip={withTooltip}
disabled={disabled}
/>
)}
{sandboxProps.permissions ? (
<div className="flex flex-col gap-1.5">
{permissionOverrideHint}
<SandboxPermissionControl
value={
(sandbox.permissions as Record<
string,
unknown
> | null) ?? null
}
onChange={(v) =>
setSection("sandbox", {
...sandbox,
permissions: v,
})
}
disabled={disabled}
/>
</div>
) : null}
</div>
) : null}
</div>
</div>
) : null}
</div>
) : null}

{hasPermissionsGroup ? (
<div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,#eaeff5)] pt-4">
<div className="mb-0.5 flex items-center gap-1.5">
<div className="rounded border border-solid border-[var(--ag-c-EAEFF5,#eaeff5)]">
<button
type="button"
onClick={() => setPermsExpanded((open) => !open)}
className="flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2.5 text-left"
>
<ShieldCheck size={15} className="text-[var(--ag-c-586673,#586673)]" />
<span className="text-[13px] font-medium">Permissions</span>
</div>
<p className="mb-2.5 ml-[22px] text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
What the agent may do on its own before it must ask.
</p>
<div className="ml-[22px] flex flex-col gap-2.5">
{headlessSchema ? (
isPiHarness ? (
<div className="flex items-center gap-1.5 text-[11px] text-[var(--ag-c-97A4B0,#97a4b0)]">
<EyeSlash size={13} />
Permission policy isn&apos;t used by the Pi harness.
</div>
) : (
<EnumSelectControl
schema={headlessSchema}
label="Permission policy"
value={headlessValue}
onChange={(v) =>
setSection("runner", {
...runner,
interactions: {...runnerInteractions, headless: v},
})
}
withTooltip={withTooltip}
disabled={disabled}
/>
)
) : null}
{hasClaudePermissions ? (
<div className="flex flex-col gap-1.5">
<div className="flex items-center gap-1.5">
<Typography.Text className="text-xs font-medium">
Claude permissions
</Typography.Text>
<span className="rounded-full bg-[var(--ant-color-fill-secondary)] px-2 text-[10px] text-[var(--ant-color-primary-text)]">
Claude harness
</span>
</div>
<ClaudePermissionsControl
value={claudePermissions}
onChange={setClaudePermissions}
disabled={disabled}
/>
{!permsExpanded ? (
<span className="ml-auto text-[11px] text-[var(--ag-c-97A4B0,#97a4b0)]">
Auto
</span>
) : (
<span className="ml-auto" />
)}
<CaretRight
size={14}
className={cn(
"text-[var(--ag-c-97A4B0,#97a4b0)] transition-transform",
permsExpanded && "rotate-90",
)}
/>
</button>
{permsExpanded ? (
<div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,#eaeff5)] px-3 pb-3 pt-2.5">
<p className="mb-2.5 text-[11.5px] leading-snug text-[var(--ag-c-97A4B0,#97a4b0)]">
What the agent may do on its own before it must ask.
</p>
<div className="flex flex-col gap-2.5">
{headlessSchema ? (
isPiHarness ? (
<div className="flex items-center gap-1.5 text-[11px] text-[var(--ag-c-97A4B0,#97a4b0)]">
<EyeSlash size={13} />
Permission policy isn&apos;t used by the Pi harness.
</div>
) : (
<EnumSelectControl
schema={headlessSchema}
label="Permission policy"
value={headlessValue}
onChange={(v) =>
setSection("runner", {
...runner,
interactions: {
...runnerInteractions,
headless: v,
},
})
}
withTooltip={withTooltip}
disabled={disabled}
/>
)
) : null}
{hasClaudePermissions ? (
<div className="flex flex-col gap-1.5">
<div className="flex items-center gap-1.5">
<Typography.Text className="text-xs font-medium">
Claude permissions
</Typography.Text>
<span className="rounded-full bg-[var(--ant-color-fill-secondary)] px-2 text-[10px] text-[var(--ant-color-primary-text)]">
Claude harness
</span>
</div>
<ClaudePermissionsControl
value={claudePermissions}
onChange={setClaudePermissions}
disabled={disabled}
/>
</div>
) : null}
</div>
) : null}
</div>
</div>
) : null}

@coderabbitai coderabbitai Bot Jun 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the accordion state to assistive tech.

These headers are clickable buttons, but they never publish whether their panel is open. Screen readers will announce a generic button instead of an expanded/collapsed control. Please add aria-expanded plus aria-controls/panel ids (or reuse the shared collapsible header helper that already does this).

Suggested fix
-                    <button
+                    <button
                         type="button"
+                        aria-expanded={authExpanded}
+                        aria-controls="advanced-auth-panel"
                         onClick={() => setAuthExpanded((open) => !open)}
                         className="flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2.5 text-left"
                     >
...
-                        <div className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,`#eaeff5`)] px-3 pb-3 pt-2.5">
+                        <div
+                            id="advanced-auth-panel"
+                            className="border-0 border-t border-solid border-[var(--ag-c-EAEFF5,`#eaeff5`)] px-3 pb-3 pt-2.5"
+                        >

Apply the same pattern to the execution and permissions sections.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖 The AI agent says: Done. All four accordion header buttons now carry aria-expanded={<state>}: the three Advanced accordions in useModelHarness.tsx (Auth, Exec, Perms) and the build-kit section button in useBuildKit.tsx. Landed in commit aaf8948.

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm. Only minor comments to resolve are that the playground buildkit is, right now, I think, expanded by default when you open the drawer the first time. If that is the case, I'm not sure if it's the case, but it looks like it. If that is the case, everything should be collapsed by default. Other than that, it's good to go, plus the kind of minor comment from Code Rabbit.

@mmabrouk mmabrouk added lgtm This PR has been approved by a maintainer and removed needs-review Agent updated; awaiting Mahmoud's review labels Jun 29, 2026
@mmabrouk mmabrouk force-pushed the feat/agent-builder-tools-4919-v2 branch from cc2e131 to c0ccd67 Compare June 29, 2026 20:20
@mmabrouk mmabrouk force-pushed the feat/advanced-collapsible-change1 branch from f669fa9 to 1956519 Compare June 29, 2026 20:20
@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Three fixes landed in commit aaf8948 on this branch:

1. Collapse everything by defaultuseBuildKit.tsx now starts with useState(false) so the Playground build kit section is collapsed on first open. The three Advanced accordions (Authentication, Execution environment, Permissions) were already useState(false) — confirmed, no change needed there.

2. aria-expanded on all accordion buttons — all four accordion header buttons now carry aria-expanded={<state>}: the build-kit section button in useBuildKit.tsx and the three Advanced section buttons in useModelHarness.tsx.

3. Cancel restores the build-kit toggleAgentTemplateControl.tsx now snapshots the workflowBuildKitEnabledAtomFamily atom value when a section drawer opens and restores it in cancelSection. Toggling the build-kit switch then hitting Cancel leaves the switch where it started.

tsc: clean. lint-fix: no warnings. entity-ui unit tests: 126/126 passed.

mmabrouk added 2 commits June 29, 2026 22:48
…l restores build-kit toggle

- useBuildKit.tsx: default expand state changed to false (start collapsed)
- useBuildKit.tsx + useModelHarness.tsx: add aria-expanded to all four accordion header buttons
- AgentTemplateControl.tsx: cancelSection now snapshots + restores the buildKitEnabled atom so toggling the switch then hitting Cancel leaves the switch unchanged
@mmabrouk mmabrouk force-pushed the feat/agent-builder-tools-4919-v2 branch from c0ccd67 to 34f4351 Compare June 29, 2026 20:49
@mmabrouk mmabrouk force-pushed the feat/advanced-collapsible-change1 branch from aaf8948 to 1fc6548 Compare June 29, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant