Skip to content

fix(cli): tell config get apart a typo from an unset key - #127369

Merged
steipete merged 1 commit into
mainfrom
steipete/config-get-unset-vs-unknown
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/config-get-unset-vs-unknown

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw config get <path> could not tell an operator whether they had a typo or an unset setting.
A real schema key with no authored value and a key that does not exist produced the identical
message and exit code:

gateway.port              -> 18997                                          exit 0
gateway.bind              -> Config path not found: gateway.bind. Run openclaw config validate ...    exit 1
gateway.mode              -> Config path not found: gateway.mode. ...        exit 1
logging.level             -> Config path not found: logging.level. ...       exit 1
cron.enabled              -> Config path not found: cron.enabled. ...        exit 1
approvals.exec.security   -> Config path not found: approvals.exec.security. ...  exit 1
bogus.path                -> Config path not found: bogus.path. ...          exit 1
gateway.bogus             -> Config path not found: gateway.bogus. ...       exit 1

The first five are real properties (openclaw config schema lists them); the last two are not.

The suggested next step did not help either case. config validate only reports whether the current
file parses and validates — with a valid file it prints Config valid: ~/.openclaw/openclaw.json
and says nothing about which paths exist.

Why This Change Was Made

config unset already makes this distinction. formatConfigUnsetMissingPathMessage
(src/cli/config-cli-path.ts:215) has a separate, accurate message for a path that only exists once
runtime defaults are applied. config get never got the same treatment — and config unset's own
fallback tells the operator to "Run openclaw config get <path> first if you are unsure of the
path", advice that could not work while config get answered identically for both.

The schema needed to answer this was already in hand: runConfigGet calls
buildRuntimeConfigSchemaFromRegistry(...) and used only uiHints from the result. The path-walking
machinery was there too — schemasAtPath (src/cli/config-cli-path.ts:306), already used by
setAtPath, and already index-aware so array paths are not misreported as unknown.

User Impact

openclaw config get gateway.mode
  Config path is valid but unset: gateway.mode. The runtime default applies until you set an
  authored value with openclaw config set gateway.mode <value>.

openclaw config get gateway.bogus
  Unknown config path: gateway.bogus. Run openclaw config schema to inspect valid paths.

The set hint names the operator's actual path, so it is runnable as printed. Both cases still exit 1,
and --json carries the same distinction through formatCliJsonFailure. The success path, the
redaction behaviour, and all exit codes are unchanged.

Evidence

Production +15/-7 (net +8): one exported predicate over the existing schemasAtPath, and the
message split in runConfigGet. Tests +91/-9.

node scripts/run-vitest.mjs src/cli/config-cli.test.ts — 195 tests passed. New coverage: a set
path returns its value; a valid-but-unset path (including an array-index path) reports "valid but
unset"; an unknown path reports "unknown"; both failures exit 1 in text and --json.

oxfmt --check clean on all three files. $autoreview --mode uncommitted clean, no accepted or
actionable findings.

config get answered identically for a real-but-unset schema path and a
path that does not exist, and pointed both at config validate, which only
reports whether the current file parses.

Use the schema runConfigGet already builds to split the two cases: a known
path reports that it is unset and offers a runnable config set command for
that exact path; an unknown path points at config schema. Exit code stays 1
for both, in text and --json.
@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 18:29
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 21, 2026, 2:36 PM ET / 18:36 UTC.

ClawSweeper review

What this changes

The PR makes openclaw config get distinguish an unknown configuration path from a valid schema path that has no authored value.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the new predicate still labels valid nested plugin-schema paths using local $refs as unknown, so the central diagnostic distinction is incomplete.

Priority: P2
Reviewed head: cba138a2caa1f3ef6fffe71e4c6ffbab249ad268

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and test-backed, but a concrete referenced-schema path remains incorrectly diagnosed.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored CLI PR is not subject to the external-contributor proof gate; its body supplies mocked-test evidence only.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored CLI PR is not subject to the external-contributor proof gate; its body supplies mocked-test evidence only.
Evidence reviewed 7 items Current-main behavior: Current main builds the runtime schema but discards it, then sends every missing authored value through one generic not-found branch.
Incomplete new predicate: The new helper only succeeds when the existing walker reaches a property schema; it does not resolve local JSON Schema references.
Concrete valid path missed by the patch: The bundled webhooks schema defines dynamic routes through $ref: #/$defs/route; plugins.entries.webhooks.config.routes.example.path is valid but traversal stops at that reference.
Findings 1 actionable finding [P2] Resolve local schema references before declaring a path unknown
Security None None.

Live Verification

Command: proof_dir="$(mktemp -d)"; trap 'rm -rf "$proof_dir"' EXIT; : › "$proof_dir/openclaw.json"; OPENCLAW_CONFIG_PATH="$proof_dir/openclaw.json" pnpm openclaw config get gateway.bind || test "$?" -eq 1

Result: FAIL (partial) — step 2 expect_output Config path is valid but unset:: expected terminal output was not visible within 30 seconds: "Config path is valid but unset:"

proof_dir="$(mktemp -d)"; trap 'rm -rf "$proof_dir"' EXIT; : › "$proof_dir/openclaw.json"; OPENCLAW_CONFIG_PATH="$proof_dir/openclaw.json" pnpm openclaw config
get gateway.bind || test "$?" -eq 1
runner@runnervm76f27:/tmp/clawsweeper-live-proof-127369-OAJKCk/target$ proof_dir="$(mktemp -d)"; trap 'rm -rf "$proof_dir"' EXIT; : › "$proof_dir/openclaw.json"
; OPENCLAW_CONFIG_PATH="$proof_dir/openclaw.json" pnpm openclaw config get gateway.bind || test "$?" -eq 1
$ node scripts/run-node.mjs config get gateway.bind
proof_dir="$(mktemp -d)"; trap 'rm -rf "$proof_dir"' EXIT; : › "$proof_dir/openclaw.json"; OPENCLAW_CONFIG_PATH="$proof_dir/openclaw.json" pnpm openclaw config
get gateway.bind || test "$?" -eq 1
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 107.89 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.8s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 484
… output truncated …

Assertions:

  • FAIL expect_output: Config path is valid but unset:
  • FAIL expect_output: Unknown config path:

How this fits together

The Config CLI reads operator-authored configuration and an active plugin-derived JSON schema. It prints a redacted stored value when present, otherwise uses the schema to explain whether the requested path is unset or unknown.

flowchart LR
  A[Operator config-get command] --> B[Parse config path]
  B --> C[Read authored config]
  C --> D[Build runtime schema]
  D --> E{Stored value found?}
  E -->|Yes| F[Print redacted value]
  E -->|No| G{Schema path valid?}
  G -->|Yes| H[Explain unset default]
  G -->|No| I[Explain unknown path]
Loading

Before merge

  • Resolve local schema references before declaring a path unknown (P2) - The new predicate cannot descend through $ref nodes. The bundled webhooks schema maps routes.* to #/$defs/route, so a valid unset path such as plugins.entries.webhooks.config.routes.example.path reaches this line with no candidate and is reported as unknown. Resolve supported local references (and cover this schema shape in text and JSON) before using the predicate for the CLI diagnosis.
  • Resolve merge risk (P1) - Production grows by 8 net lines for this bug fix; the added predicate needs reference-aware traversal before that growth is justified.
  • Resolve merge risk (P1) - The mandatory structured autoreview closeout remains unrun because TruffleHog is unavailable in this environment.
  • Complete next step (P2) - The P2 repair is concrete, but the protected maintainer label keeps this PR in normal human handling rather than automated repair.

Findings

  • [P2] Resolve local schema references before declaring a path unknown — src/cli/config-cli-path.ts:327
Agent review details

Security

None.

PR surface

Source +8, Tests +82. Total +90 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 15 7 +8
Tests 1 91 9 +82
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 106 16 +90

Review metrics

Metric Value Why it matters
Production versus test LOC production +8 net, tests +82 net The new diagnostic behavior requires production growth, but its schema predicate is incomplete for referenced plugin schemas.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Extend the shared schema walker to resolve supported local references before classifying a path, add text and JSON regressions using a webhooks-style referenced route schema, then rerun the focused test and structured review.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Extend the shared schema walker to resolve supported local references before classifying a path, add text and JSON regressions using a webhooks-style referenced route schema, then rerun the focused test and structured review.

Do we have a high-confidence way to reproduce the issue?

Yes—current main routes all missing authored values through one branch, and the PR source deterministically misclassifies the referenced webhooks route path as unknown.

Is this the best way to solve the issue?

No—the schema-backed approach is the right owner boundary, but the walker must support local references before it can make an authoritative unknown-path claim.

Full review comments:

  • [P2] Resolve local schema references before declaring a path unknown — src/cli/config-cli-path.ts:327
    The new predicate cannot descend through $ref nodes. The bundled webhooks schema maps routes.* to #/$defs/route, so a valid unset path such as plugins.entries.webhooks.config.routes.example.path reaches this line with no candidate and is reported as unknown. Resolve supported local references (and cover this schema shape in text and JSON) before using the predicate for the CLI diagnosis.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ee79b0a49ae4.

Labels

Label changes:

  • add P2: The patch introduces a bounded but user-facing false diagnostic for valid plugin configuration paths.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored CLI PR is not subject to the external-contributor proof gate; its body supplies mocked-test evidence only.

Label justifications:

  • P2: The patch introduces a bounded but user-facing false diagnostic for valid plugin configuration paths.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored CLI PR is not subject to the external-contributor proof gate; its body supplies mocked-test evidence only.

Evidence

What I checked:

  • Current-main behavior: Current main builds the runtime schema but discards it, then sends every missing authored value through one generic not-found branch. (src/cli/config-cli.ts:174, ee79b0a49ae4)
  • Incomplete new predicate: The new helper only succeeds when the existing walker reaches a property schema; it does not resolve local JSON Schema references. (src/cli/config-cli-path.ts:327, cba138a2caa1)
  • Concrete valid path missed by the patch: The bundled webhooks schema defines dynamic routes through $ref: #/$defs/route; plugins.entries.webhooks.config.routes.example.path is valid but traversal stops at that reference. (extensions/webhooks/openclaw.plugin.json:57, ee79b0a49ae4)
  • Runtime schema preserves plugin references: Plugin schemas are copied into plugins.entries.&lt;id>.config without resolving their references, so the webhooks reference reaches this new CLI predicate unchanged. (src/config/schema.ts:425, ee79b0a49ae4)
  • Regression coverage gap: New tests model properties, dynamic object maps, and arrays, but no referenced schema node, so they cannot detect the webhooks failure. (src/cli/config-cli.test.ts:1398, cba138a2caa1)
  • Recent area provenance: Blame attributes the current config-get branch and schema walker to this recent path creation; deeper ownership history is unavailable in the shallow checkout. (src/cli/config-cli.ts:174, 03d4b8a9c331)

Likely related people:

  • Vyctor H. Brzezowski: Commit 03d4b8a created both current config CLI files; shallow history prevents a stronger feature-owner attribution. (role: recent area contributor; confidence: low; commits: 03d4b8a9c331; files: src/cli/config-cli.ts, src/cli/config-cli-path.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve local schema references in the path walker and add the webhooks-style regression in text and JSON.
  • Rerun the focused CLI test and autoreview after TruffleHog is available.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 98c02e0 into main Aug 21, 2026
303 checks passed
@steipete
steipete deleted the steipete/config-get-unset-vs-unknown branch August 21, 2026 19:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
…7369)

config get answered identically for a real-but-unset schema path and a
path that does not exist, and pointed both at config validate, which only
reports whether the current file parses.

Use the schema runConfigGet already builds to split the two cases: a known
path reports that it is unset and offers a runnable config set command for
that exact path; an unknown path points at config schema. Exit code stays 1
for both, in text and --json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant