Trace anomalies for stall diagnosis: design doc + --json on inspect trace anomalies/http#83
Trace anomalies for stall diagnosis: design doc + --json on inspect trace anomalies/http#83i-am-marvin wants to merge 6 commits into
--json on inspect trace anomalies/http#83Conversation
Designs the affordances requested in issue #81: --json on `inspect trace anomalies`, an `inspect ctl process anomalies` verb (client-side trace-file read, deliberately no HTTP endpoint so it works against a wedged process), and stall-site pointers. Design only — no implementation. Co-authored-by: Ransom Richardson <1209015+ransomr@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review summaryDocs-only PR adding a "Trace-log anomalies for stall diagnosis (planned)" section to Verified accurate against the code (
Nits (both non-blocking, inline):
The design decisions themselves (client-side file read with no HTTP endpoint, one shared reconstruction, process-noun placement, stall-site pointers) are well argued and consistent with the doc's existing conventions. No CHANGELOG entry is correct for a design-doc-only change. If you'd like these nits addressed by the dev agent, reply with a top-level |
|
🔎 Review complete. |
…otting - ctl process anomalies mirrors every inspect trace anomalies flag (--filter included) via a shared click decorator so they can't drift - Resolve the dead-pid open question: fall back to trace-<pid>.log or .log.gz for post-mortem reads; fix the rotation-vs-gzip conflation - Slot the work into phase 3 (current phase), --json first; remove the post-phase-4 deferral and add the verb to the CLI listings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@auto implement the first part of this design - adding --json to trace anomalies |
|
Claude finished @ransomr's task in 11m 12s —— View job Implemented:
|
First slice of the trace-log anomalies design (issue #81): both commands emit `{trace_file, as_of, ...}` envelopes per the agent output contract. Anomalies buckets (running/cancelled/errors/timeouts) are always present, rows are `{action, detail, start_time, duration, error?}` with running durations computed against `as_of`. Flags live in a shared `anomalies_options` decorator and the reconstruction in a shared `_trace_anomalies` function, ready for the planned `inspect ctl process anomalies` to reuse. Co-authored-by: Ransom Richardson <1209015+ransomr@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review summaryThis round reviews the newly implemented slice (commit 0ef100d): Verified:
Findings (both non-blocking, posted inline):
Pre-existing issue, not introduced here (no action required): If you would like the nits addressed by the dev agent, reply with a top-level |
|
🔎 Review complete. |
|
🤖 auto review rounds: 1 (cap 10). |
…crash - `inspect trace anomalies --json` now always populates the errors/timeouts buckets so an empty list always means "none occurred"; --all gates only the human rendering (design doc updated to match) - fix "anomolies" typo in the shared --all help text and rename the internal anomolies_command* functions - tolerate exit-side action records with no matching enter record (e.g. --filter matching only the exit side, or a truncated log) instead of crashing with RuntimeError Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review summaryThis round reviews commit 63b67f3 (the response to the previous round): always-populated JSON buckets, the Verified:
No outstanding suggestions — the shared |
|
🔎 Review complete — no outstanding suggestions. |
|
🤖 auto: the reviewer has no outstanding feedback — this PR has converged. auto never takes the final step (merge, or upstream promotion on the fork), so it's yours now; see the checks above for CI status. The |
--json on inspect trace anomalies/http
|
Superseded by the upstream PR: UKGovernmentBEIS#4524 (now the system of record). |
This PR contains:
What is the current behavior? (You can also link to an open issue here)
Refs #81 (the issue stays open for the remaining slices).
design/control-channel.mdhas no coverage of the trace log /inspect trace anomaliescontent, even though field use (per JJ) showed that telling the LLM agent about trace anomalies — what, if anything, is still running or hung — is a valuable part of the live-eval diagnosis loop. Todayinspect trace anomaliesandinspect trace httpemit only styled Rich tables (the worst case for an agent parser), nothing ininspect ctljoins to the trace subsystem, andanomalies --filtercrashes with aRuntimeErrorwhen the filter matches an action's completion record but not its start record.What is the new behavior?
Design doc. Adds a "Trace-log anomalies for stall diagnosis" section to
design/control-channel.md(slotted into phase 3, since it needs no server changes), designing:--jsononinspect trace anomaliesandhttp(implemented in this PR — see below).inspect ctl process anomalies [PID] [--filter TEXT] [--all] [--json]— a client-side trace-file read (deliberately no HTTP endpoint, so it works against exactly the busy/hung process it exists to diagnose), placed in theprocessnoun group since trace records carry no task/sample identity, with a dead-pid post-mortem fallback totrace-<pid>.log[.gz].sample show.Implementation (first slice).
--jsonon both commands:inspect trace anomalies --jsonemits a{trace_file, as_of, running, cancelled, errors, timeouts}envelope with per-action rows{action, detail, start_time, duration, error?};runningdurations are computed against the envelope'sas_of. All four buckets are always populated —--allgates only the human table — so an empty list always means "none occurred", never "not collected".inspect trace http --jsonemits a{trace_file, as_of, requests}envelope.--filter/--all/--json) are defined once as a shared click decorator, so the plannedctl process anomaliesmirrors them structurally rather than by convention.TraceAnomaliesNamedTuple (one reconstruction, two renderings), fixing the misspelledanomolies_*names along the way.anomalies --filterno longer raises when a completion record matches the filter but its start record doesn't (orphan completions are now skipped).Covered by new CLI tests (
tests/cli/test_cli_trace.py) and two CHANGELOG entries.Still to come (tracked in #81):
inspect ctl process anomaliesand the stall-site pointers.Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.
Other information:
None.
🤖 Generated with Claude Code