Skip to content

feat(kiloclaw): add agent config CRUD routes#3508

Merged
pandemicsyn merged 5 commits into
mainfrom
feat/kiloclaw-agent-config-crud
May 27, 2026
Merged

feat(kiloclaw): add agent config CRUD routes#3508
pandemicsyn merged 5 commits into
mainfrom
feat/kiloclaw-agent-config-crud

Conversation

@pandemicsyn
Copy link
Copy Markdown
Contributor

@pandemicsyn pandemicsyn commented May 26, 2026

Summary

  • Add authenticated, capability-advertised controller endpoints for listing, reading, creating, updating, and deleting configured OpenClaw agents.
  • Introduce a narrow agent-config boundary: reads and focused model/default-setting patches are controller-native with optimistic conflict protection, while create/delete delegate lifecycle behavior to the installed OpenClaw CLI.
  • Serialize controller-originated lifecycle and patch mutations per config path to avoid lost updates, document the unverified filesystem disposition of CLI deletes, and enable typechecking for standalone controller package changes.

Verification

  • No additional interactive manual verification was performed; this change affects machine-side controller endpoints and was exercised through the controller container validation flow during implementation rather than through a user-facing UI.

Smoke test log:

--- agent config CRUD endpoints ---
PASS: trash command omitted from packaged image (got )
PASS: create configured agent (got crud-smoke)
PASS: created agent leaves OpenClaw config valid (got True)
PASS: list includes created agent (got True)
PASS: patch updates created agent model (got kilocode/kilo-auto/balanced)
PASS: delete reports unverified filesystem disposition (got unverified)
PASS: deleted agent is no longer configured (got False)
PASS: packaged no-trash baseline retains deleted workspace (got 1)

Visual Changes

N/A

Reviewer Notes

  • Delete intentionally returns filesystemDisposition: \"unverified\": v1 delegates to openclaw agents delete --force --json without installing trash-cli, so the API does not promise file retention or cleanup.
  • Native PATCH mutations use config-level etag/pre-write checks; controller-originated create/delete/PATCH operations also share local serialization, while external-process races remain bounded by OpenClaw's optimistic write behavior.
  • GET /_kilo/config/agents/:agentId returns normalized state only; raw OpenClaw config remains behind the existing authenticated config-read endpoint.

@pandemicsyn pandemicsyn marked this pull request as ready for review May 26, 2026 21:51
Comment thread services/kiloclaw/controller/src/openclaw-agent-config.ts
Comment thread services/kiloclaw/controller/src/routes/config-agents.ts
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 26, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The new hardening commits resolve three of the five original findings; the DELETE route's missing normalization and normalizeAgentId's trailing-dash-after-slice issue remain unaddressed.

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/kiloclaw/controller/src/openclaw-agent-config.ts 218 slice(0, 64) executes after trailing-dash removal — a 64-char boundary that falls on a dash position re-introduces trailing dashes in the normalized ID
services/kiloclaw/controller/src/routes/config-agents.ts 150 DELETE handler passes raw URL param to deleteViaCli without normalization — inconsistent with all other agent routes
Resolved since previous review (commit 13e129e)
  • openclaw-agent-cli.tsCliValueSchema now rejects dash-prefixed values, closing the option-injection vector on name, model, and bindings
  • openclaw-agent-config.tsrequireAgentId now rejects IDs that normalize to the reserved main identifier rather than silently targeting it
  • openclaw-agent-config.tsreadAgentConfigSnapshot no longer leaks filesystem paths in error responses; raw error is logged server-side only
Files Reviewed (10 files)
  • .specs/kiloclaw-controller.md — no issues
  • services/kiloclaw/controller/src/endpoint-capabilities.ts — no issues
  • services/kiloclaw/controller/src/endpoint-capabilities.test.ts — no issues
  • services/kiloclaw/controller/src/openclaw-agent-cli.ts — no issues
  • services/kiloclaw/controller/src/openclaw-agent-cli.test.ts — no issues
  • services/kiloclaw/controller/src/openclaw-agent-config.ts — 1 issue (line 218)
  • services/kiloclaw/controller/src/openclaw-agent-config.test.ts — no issues
  • services/kiloclaw/controller/src/routes/config-agents.ts — 1 issue (line 150)
  • services/kiloclaw/controller/src/routes/config-agents.test.ts — no issues
  • services/kiloclaw/scripts/controller-entrypoint-smoke-test.sh — no issues

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-4.6 · 554,352 tokens

Review guidance: REVIEW.md from base branch main

@pandemicsyn
Copy link
Copy Markdown
Contributor Author

pandemicsyn commented May 27, 2026

Smoke test evidence

Executed the packaged-image controller entrypoint smoke flow on this PR branch, including 0ce37e74a (test(kiloclaw): validate created agent config in smoke test).

Relevant CRUD / OpenClaw validation output:

--- agent config CRUD endpoints ---
PASS: trash command omitted from packaged image (got )
PASS: create configured agent (got crud-smoke)
PASS: created agent leaves OpenClaw config valid (got True)
PASS: list includes created agent (got True)
PASS: patch updates created agent model (got kilocode/kilo-auto/balanced)
PASS: delete reports unverified filesystem disposition (got unverified)
PASS: deleted agent is no longer configured (got False)
PASS: packaged no-trash baseline retains deleted workspace (got 1)

=== Results: 19 passed, 0 failed ===

openclaw config validate --json is used after real CLI-backed creation to confirm the resulting persisted OpenClaw config is schema-valid without running repair/migration behavior.

Comment thread services/kiloclaw/controller/src/openclaw-agent-cli.ts
Comment thread services/kiloclaw/controller/src/openclaw-agent-config.ts
Comment thread services/kiloclaw/controller/src/openclaw-agent-config.ts Outdated
@pandemicsyn pandemicsyn merged commit 50dc1c7 into main May 27, 2026
14 checks passed
@pandemicsyn pandemicsyn deleted the feat/kiloclaw-agent-config-crud branch May 27, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants