Skip to content

[AGE-4014] fix(frontend): Show changed-path affordance for provider/connection edits in config drawer - #5627

Open
bekossy wants to merge 4 commits into
mainfrom
AGE-4014-/-config-drawer-provider-level-change-shows-a-dirty-badge-but-no-changed
Open

[AGE-4014] fix(frontend): Show changed-path affordance for provider/connection edits in config drawer#5627
bekossy wants to merge 4 commits into
mainfrom
AGE-4014-/-config-drawer-provider-level-change-shows-a-dirty-badge-but-no-changed

Conversation

@bekossy

@bekossy bekossy commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #5544. In the agent config's Model & harness section, changing the provider/connection without committing shows the "Draft" state and the "Connect key" badge on the collapsed header, but expanding it showed no changed-path affordance at all — no dotted underline, no committed-value popover, no Restore.

Root cause: that section has three inline render branches, in precedence order — needs-key pane, changed-diff view, plain drawer row. When a provider/connection key is missing, the needs-key pane always wins, and it renders the bare ProviderCredentialsSection variant, which is headerless by design and is never mounted under a ChangedPathsProvider. So even when a real diff exists, the component reading it silently sees "nothing changed."

Changes

When the needs-key pane is showing AND the edit that triggered it touched llm.connection.*/llm.provider specifically (not some other model-harness field like harness.kind), it now renders through the same ChangedPathsProvider-wrapped path the rest of the panel's diff views use, and swaps to the non-bare ProviderCredentialsSection — the variant that already has the "Connect key" badge, a changed-path indicator dot, and a "Revert this group?" action, just previously never assembled together for this specific pane.

A change to an unrelated model-harness field keeps the original plain pane (with the inline model picker) unchanged — this only widens the branch that was structurally incapable of showing a diff.

Testing

Verified locally

  • tsc --noEmit clean on @agenta/entity-ui and on web/oss (which consumes this component).
  • eslint clean on both touched files.

Added or updated tests

N/A — no existing unit tests cover AgentTemplateControl/useModelHarness/ProviderCredentialsSection.

QA follow-up

  • Open an agent's config, Model & harness section. Switch the connection/provider mode without committing. Expanding the section should now show the "Connect key" badge alongside a changed indicator and a group Restore action, not a plain unmarked form.
  • Regression: change something else in the same section (e.g. harness kind) while a key is also missing — the pane should still show the plain connect-key form with the inline model picker, unchanged from before.

Demo

Screen.Recording.2026-08-01.at.4.06.36.PM.mov

Checklist

  • I have included a video or screen recording for UI changes, or marked Demo as N/A
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

Contributor Resources

@linear-code

linear-code Bot commented Aug 1, 2026

Copy link
Copy Markdown

AGE-4014

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 1, 2026
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error Aug 11, 2026 10:43am

Request Review

@dosubot dosubot Bot added the frontend label Aug 1, 2026
@coderabbitai

coderabbitai Bot commented Aug 1, 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: 933047bb-2181-470b-9bf3-6039167566c5

📥 Commits

Reviewing files that changed from the base of the PR and between 3db504c and 77cba2e.

📒 Files selected for processing (2)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for displaying provider credentials directly within connection settings.
    • Credentials can now appear in an expandable section or inline pane, depending on the workflow.
    • Changes to provider, connection, or model details are highlighted in the credentials view.
    • Added a grouped revert option to restore previously configured provider, connection, and model settings.
    • Revert controls now appear only when changes are detected.

Walkthrough

The model harness tracks draft changes to llm.provider and llm.connection. Changed credentials render in a change-aware inline view with grouped restore support.

Changes

Provider credentials tracking

Layer / File(s) Summary
Expose provider credentials section
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
The section-body discriminator supports "connect-key". The hook returns provider credentials content with conditional revert handling for credential changes. Group revert restores provider, connection, and model changes.
Render changed credentials inline
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
The control detects changes to llm.provider and llm.connection. It renders the changed-aware credentials body with changed-path tracking when those paths change. Otherwise, it renders the existing credentials content.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the frontend fix for changed-path affordances on provider and connection edits.
Description check ✅ Passed The description explains the issue, implementation, regression behavior, and validation for the provider and connection changes.
Linked Issues check ✅ Passed The changes address issue #5544 by enabling diff indicators, committed-value access, and restore support for provider and connection edits.
Out of Scope Changes check ✅ Passed The changes remain limited to the Model & harness provider credentials rendering and change-tracking behavior described in issue #5544.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AGE-4014-/-config-drawer-provider-level-change-shows-a-dirty-badge-but-no-changed

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.

@bekossy
bekossy changed the base branch from release/v0.106.2 to main August 1, 2026 14:05

@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: 09d42cc0-b2ea-4d3d-93b2-12d171e0b640

📥 Commits

Reviewing files that changed from the base of the PR and between 7c395db and 14754a8.

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f601b57be6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5627.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5627-52c4a51
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-11T10:54:13.053Z

@bekossy
bekossy marked this pull request as draft August 1, 2026 15:58
@bekossy
bekossy marked this pull request as ready for review August 1, 2026 16:08

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14754a8b0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… atomically, trim comment

Addresses review: a provider-only change (llm.provider without llm.connection) now gets the
same changed indicator and Restore as a connection change. The group Restore also reverts
llm.model alongside provider/connection, since writeModel can move all three together and a
partial revert reattaches a stale connection slug to the new model (rejected by the backend).
Also trims a comment that grew past the one-line convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
#	web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@ardaerzin ardaerzin 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.

Read the diff plus ChangedPathsContext, FocusPathsContext, sectionChanges.ts and ProviderCredentialsSectionView. Three things — the first one blocks.

// `writeModel` can move `llm.model` atomically with `llm.provider`/`llm.connection.slug` (a
// catalog pick clears the old custom slug) — revert all three together or the group's Restore
// reattaches a stale slug to the new model, a combination the backend rejects.
const revertCredentials = useCallback(() => {

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.

This restores only llm.model.

Each of revertConnection / revertProviderField / revertModel is onChange(revertPathsTo(config, committed, paths)) (AgentTemplateControl.tsx:497), closed over the same render-time config. Calling them in sequence is three full-config writes in one handler — last write wins, so the reverted provider and connection slug are overwritten by the model-only revert. That leaves the new provider/slug with the old model: the exact combination the comment above says the backend rejects.

Needs to be one revert() call with the union of paths, e.g. a multi-prefix useRevertUnder, or revert([...pathsUnder("llm.connection"), "llm.provider", "llm.model"]).

revertPermissions a few lines up has the same shape and the same latent bug.

disabled={disabled}
>
{mh.providerCredentialsInline}
{credentialsPathChanged ? (

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.

This drops the inline model picker from the connect-key pane.

providerCredentialsSection is the non-bare variant: it never receives modelControl, and it renders railDetail rather than topRail (ProviderCredentialsSectionView.tsx:612-653). So this branch loses the model select and swaps in the 190px side rail that the comment on topRail describes as leaving the key form cramped in a narrow column.

That hits the common path, not an edge case: the usual way into the needs-key state is a catalog model pick, which moves llm.provider, so credentialsPathChanged is true. Threading bare + modelControl into the changed-aware render would keep the picker and the compact rail alongside the new badge/indicator/revert.

// catalog model switch can move on its own — track both, or a provider-only change gets a "Connect
// key" badge with no changed indicator or Restore to go with it.
const connectionChanged = useHasChangedUnder("llm.connection")
const providerFieldChanged = useHasChangedUnder("llm.provider")

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.

credentialsInFocus (line 468) wasn't widened along with credentialsChanged — it still checks llm.connection only.

In the non-key "what changed" branch, a provider-only diff therefore leaves harnessKindInFocus, modelInFocus and credentialsInFocus all false, and the expanded section renders nothing but the "Detailed configuration" link. That's the #5544 symptom again, in the branch this PR doesn't touch — and it's the same provider-moves-on-its-own case the comment right here describes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[config-drawer] Provider-level change shows a dirty badge but no changed-path underline/popover/Restore; section expands to the full edit form

2 participants