Repository navigation
fix(cli): keep gateway lifecycle commands working with an invalid config - #164158
Conversation
Control the recorded service independently of config validity and report validation problems as recovery warnings. Preserve the installed definition and its health target during invalid-config restarts, keep diagnostics usable, and leave strict validation and retired-key migration with startup and Doctor. Keep the status config reader, log formatter, and config test cases in focused siblings to preserve the existing line caps without removing coverage.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 3, 2026, 4:12 AM ET / 08:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR keeps Gateway service recovery and diagnostics available with invalid configuration, adds repair warnings, and preserves installed service settings during restart. Merge readiness⛔ Blocked before merge - 3 items remain This remains useful work that current main does not implement, but the newly documented newer-config recovery case still encounters the native adapter’s version refusal. The earlier migration-proof concern does not apply because this patch changes no stored format. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway CLI controls OpenClaw’s installed background service and gathers connection and log diagnostics. Native service adapters select and mutate the recorded service, while config validation supplies startup admission and recovery warnings. flowchart TD
A[CLI recovery command] --> B[Recorded service discovery]
C[Local configuration] --> D[Validation diagnostics]
B --> E[Native service guards]
E --> F[Stop uninstall or restart]
D --> G[Repair warnings]
F --> H[Service state and restart health]
H --> G
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +142, Tests +231, Docs +5, Other -1. Total +377 across 26 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Apply one typed Gateway recovery policy through the native service owner, preserving installed definitions and keeping startup, installation, and config-writing version guards strict. Do we have a high-confidence way to reproduce the issue? Yes, from source: with a recorded native service and meta.lastTouchedVersion newer than the binary, recovery reaches the unchanged adapter guard and is refused unless the existing override is set. The service-owner regression already asserts this refusal; no code was executed during this review. Is this the best way to solve the issue? No, the recovery policy is incomplete at the final native boundary. The general separation of service control from unrelated config validation is sound, and no new migration is needed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31e85eeebcc1. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…fig (openclaw#164158) openclaw gateway stop (and the other lifecycle/recovery commands) refused to act when openclaw.json carried unrecognized keys, leaving operators unable to stop a Gateway before repairing it. Lifecycle commands now resolve only the recorded service identity, act, and then warn with the config problems and point to openclaw doctor --fix; Doctor itself stays strict. Adds Doctor migrations for the retired keys seen in the report (tools.media.audio.models, commands.ownerDisplay, gateway.tailscale.resetOnExit, memory.backend/qmd, meta.lastTouchedAt). Reported on Discord by majorkarpati.
What Problem This Solves
Fixes Gateway recovery commands refusing to stop or inspect an installed service when an upgrade leaves invalid or retired keys in
openclaw.json.User Impact
Operators can stop, uninstall, or restart the recorded service and receive config warnings with
openclaw doctor --fixguidance. Status and logs remain useful during config recovery. Startup still validates config, and restart still reports failed health checks honestly. Invalid-config restarts preserve the installed service definition and its health-check port instead of rebuilding it from unrepaired settings.Why This Change Was Made
Service identity belongs to the native service adapter; unrelated agent, tool, memory, and plugin validation must not veto recovery. The lifecycle owner now reports those issues as diagnostics. Status preserves independently valid connection fields, logs recover from an unreadable local config, and update status reports validation warnings without rejecting the command. No config/CLI options, dependencies, or database schemas were added. Status config reads and logs formatting were moved into focused CLI siblings to satisfy the existing line caps; the status tests retain their coverage through a test-support sibling.
Every reported rejected key was accepted by the shipped
v2026.7.35schema and intentionally retired beforev2026.9.7. Existing Doctor migrations already cover them; no current core or official-plugin writer was found emitting these retired paths, so this PR does not reintroduce runtime aliases or relax Doctor validation.meta.lastTouchedAtconfig.lastTouchedAtbefore removing it. Current writes use SQLite.agents.defaults.memorySearchmemory.search, preserving current-path precedence. Per-agent values migrate to the agent'smemory.search.agents.defaults.imageGenerationModelagents.defaults.mediaModels.image, which current writers use.tools.media.audio.modelstools.media.modelswithcapabilities: ["audio"], preserving order.commands.ownerDisplayownerDisplaySecret. Owner IDs now render raw.gateway.tailscale.resetOnExitmemory.backendmemory.qmdmemory.search.extraPathsand enabled session indexing in the current search settings, then removes QMD config.The separate multi-agent ownership diagnostic also has an existing migration: legacy rosters become keyed entries with explicit ownership while historical default-agent roles are preserved.
Evidence
lifecycle-core.config-guard,status.gather,lifecycle-readiness) passed three consecutive runs: 93 tests per run; wall times on the final tree 50.48s / 17.77s / 13.30s. Earlier individual focused runs took 21.83s / 29.04s / 45.95s, dominated by shared compiler preparation.node scripts/check-changed.mjs: passed (1,095.29s), including all core/test type graphs, lint, dead-export scans, import cycles, and guards. Eager-import closure and PR wrapper source-closure tests passed; export-name collisions and the update-restart swap fixture passed. The new files are outside the wrapper inventory closure, so no inventory addition was needed.gateway stop --force --jsonexited 0, returnedresult: "stopped", unloaded the service, closed the listener, and warned about the invalid keys with Doctor guidance.doctor --lint --only core/doctor/final-config-validation --jsonthen exited 1 with both unknown-key findings. Both commands preserved the config bytes; the fixture was removed.Managed command exited while its process group remained activeduring diffs asset generation. The isolated asset command completed, then canonical runtime preparation passed in 83.05s. This is recorded as a preparation failure, not claimed as a repaired flake.src/cli/update-cli/update-command-service.integration.test.ts: 154.14s including approximately 137s of test time. Existing update routing/wizard cases insrc/cli/update-cli.test.tstook 33.873s–89.136s; its infra batch took 700.80s. These pre-existing cases are retained under the slow-suite waiver; no timeouts, retries, or assertions were weakened. The existing Windows-only home-casing test is skipped on macOS.materializes full cold/warm PR siblings, then preserves native sparse transitionsexceeded its existing 120s deadline at 124.94s. The mandatory three-file tooling run otherwise had 35 passed / one platform skip in 559.03s. This pre-existing host-sensitive timing failure is retained under the slow-suite waiver; no timeout or assertion was changed.