| 1 | # Turn results |
| 2 | |
| 3 | [简体中文](TURN_RESULTS.zh-CN.md) |
| 4 | |
| 5 | After a turn changes files or records checks, Desktop shows **Turn result** |
| 6 | below the answer. It reports two independent facts: confirmed net file changes |
| 7 | and recorded check outcomes. A passing check is not an overall completion grade. |
| 8 | |
| 9 | - **View changes** opens that turn's frozen diff. Repeated edits to a file count |
| 10 | once, relative to its first captured state in that turn. Changes restored to |
| 11 | their original content contribute zero lines. Existing dirty work is part of |
| 12 | the baseline, not attributed to the agent. |
| 13 | - **View check details** shows recorded commands, exit codes, stale/interrupted |
| 14 | outcomes, and expandable logs. **Checking…** only appears for a host-identified |
| 15 | check that has actually entered execution. |
| 16 | - **All current workspace changes** returns to the existing workspace view. |
| 17 | That view can include other turns and edits made outside Reasonix. |
| 18 | |
| 19 | These controls inspect results. They do not run, retry, or schedule commands, |
| 20 | and require no new setting. |
| 21 | |
| 22 | ## Coverage and history |
| 23 | |
| 24 | **Partial statistics** means the snapshot observer cannot reliably attribute all |
| 25 | changes to this turn, or content exceeded the bounded capture/diff budget. |
| 26 | Confirmed counts remain visible; unknown changes are not guessed from Git HEAD, |
| 27 | tool-call counts, or the number of mutation receipts. |
| 28 | |
| 29 | Binary changes and mode-only changes have file entries without invented line |
| 30 | counts. Uncounted large changes and unavailable patch details are labelled. |
| 31 | Moves use the paths recorded by the existing capture mechanism; the result view |
| 32 | does not infer renames. |
| 33 | |
| 34 | A historical card keeps its recorded statistics. Opening it never recalculates |
| 35 | the diff against today's disk contents. If checkpoint details were pruned, the |
| 36 | card retains its summary and explains that the detail is unavailable. Old |
| 37 | sessions without result metadata show unavailable statistics and incomplete |
| 38 | check information, rather than zero changes or an implied pass. |
| 39 | |
| 40 | Logs are read from existing local session messages, using both the provider call |
| 41 | ID and the stable local result-message ID captured at turn completion. Reused |
| 42 | provider IDs cannot redirect an older card to a newer log. Ambiguous, absent, |
| 43 | or cleared sources are explicitly unavailable. Display is capped at 2 MiB, with |
| 44 | a truncation notice when only the tail fits. |
| 45 | |
| 46 | ## Implementation contract |
| 47 | |
| 48 | The host adds optional fields to the existing `turn_done.receipt`: |
| 49 | |
| 50 | - `diff`: checkpoint turn, immutable result ID, coverage, files, and exact |
| 51 | added/removed line totals. Event/history summaries omit patches. |
| 52 | - Per-check `toolCallId`, `toolResultId`, `exitCode`, and `interrupted`. |
| 53 | Existing command classification and completion policy remain authoritative. |
| 54 | - `tool_progress.tool.verifying`: a host-only execution signal, with no |
| 55 | additional model-facing tool or prompt. |
| 56 | |
| 57 | The checkpoint store freezes results while turn admission is closed, using its |
| 58 | existing nonblocking mutation barrier and validating post-write fingerprints. |
| 59 | Each turn has a 2 MiB content/patch processing budget. Approximate diff-engine |
| 60 | fallback counts are never reported as exact. Results share checkpoint retention; |
| 61 | patch metadata is included in the disk budget. |
| 62 | |
| 63 | Desktop reuses its existing display sidecar and durable event replay. The |
| 64 | transcript's common turn projection places result cards after answers and keeps |
| 65 | their mounted IDs stable. Session/tab/result keys fence delayed diff and log |
| 66 | responses. Provider prompts, tool schemas, and execution permissions are unchanged. |
| 67 | |
| 68 | ## Verification |
| 69 | |
| 70 | Regression tests cover net repeated edits, no-ops, pre-existing dirty files, |
| 71 | deletion, binary/mode changes, active and external writers, size limits, reopen, |
| 72 | old readers, cancellation/error terminal publication, check exit codes, stable |
| 73 | log identity, display-sidecar replay, duplicate result updates, concurrent |
| 74 | checks, and delayed responses after session replacement. |
| 75 | |
| 76 | For a browser check, run `pnpm dev` in `desktop/frontend`, then open |
| 77 | `/bench/turn-result.html` at the URL printed by Vite. This fixture uses the real |
| 78 | Transcript, reducer, result panel, and diff renderer with mocked execution data. |
| 79 | It provides success, failure, no-check, stale, interrupted, running, partial, |
| 80 | legacy, and historical scenes, plus theme/width and cleared-data controls. |
| 81 | Use `?transcriptRenderMode=windowed` to exercise the shared window adapter. |
| 82 | |
| 83 | Browser screenshots from this fixture are UI evidence; controller/checkpoint |
| 84 | tests separately prove real storage and ownership behavior. |
| 85 |