Skip to content

[BUG] Misleading comment: command merge is a union, not precedence #11309

@0xMink

Description

@0xMink

Problem (one or two sentences)

In src/core/webview/ClineProvider.ts, the comment above the command merge logic states that global state "takes precedence over workspace configuration". However, the implementation performs a Set union with no override logic. Neither source takes precedence; both are combined and deduplicated.

Context (who is affected and when)

Affects anyone reading the codebase or relying on the comment to understand command merge behavior. The comment implies override semantics that do not exist, which could lead to incorrect assumptions during future development.

Reproduction steps

  1. Open src/core/webview/ClineProvider.ts and locate the mergeCommandLists() method (near line ~1982).
  2. Read the comment: "Global state takes precedence over workspace configuration."
  3. Observe the implementation: const mergedCommands = [...new Set([...validGlobalCommands, ...validWorkspaceCommands])]
  4. This is a Set union — neither source takes precedence. After merging, the origin (global vs workspace) is not preserved.

Expected result

Comment accurately describes the union behavior with no implication of source priority.

Actual result

Comment states global state takes precedence over workspace configuration, but the implementation performs a Set union with no precedence.

Variations tried (optional)

Confirmed downstream conflict resolution (longest-prefix matching in getSingleCommandDecision) does not use source priority.

App Version

v3.47.3

API Provider (optional)

None

Model Used (optional)

N/A

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

N/A — comment-only change, no functional impact.
Location: src/core/webview/ClineProvider.ts, mergeCommandLists() method, near line ~1982

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationImprovements or additions to documentationbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions