Skip to content

fix(ui): fix model name editing on the model config form#1979

Open
Valyrian-Code wants to merge 4 commits into
kagent-dev:mainfrom
Valyrian-Code:fix/model-edit-name-button-type
Open

fix(ui): fix model name editing on the model config form#1979
Valyrian-Code wants to merge 4 commits into
kagent-dev:mainfrom
Valyrian-Code:fix/model-edit-name-button-type

Conversation

@Valyrian-Code

@Valyrian-Code Valyrian-Code commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Two related problems with the model name field and its "Edit Auto-Generated Name" pencil button on the model form (/models/new, including ?edit=true):

  1. Pencil submitted the form. The button had no explicit type, so as a child of the <form> it defaulted to type="submit" and fired the updateModelConfig action on click — the form saved and navigated away instead of just toggling name editing. Fixed by setting type="button", matching the sibling "fetch models" button.

  2. Renaming in edit mode silently did nothing. A ModelConfig's metadata.name is immutable in Kubernetes, so an update can never rename the resource. The pencil is now disabled in edit mode — consistent with the namespace, provider, and model fields, which are already disabled when editing — and a hint clarifies that the name can't be changed after creation.

Fixes #1947

Changes

  • ui/src/components/models/new/BasicInfoSection.tsx:
    • add type="button" to the edit-name pencil so it no longer submits the form
    • disable the pencil in edit mode and show a "name can't be changed after creation" hint

Testing

  • On /models/new?edit=true, clicking the pencil no longer triggers a network call or form submission.
  • In edit mode the name field is read-only with the hint; create mode is unchanged (the auto-generated name is still editable).

The "Edit Auto-Generated Name" pencil button had no explicit type, so as a child of the form it defaulted to type="submit" and fired the updateModelConfig action on click. Set type="button" so it only toggles name editing, matching the sibling fetch-models button.

Fixes kagent-dev#1947

Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
Copilot AI review requested due to automatic review settings June 8, 2026 16:32
@Valyrian-Code Valyrian-Code requested a review from peterj as a code owner June 8, 2026 16:32
@github-actions github-actions Bot added the bug Something isn't working label Jun 8, 2026

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an explicit button type to prevent unintended form submission when clicking the “edit model name” icon button.

Changes:

  • Set type="button" on the edit-model-name button to avoid default submit behavior inside a form.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

A ModelConfig's metadata.name is immutable in Kubernetes, so editing it on
update silently has no effect. Disable the name-edit pencil in edit mode
(matching the namespace, provider, and model fields, which are already
disabled when editing) and show a hint that the name can't be changed
after creation.

Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
@Valyrian-Code Valyrian-Code changed the title fix(ui): prevent model name edit pencil from submitting the form fix(ui): fix model name editing on the model config form Jun 8, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model edit form: pencil button triggers a save API call

3 participants