Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: TruncatedContextFields serializes as null instead of empty array
- Changed line 637 to use make([]string, 0, len(...)) to guarantee a non-nil slice that serializes as [] instead of null, matching the nil-context guard and other array fields.
Or push these changes by commenting:
@cursor push 36e7c44691
Preview (36e7c44691)
diff --git a/pkg/cmd/ci/diagnose.go b/pkg/cmd/ci/diagnose.go
--- a/pkg/cmd/ci/diagnose.go
+++ b/pkg/cmd/ci/diagnose.go
@@ -613,6 +613,8 @@
if context == nil {
return diagnoseContextJSON{TruncatedContextFields: []string{}}
}
+ truncatedFields := make([]string, 0, len(context.GetTruncatedContextFields()))
+ truncatedFields = append(truncatedFields, context.GetTruncatedContextFields()...)
return diagnoseContextJSON{
RunID: context.GetRunId(),
Repo: context.GetRepo(),
@@ -634,7 +636,7 @@
Attempt: context.GetAttempt(),
AttemptStatus: context.GetAttemptStatus(),
AttemptConclusion: context.GetAttemptConclusion(),
- TruncatedContextFields: append([]string(nil), context.GetTruncatedContextFields()...),
+ TruncatedContextFields: truncatedFields,
}
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 89f292c. Configure here.
| Attempt: context.GetAttempt(), | ||
| AttemptStatus: context.GetAttemptStatus(), | ||
| AttemptConclusion: context.GetAttemptConclusion(), | ||
| TruncatedContextFields: append([]string(nil), context.GetTruncatedContextFields()...), |
There was a problem hiding this comment.
TruncatedContextFields serializes as null instead of empty array
Low Severity
When context is non-nil but has no truncated fields, append([]string(nil), context.GetTruncatedContextFields()...) returns nil, which JSON-encodes as null. This contradicts the nil-context path at line 614, which explicitly returns []string{} (JSON []), and is inconsistent with every other array field in the JSON document (e.g. FailureGroups, RepresentativeAttempts, NextCommands) that uses make([]…, 0, …) to guarantee a non-nil slice. JSON consumers expecting a consistent [] for "no truncated fields" will see null in the common case.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 89f292c. Configure here.
89f292c to
3551bb9
Compare
3551bb9 to
180881c
Compare
b1fd5bb to
8624f9c
Compare
8624f9c to
8ebec37
Compare



Summary
The CLI keeps the human command as
depot ci diagnose: pass a failed run, workflow, job, or attempt id and it renders the API'sFailureDiagnosisresponse into a readable triage summary.What was happening
Users could get logs and summaries, but the CLI did not have a first-class way to ask which failure mattered. Matrix jobs made that worse because several attempts could fail or cancel for the same underlying reason, and repeating every representative drill-down again in a footer made large diagnoses noisy.
What happens now
depot ci diagnose <id>with automatic target resolution and--output json.--type run|workflow|job|attemptdisambiguation flag for rare ID collisions.depot ci logs/depot ci summarycommands.Next commandsfooter; text output keeps those commands under the representative attempt where they are useful.Showing 3 of 7 similar attempts for this group.so bounded output looks intentional instead of incomplete.Sample Response
Validation
make generatego test ./pkg/cmd/ci ./pkg/apigo test ./pkg/cmd/ci -run Diagnosego test ./pkg/cmd/cigo test ./...git diff --checkgo build -o bin/depot-dev ./cmd/depotmake bin/depotDEPOT_API_URL=http://localhost:18080 ./bin/depot ci diagnose h5753524rz --org cl0wyyk6k39487ebgraxasinjaDEPOT_API_URL=http://127.0.0.1:18080 ./bin/depot-dev ci diagnose cvhm9dnf32:next_commands=0,logs=13,summaries=0Depends on https://github.com/depot/api/pull/3656.
Linear: https://linear.app/depot/issue/DEP-4264/ci-diagnose-failure-triage-for-runs-workflows-jobs-and-attempts
Note
Medium Risk
Adds a new user-facing CLI command and a new CI API wrapper around
GetFailureDiagnosis, with substantial output-formatting logic that could affect UX and error handling. Risk is moderate since it doesn’t touch auth flows beyond reusing existing token/org headers, but introduces new RPC usage and rendering paths.Overview
Adds a new
depot ci diagnose <id>subcommand that calls a newCIGetFailureDiagnosiswrapper (Connect RPC) to retrieve bounded failure diagnosis data for runs/workflows/jobs/attempts.The command renders a human-readable triage summary (grouped failures, representative attempts, evidence lines, and follow-up
logs/summarydrill-down commands with optional--org) and also supports--output jsonwith CLI-normalized enum strings.Includes new tests covering the API wrapper, command registration, and key rendering behaviors (empty/over-limit/focused states, omission/truncation messaging, and hiding unavailable summary commands).
Reviewed by Cursor Bugbot for commit e6c1cad. Bugbot is set up for automated code reviews on this repo. Configure here.