openclaw - 💡(How to fix) Fix QA-command filter logic triplicated across getSubCliEntries / getSubCliCommandsWithSubcommands / getSubCliParentDefaultHelpCommands [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#83926Fetched 2026-05-20 03:46:30
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
1
Timeline (top)
labeled ×5commented ×1unsubscribed ×1

Fix Action

Fix / Workaround

Severity: low / Confidence: high / Category: maintainability Triage: risk Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-2a8623f1b8-_4080e0975e.

Code Example

if (isPrivateQaCliEnabled()) {
    return descriptors;
  }
  return descriptors.filter((descriptor) => descriptor.name !== "qa");
RAW_BUFFERClick to expand / collapse

Severity: low / Confidence: high / Category: maintainability Triage: risk Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol

Evidence

  • src/cli/program/subcli-descriptors.ts:59-83 (getSubCliEntries,getSubCliCommandsWithSubcommands,getSubCliParentDefaultHelpCommands)
if (isPrivateQaCliEnabled()) {
    return descriptors;
  }
  return descriptors.filter((descriptor) => descriptor.name !== "qa");

Reasoning

The same isPrivateQaCliEnabled() / filter-out-'qa' pattern is copy-pasted in all three exported functions. Adding a second feature-flagged command, or changing the filter condition, requires editing all three sites consistently. A single missed edit leaves the command visible on one CLI surface (help text, completion, or parent-default-help) while hidden on others.

Recommendation

Extract a small helper, e.g. function filterPrivateCommands<T extends {name:string}>(items: T[]): T[] { return isPrivateQaCliEnabled() ? items : items.filter(i => i.name !== 'qa'); }, and call it from all three functions. This makes the set of guarded command names a single source of truth.

Why existing tests miss this

No tests exist for this module. The duplication is a latent consistency hazard rather than a currently observable failure, so no existing test would catch a future partial update.

Suggested regression test

it('all three sub-cli filter functions agree on the qa command being absent when private QA is disabled', () => { vi.mocked(isPrivateQaCliEnabled).mockReturnValue(false); expect(getSubCliEntries().find(d => d.name === 'qa')).toBeUndefined(); expect(getSubCliCommandsWithSubcommands().includes('qa')).toBe(false); expect(getSubCliParentDefaultHelpCommands().includes('qa')).toBe(false); });

Minimum fix scope

Extract the repeated filter into a single private helper used by all three functions.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-2a8623f1b8-_4080e0975e.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING