Skip to content

Model edit form: pencil button triggers a save API call #1947

Closed

Description

@gauravshinde1729

While editing an existing ModelConfig (/models/new?edit=true), there are two related problems with the model name field and its pencil ("Edit Auto-Generated Name") button.


Issue 1 — Clicking the pencil icon fires an API call (saves the form)

Clicking the pencil icon to edit the name immediately triggers a server-side update call (updateModelConfig) instead of just enabling name editing. The form gets submitted, the model is saved, and the page navigates away — so you can't actually edit anything.

Captured request on pencil click:
POST /models/new?edit=true&name=ollama-mistral&namespace=kagent
payload: ["kagent/ollama-mistral",{"apiKey":null,"spec":{"model":"mistral","provider":"Ollama","ollama":{}}}]

Screen.Recording.2026-05-30.164355.mp4

Issue 2 — After fixing Issue 1, the name is editable but the change is useless

Once the pencil no longer submits and you can actually type a new name and save, the new name still doesn't take
effect — the model keeps its original name.

Cause: a ModelConfig is a Kubernetes resource, and its metadata.name is immutable — Kubernetes does not allow renaming a resource via update. The update only changes the spec, never the name.


Activity

  1. gauravshinde1729 commented on May 30, 2026

    @gauravshinde1729
    ContributorAuthor

    @peterj can you check this? Since the model name is immutable in the CRD, I think we should hide the name-edit
    pencil in edit mode (it currently lets you "rename" but the change is silently dropped). I can raise a PR.

  2. Valyrian-Code commented on Jun 8, 2026

    @Valyrian-Code
    Contributor

    I'd like to pick this up — could it be assigned to me?

    In ui/src/components/models/new/BasicInfoSection.tsx, the "Edit Auto-Generated Name" pencil is rendered as a <Button> without an explicit type. Since it's inside a form, it defaults to type="submit", causing updateModelConfig to be triggered when the pencil is clicked. The model-fetch button directly below already specifies type="button".

    My proposed fix is to add type="button" to the pencil button and verify that clicking it no longer submits the form or invokes updateModelConfig.

  3. added a commit that references this issue on Jul 14, 2026
    b9fb40d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions