Skip to content

UI: fix agent settings save button for auto-discovered agents#39320

Open
fellanH wants to merge 4 commits intoopenclaw:mainfrom
fellanH:feat/39268-fix-agent-save-gui
Open

UI: fix agent settings save button for auto-discovered agents#39320
fellanH wants to merge 4 commits intoopenclaw:mainfrom
fellanH:feat/39268-fix-agent-save-gui

Conversation

@fellanH
Copy link
Copy Markdown
Contributor

@fellanH fellanH commented Mar 8, 2026

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.

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime size: M labels Mar 8, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR combines three changes: (1) the headline fix—ensureAgentConfigIndex in ui/src/ui/app-render.ts lazily inserts a minimal config entry for auto-discovered agents so their settings changes are tracked and the save button becomes active; (2) a Telegram webhook self-signed certificate feature (webhookCertPath), which is clean and well-tested; and (3) a gateway refactor that removes nodeSendToSession / nodeSendToAllSubscribed calls for chat, health, and tick events, relying entirely on broadcast for delivery.

Key findings:

  • The ensureAgentConfigIndex logic is correct and all affected handlers are updated consistently.
  • Two dead required parameters were left behind by the nodeSendToSession cleanup: nodeSendToSession in the ChatAbortOps type (src/gateway/chat-abort.ts) and nodeSendToAllSubscribed in startGatewayMaintenanceTimers (src/gateway/server-maintenance.ts). Both parameters are declared but never called, creating unnecessary coupling where all callers must still provide them.
  • The webhook webhookCertPath addition is clean and comprehensively tested.

Confidence Score: 4/5

  • This PR is safe to merge. The core UI fix is correct, the gateway refactor is well-tested, and the dead parameters don't affect runtime behavior.
  • The headline fix for agent settings save is logically correct and all affected handlers are updated consistently. The gateway nodeSendToSession removal is accompanied by comprehensive test updates. The two dead required parameters (nodeSendToSession in ChatAbortOps and nodeSendToAllSubscribed in startGatewayMaintenanceTimers) are technical debt left behind but don't introduce bugs—callers will still work, just with unnecessary coupling. The Telegram webhook changes are clean.
  • src/gateway/chat-abort.ts and src/gateway/server-maintenance.ts — remove the dead nodeSendToSession and nodeSendToAllSubscribed fields to eliminate unnecessary coupling.

Comments Outside Diff (2)

  1. src/gateway/chat-abort.ts, line 30-43 (link)

    The nodeSendToSession field in ChatAbortOps is declared but never called. The only call site (ops.nodeSendToSession in broadcastChatAborted) was removed in this PR, leaving the field as dead code. All callers still must provide this function unnecessarily.

    Consider removing it:

  2. src/gateway/server-maintenance.ts, line 15-42 (link)

    The nodeSendToAllSubscribed parameter is declared in the function signature but never called. Both call sites ("health" and "tick" broadcasts) were replaced with params.broadcast, leaving this parameter as dead code. All callers still must provide this function unnecessarily.

    Consider removing it from the params type:

Last reviewed commit: 81ff1af

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: 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".

Comment on lines +782 to +786
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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

Labels

app: macos App: macos app: web-ui App: web-ui channel: telegram Channel integration: telegram gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot save agent changes

1 participant