Repository navigation
Separate CLI usage failures from error issues with concrete causes - #142
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | f4bc16a | Nov 20 2026, 02:13 PM |
…oss releases Without a credential store, Unix logins fall back to the private session file, so a missing session there means no login rather than a store failure. Group CLI exceptions by source file instead of line and column, so one failure keeps its issue when unrelated edits shift lines.
Without a session file and credential store, the CLI cannot tell whether a login never happened or sits in a store that is now unreachable. Keep both out of error tracking, since neither is a CLI defect, but give them their own usage code so they are not counted as missing logins.
The API now answers unknown routes with ROUTE_NOT_FOUND and requests that fail contract validation with INVALID_REQUEST, so they no longer share NOT_FOUND and BAD_REQUEST with domain decisions on user input. The CLI reads the code from error responses. 4xx rejections with a server code are usage outcomes and report the code in telemetry; contract mismatches, unknown routes and 4xx responses without a server code, such as proxy pages, remain error issues.
Read code, message, error_description and error independently, so a numeric or object-valued field no longer discards the whole error body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLI error tracking currently groups unrelated failures under “Widefleet CLI error” and marks returned errors as unhandled. Give failures safe, command-specific titles and structured causes, and keep known usage/configuration outcomes measurable without creating exception issues.
Attach concrete causes at the failure site: missing login/configuration, invalid scopes and inputs, denied/expired login, credential-store failures, corrupt sessions, incomplete OAuth credentials, and deployment/protocol failures. Preserve the original terminal message and source location; outer operation context cannot overwrite a more specific cause.
Known usage/configuration failures emit only
cli_command_completed, withoutcome: failed,error_category: usageand a specificerror_code. This retains signals for documentation and UX improvements without filling error tracking with warning issues.Explicitly interrupted deployment waits (Ctrl+C) emit
outcome: cancelledand their cancellation code, with no exception. Successful commands remainoutcome: succeeded. Command metrics can therefore distinguish usage failures, technical failures and cancellations; error rates can use failed / (succeeded + failed), grouped by command and CLI version, with cancellations reported separately.Technical failures, panics and unclassified
Invalid,Credentials, I/O and HTTP 4xx failures remain error-level exceptions. A broad error kind or status alone does not establish an expected outcome. Both API parsing and reqwesterror_for_status()retain HTTP status information.Classify API rejections by the server's error code instead of the status alone. The API now answers unknown routes with
ROUTE_NOT_FOUNDand contract validation failures withINVALID_REQUEST, so these no longer shareNOT_FOUNDandBAD_REQUESTwith domain decisions on user input. 4xx responses with another server code are usage outcomes and report the code asapi_error_code; unknown routes, contract mismatches and 4xx responses without a server code, such as proxy pages, remain exceptions.Without a session file and a reachable credential store, report
session_unreachableas a usage outcome: the CLI cannot tell a missing login from an unreachable store there, and neither is a CLI defect.Group exceptions by source file rather than line and column, so a failure keeps its issue across releases.
Distinguish handled returned errors from unhandled panics, group by command/cause/status/source, and remove fabricated
<unknown>function and resolved-frame fields. Send only fixed summaries and safe metadata, never raw error messages, response bodies, private paths or credentials. Preserve the shared agent report format.Honor independent usage/crash opt-outs: usage-only failures are not sent when usage reporting is disabled, even if crash reporting remains enabled. Technical and unknown exceptions follow the crash preference independently.
Use the shared service-documentation crate from the CLI blocking task, keeping file reads and type analysis off the async executor while preserving panic propagation and the deterministic executor-progress regression. This lets HTTP connection cleanup proceed during analysis.
Validation on the updated branch:
cargo test --locked --workspace: 90 tests passed.mainand remain intact after the merge.Reporting changes take effect after installing an updated CLI. Existing issue history is not rewritten.


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues remain.Summary
The PR separates known usage failures and cancellations from technical errors while keeping terminal messages and safe reporting details.
Reviews (18) · Last reviewed commit: "Keep API error messages when a gateway s..." · Reviewed by Greptile