feat: add raw openclaw config editor#828
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (25 files)
Reviewed by gpt-5.4-20260305 · 1,311,271 tokens |
c656b99 to
9fc642b
Compare
St0rmz1
left a comment
There was a problem hiding this comment.
Good work overall — atomic writes, etag concurrency, backup before replace, solid test coverage. Leaving inline comments on a few things worth addressing or documenting.
- Add OpenclawConfigEditor component with Monaco editor - Add config read/replace endpoints on gateway controller - Add pattern-based secret redaction for provider apiKey fields - Add etag support for config replace to prevent stomping - Add atomic file writes for config changes - Add config change detection banner - Add comprehensive tests for config redaction and controller routes Co-Authored-By: Thomas Spader <tspader@users.noreply.github.com>
208b579 to
16f3bc8
Compare
… codes Remove index-based array walking in walkAndRestore() which silently swapped secrets between entries when users reordered arrays. Placeholders in array entries are now stripped instead of restored. Wire up UpstreamApiError so the tRPC error formatter surfaces upstreamCode to clients. The config editor now checks for config_etag_conflict specifically, so non-etag 409s (e.g. "Instance not provisioned") show the actual error instead of a misleading reload prompt.
| 'Gateway controller ', // already sanitized at DO level | ||
| 'Config was modified ', // etag mismatch on config replace | ||
| 'Invalid secret patch: ', // catalog validation (allFieldsRequired, etc.) | ||
| 'Config was modified ', // etag mismatch on config replace |
There was a problem hiding this comment.
Duplicate entry for ' 'Config was modified ' ?
St0rmz1
left a comment
There was a problem hiding this comment.
nit (non-blocking): sanitizeOpenclawConfigError forwards code to the client on all three paths, including the generic fallback where the message is intentionally redacted. Today the codes are all safe constants (config_read_failed, config_etag_conflict, etc.), so this is fine in practice. But as a future hardening consideration, Path 3 could restrict code passthrough to the OPENCLAW_CONFIG_ERROR_CODES allow list, same as it does for messages, so a future controller change can't accidentally leak internal details via the code field:
// Current
return { message: `${operation} failed`, status, ...(code ? { code } : {}) };
// Hardened
return { message: `${operation} failed`, status, ...(code && OPENCLAW_CONFIG_ERROR_CODES.has(code) ? { code } : {}) };Not blocking since the tRPC layer in kiloclaw-router.ts provides a second defense via UNSAFE_ERROR_CODES.
# Conflicts: # src/app/(app)/claw/components/SettingsTab.tsx # src/hooks/useKiloClaw.ts # src/lib/kiloclaw/kiloclaw-internal-client.ts # src/lib/kiloclaw/types.ts
Summary
We need a way to let users get their machines out of bad states. Since we don't provide full remote access, this PR adds a widget to fetch the
openclaw.jsonfrom the live machine, let the user patch it arbitrarily, and send the updated config back to the machine. OpenClaw hot reloads configs.Details:
/_kilo/config/replaceand/_kilo/config/read@monaco-editor/reactfor a reasonable inline JSON editor with highlighting + validationEdit Configto the danger zone since it is dangerousVerification
I loaded this up in my dev environment and made sure that:
Visual Changes
And the editor proper:
