Skip to content

refactor(doctor): share Claude directory problem formatting - #132974

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/share-claude-dir-problem-formatting
Aug 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/share-claude-dir-problem-formatting

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Claude CLI doctor diagnostics had two copies of the same directory-problem formatting policy. Keeping workspace and project-directory wording in separate implementations made future drift possible.

Why This Change Was Made

The doctor command now uses one private directory-problem formatter while each call site continues to own its exact label. Healthy/missing suppression, path shortening, diagnostic ordering, and fix-hint behavior are unchanged.

The canonical owner remains src/commands/doctor-claude-cli.ts; no shared utility, public API, config, persistence, or compatibility surface is introduced.

User Impact

No user-visible behavior change. Claude CLI doctor output remains byte-for-byte equivalent for the affected directory health states.

Evidence

  • Focused src/commands/doctor-claude-cli.test.ts: 8/8 passed.
  • oxfmt --check: passed.
  • pnpm tsgo:core: passed.
  • git diff --check: passed.
  • Mandatory local Sol autoreview: clean, correctness 0.99.
  • Production delta: +8/-28, net -20; tests +0/-0.
  • check-changed passed its applicable ratchets, then its dead-export scan could not load tracked UI config files omitted by the sparse worktree. This draft will remain unready until the hydrated native review lane resolves that environment-only gap.

Root cause: duplicated presentation policy inside the Claude CLI doctor owner.

Canonical fix: one private formatter parameterized by directory path, health, and caller-owned label.

Removed paths: the separate workspace and Claude project-directory formatter implementations.

Sibling coverage: both workspace and project-directory call sites use the canonical formatter; their distinct fix-hint policies remain untouched.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 the commands Command implementations label Aug 30, 2026
@vincentkoc vincentkoc added cli CLI command changes maintainer Maintainer-authored PR size: S labels Aug 30, 2026
@vincentkoc vincentkoc self-assigned this Aug 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 30, 2026 01:22
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 9:28 PM ET / August 30, 2026, 01:28 UTC.

ClawSweeper review

What this changes

The PR replaces two private Claude CLI doctor directory-diagnostic formatters with one formatter whose callers supply the appropriate label.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still has the duplicated private formatters, while this focused refactor preserves their health-state output and caller-specific labels. No blocking review finding was identified; normal maintainer handling and completion of exact-head checks remain appropriate.

Priority: P3
Reviewed head: ff329ea52ca3ff2b794a591d6c0110029b279380

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A concise, net-negative private refactor with direct source-equivalence support and no identified correctness defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is a behavior-neutral private refactor; direct source equivalence and existing focused coverage are sufficient for the applicable review scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is a behavior-neutral private refactor; direct source equivalence and existing focused coverage are sufficient for the applicable review scope.
Evidence reviewed 5 items Current main still contains duplicate policy: Current main retains separate workspace and Claude project-directory formatters, so the requested cleanup is not already implemented.
Introduced behavior is equivalent: The shared formatter preserves the same path shortening and five health-state outcomes; its two callers pass the exact labels that the prior wrappers constructed.
Doctor-flow callers: Both the structured doctor health check and Gateway command-owner runner call the same exported Claude CLI health function; neither introduces an alternate formatting path.
Findings None None.
Security None None.

How this fits together

Claude CLI doctor checks workspace and Claude project directories, then turns unhealthy states into user-facing diagnostic lines and targeted fix hints. This refactor sits between those health probes and the doctor command’s rendered output.

flowchart LR
  A[Claude directory paths] --> B[Directory health probes]
  B --> C[Diagnostic formatter]
  C --> D[Workspace and project labels]
  D --> E[Doctor output]
  E --> F[Fix hints]
Loading

Before merge

  • Resolve merge risk (P1) - Captured hosted checks were still incomplete, and the review environment did not independently execute the PR body’s claimed commands; merge should wait for exact-head required checks to finish green.
  • Complete next step (P2) - No repair lane is needed: this focused member-authored refactor has no actionable review defect.
Agent review details

Security

None.

PR surface

Source -20. Total -20 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 8 28 -20
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 8 28 -20

Review metrics

Metric Value Why it matters
Production versus test delta production +8/-28 (net -20); tests unchanged The one production module removes duplicated formatting policy without adding a public or configuration surface.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-claude-cli.ts, unknown-data-model-change: src/commands/doctor-claude-cli.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the module-local consolidation once exact-head checks are green, retaining the two caller-owned labels and the existing distinct fix-hint policy.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the module-local consolidation once exact-head checks are green, retaining the two caller-owned labels and the existing distinct fix-hint policy.

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

Not applicable: this PR is a behavior-neutral refactor, not a reported runtime defect. Source comparison establishes the relevant output equivalence without a separate failure reproduction.

Is this the best way to solve the issue?

Yes. A single private formatter removes the duplicated policy while preserving labels at the only two callers; retaining separate wrappers would leave the drift risk intact.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small behavior-neutral internal cleanup with limited user impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is a behavior-neutral private refactor; direct source equivalence and existing focused coverage are sufficient for the applicable review scope.

Label justifications:

  • P3: This is a small behavior-neutral internal cleanup with limited user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is a behavior-neutral private refactor; direct source equivalence and existing focused coverage are sufficient for the applicable review scope.

Evidence

What I checked:

Likely related people:

  • unknown: The blamed commit carries this line unchanged from a recorded parent; no introducing author is attributed. (role: carried-forward source line; confidence: low)

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

ClawSweeper disposition for exact head ff329ea52ca3ff2b794a591d6c0110029b279380:

  • Resolve merge risk: complete. Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/33285522934 passed with 167 successful jobs, 18 intentional skips, and zero failures.
  • Complete next step: complete. No repair lane was needed because the review found no actionable defect.
  • Validation: mandatory OPENCLAW_TESTBOX=1 scripts/pr prepare-run 132974 passed at the same head, including hydrated native review artifacts and tests.
  • Findings / Rank-up moves: no actionable correctness findings and no Rank-up moves were listed.
  • Stored data model: false positive. src/commands/doctor-claude-cli.ts formats in-memory diagnostic strings; this PR does not change migrations, backfills, persistence, schemas, upgrade behavior, or stored user state.
  • Maintainer review: complete. Native review artifacts and the mandatory local Sol autoreview found no blocking issues.

Proceeding with the normal merge verification.

@vincentkoc
vincentkoc merged commit 9d8bf35 into main Aug 30, 2026
308 checks passed
@vincentkoc
vincentkoc deleted the refactor/share-claude-dir-problem-formatting branch August 30, 2026 01:34
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant