Skip to content

fix(telemetry): a usage error records its error class, never the argument text, and counts as a failed command #2024

Closed

Description

@dan-petty

Friction

A usage error can send an argument value to the trace backend. Click's message, for example Got unexpected extra argument (<value>), goes into the span's error.message through the tracer's generic exception handling. #1996 removed cli.args and process.command_line, and this path is left.

Also, except click.ClickException in _delegate (src/devops_cli/main.py) never catches Typer 0.27's errors. Typer vendors its own Click, and typer._click.exceptions.UsageError is not a subclass of click.ClickException. So a usage error records no devops_cli_command_total with status error.

Evidence

Found while #1996 was built. Its task file names this follow-up.

Proposed remedy

  • Catch the vendored typer._click.exceptions.ClickException in _delegate, and record the error class and exit code on the span, never the message.
  • Keep Typer's own error output for the person. A test with an unexpected extra argument checks that no exported attribute holds the argument and that the error counter counts it.

Activity

  1. added
    source/agent
    type/bug
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/bug. The candidate fixes an error in how usage errors are handled and reported.
    • Priority: P2-Medium. The issue affects how telemetry records usage errors but does not break core functionality.
    • Value: Medium. Fixing the error recording improves debugging and telemetry accuracy for users.
    • Effort: Low. The fix involves catching a specific exception type and adjusting error reporting logic.
    • Related: refactor(cli): exceptions carry their codes as class data, and one exit seam replaces 19 hand-rolled exits #1006, which asks for a different change. Both items deal with exceptions but the candidate focuses on usage errors and telemetry while item 1006 refactors exception classes and error handling.
  3. added 2 commits that reference this issue on Oct 24, 2026
    8caad6c
    53c9106
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

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions