From c168b9759148dc35d2e28fc92533016ebbb09b5d Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Wed, 11 Nov 2026 06:19:11 +0000 Subject: [PATCH 1/2] fix(roadmap): explain --trace shows the argument digest The line of a tool event in devops roadmap explain --trace shows the digest of the argument of the call, so a reader sees a repeated call. A tool event with no digest shows no argument part. --- docs/roadmap/implement.md | 2 +- .../.openspec.yaml | 3 ++ .../design.md | 12 ++++++ .../proposal.md | 40 +++++++++++++++++++ .../specs/roadmap-explain/spec.md | 12 ++++++ .../tasks.md | 21 ++++++++++ src/devops_cli/lang/en/messages.py | 3 +- src/devops_cli/roadmap/explain.py | 2 + tests/roadmap/test_roadmap_explain.py | 21 ++++++++-- 9 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml create mode 100644 openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md create mode 100644 openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md create mode 100644 openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md create mode 100644 openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md diff --git a/docs/roadmap/implement.md b/docs/roadmap/implement.md index ec27f08eec..47ea1d011f 100644 --- a/docs/roadmap/implement.md +++ b/docs/roadmap/implement.md @@ -77,7 +77,7 @@ The job never merges. [Checks of the implement job](../ROADMAP_WORKFLOW.md#check **A moved HEAD.** The shell of the agent allows `git`, so the agent can commit. A step makes the only commit, so before its exit checks the step resets a head that the agent moved with `git reset --soft`, to the start commit or to the last `wip:` commit. The reset keeps the work in the checkout, prints one line that names the moved head and the expected head, and the checks judge the work (#3575). The step stops with the class `head_moved` only when the reset fails. -**A stop.** A step that fails stops the item. The job comments why, shows a table of the steps (the step, its attempts, its tokens in and out, and its last failing command), shows the masked diff of the discarded work, and sets the Status to Blocked. The job keeps the trace of its run in `implement.trace`: each model call, tool call, check and retry, in the order of the run, with no argument, no output, no secret and no private host name. A shell call holds the exit status of its command. When a long run does not fit the bound of the trace, the trace drops the oldest model events first, then the oldest of the other events, and counts them in `dropped`. The tool calls, checks, retries and attempts show what the run did, and `implement.spend` keeps the tokens of the run. Read it with `devops roadmap explain --trace`. The job keeps no Job artifact. Before the push of a stop, the job drops the files that no commit holds, such as the files of an archive that failed after it moved the change folder, so the rebase of the push finds a clean checkout. The Service runs the item again after the comment `implement: retry`. For a stop whose class a new attempt can fix, it runs the item again with no comment. This happens after a Job that ended with no result, up to `roadmap.implement.continuations_per_item` times (default 2). It also happens after a new runner image, within the limits of `roadmap.implement.digest_clears_per_class` and `roadmap.implement.digest_clears_per_item`. +**A stop.** A step that fails stops the item. The job comments why, shows a table of the steps (the step, its attempts, its tokens in and out, and its last failing command), shows the masked diff of the discarded work, and sets the Status to Blocked. The job keeps the trace of its run in `implement.trace`: each model call, tool call, check and retry, in the order of the run, with no argument, no output, no secret and no private host name. A tool call holds the digest of its argument, so a reader sees a repeated call, and a shell call holds the exit status of its command. When a long run does not fit the bound of the trace, the trace drops the oldest model events first, then the oldest of the other events, and counts them in `dropped`. The tool calls, checks, retries and attempts show what the run did, and `implement.spend` keeps the tokens of the run. Read it with `devops roadmap explain --trace`. The job keeps no Job artifact. Before the push of a stop, the job drops the files that no commit holds, such as the files of an archive that failed after it moved the change folder, so the rebase of the push finds a clean checkout. The Service runs the item again after the comment `implement: retry`. For a stop whose class a new attempt can fix, it runs the item again with no comment. This happens after a Job that ended with no result, up to `roadmap.implement.continuations_per_item` times (default 2). It also happens after a new runner image, within the limits of `roadmap.implement.digest_clears_per_class` and `roadmap.implement.digest_clears_per_item`. **The premise of a behavior group.** Before a behavior group starts, the job checks its premise at the branch tip. It reads each task of the group that has an add verb, the word guard or check, and one name in a code span. When the branch tip defines that name, the job returns the item to New. The comment holds the task and the definition line. The job runs no step and makes no model request. It first takes back the checkpoints that it pushed (see Checkpoints). The check uses the same definition lookup as the premise check of the stage job (`src/devops_cli/roadmap/premise.py`). It reads the last commit that is not a `wip:` commit, so a guard that an earlier attempt of the same group kept is no defect. A group of another kind gets no check. diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml b/openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml new file mode 100644 index 0000000000..9d55295e5d --- /dev/null +++ b/openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-11-11 +skip_specs: false diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md b/openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md new file mode 100644 index 0000000000..0a67a24574 --- /dev/null +++ b/openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md @@ -0,0 +1,12 @@ +# Design + +## Decisions + +- The digest goes after the program and before the outcome, in square brackets: `tool shell (program git) [argument abc123abc123], ok`. The digest names the call, so it stands with the tool and the program. The outcome, the exit status and the reason stay at the end, as before. +- The word `argument` tells the reader what the hexadecimal value is. The value is the digest of the masked argument, not the argument. +- The part is empty when the event holds no digest, the same as the program part. An old trace or a hand-made trace with no digest still prints. + +## Rejected alternatives + +- Change the requirement "The trace option prints the trace of the last run". Its text is near the 500-character limit of `openspec validate --strict`, so a new requirement holds the digest. +- Show only the first characters of the digest. The digest is already 12 characters, and a shorter value makes two different calls look the same. diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md b/openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md new file mode 100644 index 0000000000..8ce15c11b6 --- /dev/null +++ b/openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md @@ -0,0 +1,40 @@ +# Proposal: #4444 + +## Why + +`devops roadmap explain --trace` does not show the digest of the argument of a tool call. The `tool` event in `implement.trace` holds the digest in the field `digest`, but `_event_line` in `src/devops_cli/roadmap/explain.py` does not read it. So a reader cannot see that the model made the same call two or more times. Issue #4393 asked for this in its criterion "Render tool and check details", and pull request #4436 did not deliver it. Closes #4444. + +## What Changes + +- The line of a `tool` event shows the digest of its argument after the program, for example `group 1: tool shell (program git) [argument abc123abc123], ok (exit status 0)`. +- A `tool` event with no digest shows no argument part, so a trace from before the digest still prints. +- The text of the part is `explain_trace_tool_digest` in `RoadmapMessages`. + +The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `roadmap-explain`: The trace option prints the argument digest of a tool call (added) + +## Impact + +- Code: `src/devops_cli/roadmap/explain.py`, `src/devops_cli/lang/en/messages.py` +- Tests: `tests/roadmap/test_roadmap_explain.py` +- Specs: `openspec/specs/roadmap-explain/spec.md` +- Documents: `docs/roadmap/implement.md` +- The trace keeps the same fields and the same bound. The digest is 12 hexadecimal characters of the SHA-256 of the masked argument, so the line shows no argument and no secret. + +## Feasibility + +- Source on `main`: `ImplementTrace.tool_call` in `src/devops_cli/roadmap/implement/implement_trace.py` keeps the digest in the field `digest`. The `TraceEventKind.TOOL` case of `_event_line` reads `tool`, `program`, `outcome`, `status` and `reason`, and not `digest`. `explain_trace_tool` is `"{step}: tool {tool}{program}, {outcome}{status}{reason}"`. +- Test output on the base: the two changed tests of `tests/roadmap/test_roadmap_explain.py` fail with `'group 1: tool shell (program git), ok (exit status 128)' != 'group 1: tool shell (program git) [argument abc123abc123], ok (exit status 128)'`. + +## Existing Tool Considered + +No tool applies: the change is one field in a line of text that the project owns. Cost to build: about 10k tokens and 30 minutes. diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md b/openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md new file mode 100644 index 0000000000..3621d150e3 --- /dev/null +++ b/openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md @@ -0,0 +1,12 @@ +## ADDED Requirements + +### Requirement: The trace option prints the argument digest of a tool call +`explain --trace` SHALL show in the line of a `tool` event the digest of its argument, when the event holds one, so that a reader sees a repeated call. A `tool` event with no digest SHALL show no argument part. + +#### Scenario: The same call twice +- **WHEN** the trace holds two `tool` events with the digest `abc123abc123` +- **THEN** each line says `[argument abc123abc123]` + +#### Scenario: A tool call with no digest +- **WHEN** a `tool` event holds no digest +- **THEN** its line has no argument part diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md b/openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md new file mode 100644 index 0000000000..659f0beaba --- /dev/null +++ b/openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md @@ -0,0 +1,21 @@ +# Tasks + +## 1. Behavior + +Reads: `src/devops_cli/roadmap/explain.py`, `src/devops_cli/roadmap/implement/implement_trace.py`, `tests/roadmap/test_roadmap_explain.py`. Changes: `src/devops_cli/roadmap/explain.py`, `src/devops_cli/lang/en/messages.py`, `tests/roadmap/test_roadmap_explain.py`. + +- [x] 1.1 Add the tests: the line of a tool call shows `[argument ]` after the program, two calls with the same digest show the same digest, and a tool event with no digest shows no argument part. They fail on the base. + - Verification: `$ uv run devops ci test tests/roadmap/test_roadmap_explain.py` +- [x] 1.2 Add `explain_trace_tool_digest` to `RoadmapMessages`, put `{digest}` after `{program}` in `explain_trace_tool`, and fill it from the `digest` field in `_event_line` + - Verification: `$ uv run devops ci test tests/roadmap/test_roadmap_explain.py` + +## 2. Documents + +Reads: `docs/roadmap/implement.md`. Changes: `docs/roadmap/implement.md`. + +- [x] 2.1 Say in `docs/roadmap/implement.md` that a tool call in the trace holds the digest of its argument, so a reader sees a repeated call + - Verification: `$ uv run devops ci docs` + +## Criteria + +- Group 1: The line of a tool event in `explain --trace` shows the digest of its argument when the event holds one, and no argument part when it holds none. diff --git a/src/devops_cli/lang/en/messages.py b/src/devops_cli/lang/en/messages.py index 1c52498786..40d67f051b 100644 --- a/src/devops_cli/lang/en/messages.py +++ b/src/devops_cli/lang/en/messages.py @@ -2267,9 +2267,10 @@ class RoadmapMessages: # The report of `devops roadmap explain --trace` (#3032). explain_trace_none: str = "Issue #{number} has no trace of a run." explain_trace_model: str = "{step}: model {model}, {tokens_in}/{tokens_out} tokens, {seconds} s" - explain_trace_tool: str = "{step}: tool {tool}{program}, {outcome}{status}{reason}" + explain_trace_tool: str = "{step}: tool {tool}{program}{digest}, {outcome}{status}{reason}" explain_trace_tool_status: str = " (exit status {status})" explain_trace_tool_program: str = " (program {program})" + explain_trace_tool_digest: str = " [argument {digest}]" explain_trace_tool_reason: str = ": {reason}" explain_trace_check: str = "{step}: check {command}, {result}" explain_trace_check_status: str = "exit status {status}" diff --git a/src/devops_cli/roadmap/explain.py b/src/devops_cli/roadmap/explain.py index 9b7c845ba6..887652d015 100644 --- a/src/devops_cli/roadmap/explain.py +++ b/src/devops_cli/roadmap/explain.py @@ -377,12 +377,14 @@ def _event_line(event: TraceEvent) -> str: ) case TraceEventKind.TOOL: program = fields.get("program") + digest = fields.get("digest") reason = fields.get("reason") status = fields.get("status") return texts.explain_trace_tool.format( step=step, tool=fields.get("tool", ""), program=texts.explain_trace_tool_program.format(program=program) if program else "", + digest=texts.explain_trace_tool_digest.format(digest=digest) if digest else "", outcome=fields.get("outcome", ""), status=( texts.explain_trace_tool_status.format(status=status) diff --git a/tests/roadmap/test_roadmap_explain.py b/tests/roadmap/test_roadmap_explain.py index 4efa8cc90f..dce1dcac3b 100644 --- a/tests/roadmap/test_roadmap_explain.py +++ b/tests/roadmap/test_roadmap_explain.py @@ -471,12 +471,14 @@ def test_the_trace_of_an_item_gives_one_line_for_each_event_in_order(job_world: lines = report.splitlines() assert len(lines) == 3 assert lines[0] == "group 1: model model-a, 100/20 tokens, 1.5 s" - assert lines[1] == "group 1: tool shell (program ruff), refused" + assert lines[1] == "group 1: tool shell (program ruff) [argument abc123abc123], refused" assert lines[2] == "group 1: check ruff check ., exit status 1" assert (job_world.store.job_writes, job_world.store.comments_on(number)) == before def test_a_shell_call_with_an_exit_status_shows_it_in_the_line(job_world: JobWorld) -> None: + """#4393: the line of a tool call shows the digest of its argument, so a reader sees that the + model made the same call twice, and the exit status of a shell call.""" number = _seed(job_world) trace = ImplementTrace(step="group 1") trace.tool_call("shell", "git", "abc123abc123", "ok", status=128) @@ -486,11 +488,24 @@ def test_a_shell_call_with_an_exit_status_shows_it_in_the_line(job_world: JobWor report = render_trace(read_trace(job_world.store, number), number=number) assert report.splitlines() == [ - "group 1: tool shell (program git), ok (exit status 128)", - "group 1: tool shell (program git), ok (exit status 0)", + "group 1: tool shell (program git) [argument abc123abc123], ok (exit status 128)", + "group 1: tool shell (program git) [argument abc123abc123], ok (exit status 0)", ] +def test_a_tool_call_with_no_digest_shows_no_argument(job_world: JobWorld) -> None: + number = _seed(job_world) + _record_trace( + job_world, + number, + '{"events":[{"kind":"tool","step":"g","tool":"edit_file","outcome":"ok"}],"dropped":0}', + ) + + report = render_trace(read_trace(job_world.store, number), number=number) + + assert report.splitlines() == ["g: tool edit_file, ok"] + + def test_the_trace_says_how_many_earlier_events_the_bound_dropped(job_world: JobWorld) -> None: number = _seed(job_world) _record_trace(job_world, number, '{"events":[],"dropped":12}') From e771d30890645c4fc2f189cce4a0abd8fa703848 Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Wed, 11 Nov 2026 06:27:09 +0000 Subject: [PATCH 2/2] docs(openspec): archive 4444-explain-trace-shows-the-argument-digest --- .../.openspec.yaml | 0 .../design.md | 0 .../proposal.md | 0 .../specs/roadmap-explain/spec.md | 0 .../tasks.md | 0 openspec/specs/roadmap-explain/spec.md | 11 +++++++++++ 6 files changed, 11 insertions(+) rename openspec/changes/{4444-explain-trace-shows-the-argument-digest => archive/2026-11-11-4444-explain-trace-shows-the-argument-digest}/.openspec.yaml (100%) rename openspec/changes/{4444-explain-trace-shows-the-argument-digest => archive/2026-11-11-4444-explain-trace-shows-the-argument-digest}/design.md (100%) rename openspec/changes/{4444-explain-trace-shows-the-argument-digest => archive/2026-11-11-4444-explain-trace-shows-the-argument-digest}/proposal.md (100%) rename openspec/changes/{4444-explain-trace-shows-the-argument-digest => archive/2026-11-11-4444-explain-trace-shows-the-argument-digest}/specs/roadmap-explain/spec.md (100%) rename openspec/changes/{4444-explain-trace-shows-the-argument-digest => archive/2026-11-11-4444-explain-trace-shows-the-argument-digest}/tasks.md (100%) diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml b/openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/.openspec.yaml similarity index 100% rename from openspec/changes/4444-explain-trace-shows-the-argument-digest/.openspec.yaml rename to openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/.openspec.yaml diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md b/openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/design.md similarity index 100% rename from openspec/changes/4444-explain-trace-shows-the-argument-digest/design.md rename to openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/design.md diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md b/openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/proposal.md similarity index 100% rename from openspec/changes/4444-explain-trace-shows-the-argument-digest/proposal.md rename to openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/proposal.md diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md b/openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md similarity index 100% rename from openspec/changes/4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md rename to openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/specs/roadmap-explain/spec.md diff --git a/openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md b/openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/tasks.md similarity index 100% rename from openspec/changes/4444-explain-trace-shows-the-argument-digest/tasks.md rename to openspec/changes/archive/2026-11-11-4444-explain-trace-shows-the-argument-digest/tasks.md diff --git a/openspec/specs/roadmap-explain/spec.md b/openspec/specs/roadmap-explain/spec.md index f7c808262c..ee1e5a1b2f 100644 --- a/openspec/specs/roadmap-explain/spec.md +++ b/openspec/specs/roadmap-explain/spec.md @@ -212,3 +212,14 @@ For a New item whose job record holds `refine.failed_at` younger than the wait o #### Scenario: A held item - **WHEN** a New item's refine round failed with a `provider` error at 12:00 UTC and the clock reads 12:10 - **THEN** the refine job is `no` and the reason names 13:00 + +### Requirement: The trace option prints the argument digest of a tool call +`explain --trace` SHALL show in the line of a `tool` event the digest of its argument, when the event holds one, so that a reader sees a repeated call. A `tool` event with no digest SHALL show no argument part. + +#### Scenario: The same call twice +- **WHEN** the trace holds two `tool` events with the digest `abc123abc123` +- **THEN** each line says `[argument abc123abc123]` + +#### Scenario: A tool call with no digest +- **WHEN** a `tool` event holds no digest +- **THEN** its line has no argument part