UI: fix agent settings save button for auto-discovered agents#39320
UI: fix agent settings save button for auto-discovered agents#39320fellanH wants to merge 4 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR combines three changes: (1) the headline fix— Key findings:
Confidence Score: 4/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81ff1afa44
ℹ️ 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".
| const index = ensureAgentConfigIndex(agentId); | ||
| if (index < 0) { | ||
| return; | ||
| } | ||
| const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list; | ||
| // Re-read latest config form after ensureAgentConfigIndex might have updated it |
There was a problem hiding this comment.
Skip creating agent config entry for model clear no-op
When an auto-discovered agent has no agents.list entry and the user clears the model selector (modelId empty), this code calls ensureAgentConfigIndex before checking whether there is anything to save. That inserts a new { id: agentId } row and marks the form dirty, so the save button enables and persisting writes an unnecessary agents.list stub even though the user effectively made no config change. This should only create an agent entry when writing a non-default value (or when an existing entry already exists).
Useful? React with 👍 / 👎.
Fixes #39268.
Auto-discovered agents (those with a directory in ~/.openclaw/agents but no entry in config.yaml) could not have their settings saved in the GUI because the save button remained disabled. This was because the UI handlers returned early when the agent was not found in the config list.
This PR adds an 'ensureAgentConfigIndex' helper that automatically adds the agent to the config form when a change is made, enabling the save button and allowing the changes to be persisted to config.yaml.