Skip to content

feat(telemetry): propose pass-through entries from usage errors #6598

Done

Description

@dan-petty

Problem

The owner changed the scope of #4840 on 2026-11-12 (comment 6835584734): the usage-error ranking proposes pass-through entries after the registry exists. The design of #4840 of 2026-11-20 defers this part, because the registry is not in the tree. So #4840 builds its six classes only, and this item holds the deferred part.

Scope

  • Add the proposal class passthrough_candidate: an unknown command under a group whose registry entries (src/devops_cli/core/passthrough.py) name a tool. An example is devops openspec validate when no such command exists. The proposal is a pass-through entry, not a new flag.
  • Precedence: hinted comes before passthrough_candidate.
  • A command that the registry lists as never wrapped (pr merge, auth, secret set, repo delete, release) never gets passthrough_candidate. The ranking reads that list from the registry, so the two lists stay the same.
  • flag_candidate never names a pass-through command.
  • For an unknown option of an API command, the proposal names the query field or the body field of its route (the API naming rule of the ADR of feat(cli): add the tool pass-through registry and its ADR #6597). The usage-error record holds the command path and the typed name only, and no argument value.
  • The proposal threshold (5 errors on 3 days) also decides when a deferred tool group gets its pass-through item: k8s, kustomize, tf, uv, test, pipeline, docker sign|verify, the single-tool rows of devops ci, and the root aliases lint, format and tui.

Acceptance criteria

  • Test first: on the fixture ledger, a record of devops openspec validate, when no such command exists, gets passthrough_candidate. The test fails on the base.
  • A test: a record of devops pr merge gets hinted, not passthrough_candidate.
  • A test: no row names a pass-through path as flag_candidate.
  • A test: an unknown option of an API command gets a proposal that names the field of its route.

Dependencies

Source

Source: #4833

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found only shell command correctors such as thebleep and thefuck plus static completion specs; none reads an aggregated usage-error ledger, applies a 5-errors-on-3-days threshold, or proposes a registry pass-through entry.

Lacks:

  • Reads no aggregated usage-error ledger of unknown commands and options
  • Applies no threshold of 5 errors on 3 days per tool group
  • Writes no pass-through entry from a registry never-wrapped list
  • Names no query or body field of an API route

Proposed design

Problem statement

The usage-error ranking in src/devops_cli/telemetry/usage_error_report.py gives six classes and proposes no pass-through entry. A user who types an unknown command under a group with a registry entry gets no proposal, so the tool stays unwrapped. This item adds the class passthrough_candidate after hinted, reads the registry and NEVER_WRAPPED at run time, separates the classes by the record kind, and keeps the is_proposal threshold. The unregistered tool groups are item #7622. The API route field naming waits on a route table and moves to a new item.

Acceptance criteria

Requirement: Pass-through proposal for a registry group

The usage-error ranking SHALL give an unknown command under a group with a registry entry the class passthrough_candidate.

Scenario: Unknown command under the openspec group

  • WHEN A test passes passthrough_paths={"openspec": ("devops openspec",)} and replays 5 records on 3 days of the command path openspec and the name validate.
  • THEN The one row has the class passthrough_candidate and is_proposal true.

Requirement: hinted before passthrough_candidate

The ranking SHALL give a record that a usage hint covers the class hinted and SHALL NOT give it the class passthrough_candidate.

Scenario: Hinted record under a never-wrapped entry

  • WHEN A test passes passthrough_paths={"gh pr merge": ("devops gh pr merge",)} and replays 5 records on 3 days of the command path gh pr, the name merge and hinted true.
  • THEN The row has the class hinted and not passthrough_candidate.

Requirement: Never-wrapped names get no pass-through proposal

The ranking SHALL NOT give a command whose tool path is in NEVER_WRAPPED the class passthrough_candidate.

Scenario: Each never-wrapped gh verb

  • WHEN A test passes a fixture map from each of gh pr merge, gh auth, gh secret set, gh repo delete and gh release to its devops path, and replays 5 records on 3 days of each command.
  • THEN No row has the class passthrough_candidate.

Requirement: Never-wrapped set read at call time

The ranking SHALL read NEVER_WRAPPED from devops_cli.core.passthrough at call time and SHALL keep no copy of it.

Scenario: A verb added to the set at call time

  • WHEN A test replaces devops_cli.core.passthrough.NEVER_WRAPPED with a set that adds run list, and replays 5 records on 3 days of the command path gh run and the name zzz with no suggestion.
  • THEN The row has the class feature_candidate and not passthrough_candidate.

Requirement: Kind separates the classes

The ranking SHALL give a record of the kind unknown_option the class flag_candidate and SHALL NOT give it the class passthrough_candidate.

Scenario: Unknown option under a registry group

  • WHEN A test passes passthrough_paths={"openspec": ("devops openspec",)} and replays 5 records on 3 days of the kind unknown_option, the command path openspec and the name --dry-runn.
  • THEN The row has the class flag_candidate and not passthrough_candidate.

Requirement: Pass-through group below the threshold

The ranking SHALL set is_proposal to false for a passthrough_candidate group below telemetry.usage_errors_min_count or below telemetry.usage_errors_min_days.

Scenario: Four errors on three days

  • WHEN A test passes passthrough_paths={"openspec": ("devops openspec",)} and replays 4 records on 3 days of the command path openspec and the name validate, with min_count 5 and min_days 3.
  • THEN The row has the class passthrough_candidate and is_proposal false.

Existing Tool Considered

The alternatives check of 2026-11-27 in the issue body gives the verdict none and names no tool; the block in the issue body holds what each candidate lacks. No open, maintained tool or library covers the need. The change builds the class inside the ranking in src/devops_cli/telemetry/usage_error_report.py, and it reuses the record kinds and the registry. Cost: about 40k tokens to build, keep and fix the code and its tests, and about 3 hours of elapsed time.

Key questions

  • Which module holds the usage-error ranking, and which classes does it give?: src/devops_cli/telemetry/usage_error_report.py holds the ranking and the six classes in the order resolved, hinted, alias_candidate, flag_candidate, feature_candidate, help_candidate. The living spec openspec/specs/usage-error-ranking/spec.md states that order and the threshold. [sources: src/devops_cli/telemetry/usage_error_report.py, openspec/specs/usage-error-ranking/spec.md, tests/telemetry/test_usage_error_report.py]
  • Which commands does the registry hold today, and which tool do they name?: src/devops_cli/core/passthrough.py holds five entries: gh run list, gh issue create, gh issue edit, gh issue close and gh issue reopen. Each has a devops path devops gh ... and names the tool gh. NEVER_WRAPPED holds the gh verbs pr merge, auth, secret set, repo delete and release. [sources: src/devops_cli/core/passthrough.py]
  • Which fields does the usage-error record hold for a proposal?: The record holds the command path, the typed name, the kind, the suggestion, the hinted flag and the caller. It holds no argument value, and a word that is not in the form of a CLI name becomes <value>. [sources: src/devops_cli/telemetry/usage_errors.py]
  • Does this item still wait on feat(telemetry): rank CLI usage errors and propose fixes #4840 or feat(cli): add the tool pass-through registry and its ADR #6597?: No. The tree holds the six classes and the registry, and the living spec holds the ranking. This item changes src/devops_cli/telemetry/usage_error_report.py, its test and the spec. [sources: src/devops_cli/telemetry/usage_error_report.py, src/devops_cli/core/passthrough.py, openspec/specs/usage-error-ranking/spec.md]
  • How does the ranking find the tool group of an unknown command?: The ranking compares the words of the record command_path with each registry devops path, with the leading devops removed, and takes the longest entry whose path starts with those words. The matched entry names the tool, and the proposed entry is the typed path of command_path and name. (best practice) [sources: src/devops_cli/core/passthrough.py, docs/adr/0037-tool-commands-mirror-and-pass-through-options.md]
    • Chosen: Longest word-prefix match on the record command path. One rule serves a one-word group, a two-word row such as docker sign, and the three-word rows of gh.
    • Rejected: Match the full typed path. An unknown name is not a registered path, so no record would match.
    • Rejected: A static map of groups in the ranking. It copies the registry and drifts from it.
  • Where does passthrough_candidate sit in the class order?: The class comes after hinted and before alias_candidate. (best practice) [sources: openspec/specs/usage-error-ranking/spec.md, src/devops_cli/telemetry/usage_error_report.py]
    • Chosen: After hinted and before alias_candidate. It keeps the precedence of the scope and puts a real tool entry before an alias of a devops command.
    • Rejected: Before hinted. The scope of the issue puts hinted first.
    • Rejected: After help_candidate. An alias would then win over the pass-through entry for a registry group.
  • How does the ranking compare a registry entry with NEVER_WRAPPED?: The ranking reads NEVER_WRAPPED from devops_cli.core.passthrough at call time. For an entry whose tool path starts with gh , it removes that prefix and tests the rest against the set, because the set holds gh verbs. (best practice) [sources: src/devops_cli/core/passthrough.py]
    • Chosen: Remove the gh prefix, then test the set. The docstring of the set names gh verbs, and each registry key starts with gh .
    • Rejected: Test the whole tool path. No key equals a verb, so the exclusion never fires.
    • Rejected: Test the last words of the key. A later tool with a same-named verb would be excluded by mistake.
  • How does the ranking separate a pass-through candidate from a flag candidate?: The record kind separates the cases. A record of kind unknown_command goes to hinted or passthrough_candidate, and a record of kind unknown_option goes to flag_candidate. (best practice) [sources: src/devops_cli/telemetry/usage_errors.py, src/devops_cli/telemetry/usage_error_report.py]
    • Chosen: Classify by the record kind. The kind states whether the caller typed a command word or an option name.
    • Rejected: Classify by token shape and group match. The shape does not tell an unknown command from an unknown option.
    • Rejected: Let both classes fire for one record. One error would give two proposals.
  • How does the threshold decide a pass-through proposal?: The class reuses the is_proposal rule: true only when the group meets telemetry.usage_errors_min_count (default 5) and telemetry.usage_errors_min_days (default 3). A group below the threshold stays in the output with is_proposal false. (best practice) [sources: openspec/specs/usage-error-ranking/spec.md, src/devops_cli/telemetry/usage_error_report.py]
    • Chosen: Reuse the is_proposal rule of the spec. One threshold serves every class, and the spec already states it.
    • Rejected: Add a second threshold for passthrough_candidate. It adds a second rule for the same count and breaks the spec.
  • How does a test give the ranking a registry entry for a group?: build_usage_error_report takes an optional keyword map from a tool path to its devops paths. The default derives the map from devops_cli.core.passthrough.REGISTRY at call time, so the two lists stay the same. A test passes a fixture map for a group with no entry, such as openspec. (best practice) [sources: src/devops_cli/core/passthrough.py, src/devops_cli/telemetry/usage_error_report.py]
    • Chosen: An optional keyword map derived from REGISTRY at call time. A test names a fixture group, and the default reads the real registry.
    • Rejected: A required map of PassthroughEntry objects. Each fixture entry needs nine fields, and the ranking reads paths only.
    • Rejected: Replace REGISTRY in the module with monkeypatch.setattr. A test would change a module constant, and no criterion would show the real registry.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7622, #7812

Activity

  1. added
    type/feature
    scope/telemetry
    source/agent
    status/new
    value/medium
    effort/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (8)

    Tools considered:

    Searches run:

    • CLI analytics rank unknown commands propose aliases tool, results: 5
    • open source CLI usage error telemetry suggest command aliases, results: 5
    • command-not-found handler suggest command from error history library, results: 5
    • thefuck correct mistyped console command github, results: 5
    • CLI telemetry collect unknown flags errors aggregate reports library, results: 5
    • suggest package for command not found zsh plugin, results: 5
    • github nvbn thefuck command correction tool, results: 5
    • open source CLI autocomplete spec suggest subcommands Fig, results: 5

    Sources:

  5. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  6. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  7. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  8. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  9. dan-petty commented on Nov 29, 2026

    @dan-petty
    OwnerAuthor

    Returning #6598: its acceptance criterion and Key Question 6 require reading query and body field names from an API route table delivered by #6597, but #6597 (, ) only defines entries for CLI pass-through commands (, , , , , , , , ) with zero API route table or query/body field mappings.

  10. added
    status/new
    and removed
    status/ready
    on Nov 29, 2026
  11. dan-petty commented on Nov 29, 2026

    @dan-petty
    OwnerAuthor

    Clarifying exact file and symbol evidence from #6597: src/devops_cli/core/passthrough.py (PassthroughEntry, REGISTRY) and docs/adr/0037-tool-commands-mirror-and-pass-through-options.md only define CLI tool pass-through entries (devops_paths, runner, mode, owned_options, refused_options, mcp_allowlist, run_cost, page_rule, timeout) for gh subcommands, with no API route table or query/body field mappings required by the API route field naming criterion of #6598.

  12. added
    status/ready
    and removed
    status/new
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  14. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  15. removed
    status/in-review
    on Nov 29, 2026
  16. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 22:09 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/telemetrysource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions