Lint: add standalone diagnostic command#80800
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Real behavior proof Next step before merge Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 9f112a1a7a40. |
4aae278 to
f3131a2
Compare
f3131a2 to
a0e7859
Compare
|
Updated latest push/body for the review nits: added docs nav coverage, fixed the command path policy assertion to cover lint, and replaced the pending proof text with copied live output from the source CLI entry for openclaw lint. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a0e7859 to
78931e4
Compare
78931e4 to
3cf7250
Compare
0e7eb60 to
3d43c37
Compare
|
Rebased on current origin/main (e643890) and removed the unrelated generated plugin SDK baseline delta from the branch diff.\n\nChecks:\n- node scripts/test-projects.mjs src/commands/lint.test.ts src/flows/lint-flow.test.ts src/flows/core-diagnostics.test.ts src/cli/program/register.maintenance.test.ts src/cli/program/preaction.test.ts src/cli/command-path-policy.test.ts --reporter=verbose\n- node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo\n- node scripts/check-changed.mjs\n- git diff --check\n\n@clawsweeper re-review |
2dca6bc to
b7f6b73
Compare
a0bbfb5 to
3081cac
Compare
|
Fresh deterministic proof image for #80800 is published and the PR body now points at it. This replaces the older proof with a clean upstream/main vs PR-head probe showing the new lint diagnostic command surfaces and engine behavior. |
3081cac to
5f45fee
Compare
|
Closing this alternate standalone lint-command draft in favor of #80055. After working through the migration shape, the cleaner path is to avoid a second health surface and keep lint/detection integrated with doctor's health-check contract. I am keeping #80055 as the active proposal, with follow-up conversions staged as small area-specific PRs on top. |
Branch:
lint-diagnostics-commandBase:
upstream/mainHead:
f3131a2dd0Summary
This is an alternate shape for the lint work in
#80055.
Instead of adding
openclaw doctor --lint, this draft adds a top-levelopenclaw lintcommand for read-only diagnostics.The command runs the migrated core diagnostic checks without prompting, loading
plugins, repairing config, or rewriting state. It is meant for CI, preflight,
policy checks, and review gates where operators need structured findings rather
than guided doctor output.
Out of the box, this draft runs the same first migrated core checks:
core/lint/gateway-configcore/lint/command-ownercore/lint/workspace-statuscore/lint/skills-readinesscore/lint/final-config-validationMotivation
OpenClaw already has multiple adjacent surfaces:
openclaw doctorfor guided inspection and repairopenclaw healthfor a running Gateway health snapshotA top-level
openclaw lintkeeps those responsibilities explicit:doctorremains the human repair pathhealthremains the runtime/Gateway status pathlintbecomes the read-only diagnostic path for automationThat gives maintainers a cleaner option if
doctor --lintfeels like it makesdoctor responsible for too many modes.
Related issue signal:
doctor dry-run/diff mode because
doctor --fixapplies changes without astructured preview.
doctor --fixreports repairs, then fails validation and the same stale findings return on
the next run.
doctor --fixpartially runs against a live gateway and exits abruptly, leaving the user
unsure what was applied.
already treats lint as a gate, but operators need clearer machine-readable
diagnostics when a gate fails.
This draft does not claim to close those issues. It adds a stable read-only
diagnostic command that gives current and follow-up checks a consistent
reporting surface.
Maintainer Input Requested
Should lint be a core command, an extension command, or part of doctor?
This draft uses
openclaw lint. The paired doctor-integrated draft usesopenclaw doctor --lint: Doctor: add health-check contract and --lint validation #80055The core question is where maintainers want this surface to live:
evaluate experimentally
If lint starts as an extension, how should it handle plugin/extension
failures?
The reason this draft currently implements lint in core is reliability:
diagnostics are most useful when config, plugin loading, or extension startup
is already degraded. If maintainers prefer an extension-first shape, what is
the expected bootstrap model?
Possible shapes:
failures
moving into core
Is "diagnostics" the right internal framing?
The public command is
lint, but the intent is broader than formatting orsource linting. These are structured workspace diagnostics with stable check
ids, severities, source locations, and fix hints.
This avoids overloading the existing
openclaw healthruntime command whilestill giving future policy and preflight work a common reporting model.
Should this stay in
src/flowsfor now?The draft keeps the diagnostic runner near existing doctor flow machinery to
minimize movement. If maintainers expect this to become part of a broader
capability ownership model, the same runner could move under a clearer
diagnostics or capability home later.
What Changed
openclaw lint.--json,--severity-min,--skip, and--only.loading is broken.
openclaw lint.as
core/lint/*diagnostics in this standalone variant.openclaw doctor --fixas the repair surface.Behavior
Human output:
JSON output:
{ "ok": false, "checksRun": 5, "checksSkipped": 0, "findings": [ { "checkId": "core/lint/gateway-config", "severity": "warning", "message": "gateway.mode is unset; gateway start will be blocked.", "path": "gateway.mode", "fixHint": "Run `openclaw configure` and set Gateway mode (local/remote), or `openclaw config set gateway.mode local`." } ] }Exit codes:
0: no findings at or above the selected threshold1: one or more findings met the selected threshold2: command/runtime failure before findings could be emittedSelection examples:
Review Notes
This is not a replacement for
openclaw doctor.openclaw lintis read-only and automation-friendly. It does not prompt,repair, migrate config, start services, restart services, or load plugins. This
standalone variant uses diagnostic naming in code and does not introduce a
repair()contract oropenclaw/plugin-sdk/healthsurface.Doctor remains the command operators use when they want guided inspection and
repair. The useful part of this draft is the CLI boundary: diagnostics have a
dedicated command, while repairs stay with doctor.
Real Behavior Proof
Behavior addressed:
openclaw lintshould be a standalone, read-only diagnostic command backed by a registry/flow for structured checks. Core checks should register once,--onlyshould narrow execution, findings should be structured, thrown checks should become sanitized error findings, and--severity-minshould control exit-code thresholds.Real environment tested: Clean WSL detached worktrees for upstream/main and PR #80800 head. The source-level probe imported the PR-head lint diagnostic modules through the same
tsxloader used by the repo tests.Exact steps or command run after fix:
node --import ./node_modules/tsx/dist/loader.mjs probe-lint-diagnostics.mjs.runLintChecks()withonlyIdsforcore/lint/gateway-configandcore/lint/command-owner.exitCodeFromFindings()and severity parsing behavior.Evidence before fix: Upstream/main has no
src/commands/lint.ts, no lint flow, no diagnostic registry, no core diagnostic checks, nodocs/cli/lint.md, no lint command catalog/maintenance wiring, and no lint execution surface to register or run checks.Evidence after fix:
Observed result after fix: PR #80800 registers five core lint checks,
--onlyruns 2 checks and skips 3, emits structuredcore/lint/gateway-configandcore/lint/command-ownerfindings, converts a thrown check intoprobe/thrown-checkwith sanitizeddiagnostic check threw: boomsecret-control, and returns severity-threshold exit codesinfo=1,warning=1,error=0.What was not tested: This proof does not exercise every built-in diagnostic check against every possible config shape; it verifies the command/engine contract and representative core check behavior.
Testing
vitest run src/commands/lint.test.ts src/flows/lint-flow.test.ts src/flows/core-diagnostics.test.ts src/cli/program/register.maintenance.test.ts src/cli/program/preaction.test.ts src/cli/command-path-policy.test.tsoxlint src/cli/command-catalog.ts src/cli/command-path-policy.test.ts src/cli/program/command-registry-core.ts src/cli/program/core-command-descriptors.ts src/cli/program/preaction.test.ts src/cli/program/preaction.ts src/cli/program/register.maintenance.test.ts src/cli/program/register.maintenance.ts src/commands/lint.ts src/commands/lint.test.ts src/flows/core-diagnostics.ts src/flows/core-diagnostics.test.ts src/flows/diagnostics.ts src/flows/diagnostic-registry.ts src/flows/lint-flow.ts src/flows/lint-flow.test.tstsgo:coreFollow-Up
If maintainers prefer this shape, the existing policy drafts can point at
openclaw lintas the read-only validation surface instead ofopenclaw doctor --lint.Related stacked drafts:
Policy: add runtime audit metadata and attestation enforcement #81104