Skip to content

A dispatch describes what its workspace actually changed (#3236) - #3704

Merged
si-agents-bot[bot] merged 6 commits into
mainfrom
3236-describe-workspace-change
Nov 27, 2026
Merged

si-agents-bot[bot] merged 6 commits into
mainfrom
3236-describe-workspace-change

Conversation

@si-agents-bot

@si-agents-bot si-agents-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3236.

What broke: a coder dispatch whose model claimed a fix it never made still ended stop with exit 0. Nothing recorded that the workspace was untouched. This happened in 10 of 12 runs in the 2026-10-14 gate.

Decided with the operator ("describe the change"): a dispatch always records what its workspace actually changed. darkmux never parses the model's claim and never changes the result. Decisions are recorded on the issue.

What ships:

  • WorkspaceChanges (flow 2.10.0): method (git or snapshot), files_changed, not_measured, lines_added, lines_removed, excluded.
    • It's carried on dispatch.complete and dispatch.error as counts only. The type has no field that could hold a path.
    • The dispatch envelope also carries files, capped at 100, plus files_omitted.
    • 0 means it was measured and nothing changed. null plus not_measured means the workspace couldn't be read. A missing block means no workspace was read.
    • A line total is null unless every changed file's lines were measured.
    • excluded names what the measure skipped (the snapshot's skipped directories, or git-ignored / nested-repositories), so "no changes" never overclaims.
  • Measuring:
    • Git path: only for a --workdir whose .git the run cannot write. It uses a scratch index seeded from the repo's own and a scratch object store with the repo as an alternate, so the repository is only read. A repo whose config defines a filter driver falls back to the snapshot.
    • Snapshot path (BLAKE3) everywhere else. These are the existing lab workspace_delta and serve client git-snapshot mechanisms, moved into darkmux-crew (git mv), not copied. Lab and serve re-export under their old paths.
    • When it runs: the baseline is taken right before the sandbox launches, and the measure after the wait, on the clean, killed and wait-error branches.
  • Surfaces:
    • the envelope
    • run stats (text line and --json), with run stats 2.6.0
    • the viewer's dispatch page, as a changes row: "no changes outside dist/, target/", "2 files · +12 −3", "1 file · lines not measured" or "not measured: …"
    • The generated TS types, cli-json.golden and the bundle are regenerated.
  • Left for later: ACP, a mission rollup, a runs-board column, exact lines for coder worktrees (Coder-phase dispatches: exact workspace line counts (follow-up to #3236) #3702), and phase review counts 0 files changed when git fails #3703 (phase review's 0 for "not measured"). The CHANGELOG entry is deferred to the release PR.

Cost (after three review rounds: a fresh index, bounded filter-driver reads on every measuring call, a streamed gitlink scan):

Files Path Pre-run walk Post-run walk
10k Git ~0.8 s ~1.1 s
10k Snapshot ~0.67 s ~0.69 s
160k Git 7.2 s 7.3 s
160k Snapshot not measured: past the 50,000-file cap not measured

Git calls in measuring: every one is bounded under one deadline, the filter-driver read included, and no call spawns a child process on a hostile tree (round 2 traced 19 calls). The git path uses no --format, so it no longer needs git 2.36. It is only tested on 2.50.1.

Tests:

  • 12 behavior tests were written against a stub and seen failing at their predicted assertions. They cover a fresh tempdir, nothing changed, an unreadable workspace, git numstat with the repo left untouched, a dirty tree, binary files, the filter fallback, a modified snapshot file, exclusions, and the list cap.
  • Also: the flow and run-stats version tests, payload leniency, the killed branch, the fleet payload carrying no paths, the viewer row in all its states, and the goldens.
  • Every guard was mutation-checked and goes red. The one exception is the seeded index: it only saves hashing, which the cost numbers show.
  • Suites: flow, crew, lab and serve pass (6769); --test cli and --bin darkmux pass (1567); vitest passes (3859). Both complexity ratchets pass.

Not yet looked at on screen: the viewer row (it needs a served daemon). The Docker proof (mock_dispatch_proof.rs, #[ignore]) didn't run here.

Labeled full-ci, since this is a contract change across several crates.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB

darkmux describes; it never reads the model's claim and never changes
a dispatch's result. The host reads the workspace right before the
sandbox starts and again when the dispatch ends, and records what
changed:

- the envelope (`dispatch --json`) gets `workspace_changes`: method,
  files_changed, not_measured, line totals, what was excluded, and the
  files by name (at most 100, then files_omitted);
- `dispatch.complete` / `dispatch.error` carry the same counts and
  totals and no file list, so no path reaches the flow stream or the
  fleet relay (flow schema 2.10.0, additive, read leniently);
- `run stats` (text and --json) reads them from the run's terminal
  record (run stats schema 2.6.0);
- the viewer's dispatch page shows a `changes` row: "no changes outside
  dist/, target/", "2 files · +12 −3", "not measured: <why>".

`files_changed` is 0 only when the workspace was read and nothing
changed, and null (with the reason) when it could not be read. A line
total is null unless every changed file's lines were measured.

Two existing mechanisms moved into darkmux-crew's `workspace_changes`
rather than written again: the client work copy's git tree snapshot
(serve now calls it) and the lab's workspace delta (re-exported under
its lab name, with the artifact directory names beside it). A checkout
whose own `.git` the run could not write is measured with git, through
a scratch index seeded from its own and a scratch object store with the
repository's as an alternate, so the repository is only read; every
other workspace is measured by snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB
@si-agents-bot si-agents-bot Bot added the full-ci Run the heavy CI checks (leak check, PR-diff mutation, coverage) on this PR label Nov 27, 2026
@si-agents-bot
si-agents-bot Bot requested a review from kstrat2001 November 27, 2026 00:47
si-agents-bot Bot and others added 2 commits November 27, 2026 09:28
…e stream (#3236 review)

The independent review of #3704 found these; each now has a test.

- The git path adds into a fresh, empty index, never a copy of the
  checkout's: a seeded gitlink made `git add` run git inside a
  submodule whose `.git` a run can write, executing its filter on the
  host, and a hanging one held the dispatch's close forever
  (host_git.rs's rule: add "into a fresh, empty index, which holds no
  gitlink to check"). It also hid --assume-unchanged / --skip-worktree
  edits.
- Every git call while measuring runs under bounded_command, sharing
  one deadline (runtime.step_command_timeout_seconds); past it the
  changes are not measured and the close goes on.
- `not_measured` is a fixed reason that names no path (git's stderr
  named the file it failed on, on dispatch.complete).
- What a "no changes" did not look at is named: `submodules` (work
  inside one is not in its gitlink) and `files-over-50mb` (compared by
  size and mtime). The snapshot now counts symlinks by their target
  without following them, permission changes, a large file's moved
  mtime, and names that are not UTF-8; it opens files no-follow and
  regular-only, and counts an added file's lines in chunks, capped.
- The exit between the launch and the watch (a failed observer start)
  records the workspace as not read instead of no block.
- A dependency's envelope forwarded to the next step's model, and so
  to that step's dispatch.start prompt on the flow stream, keeps its
  workspace counts and drops the file list.
- FLOW_SCHEMA_VERSION's version history names 2.10.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB
… gitlinks (#3236 review 2)

- Every measuring git call now reads the repository's filter drivers
  under the read's deadline (HostGit::filter_drivers_command, parsed by
  filter_drivers_in) and builds its command with them
  (HostGit::command_with_drivers). A config can include.path a file in
  the work tree, which a run can replace with a FIFO; the unbounded read
  inside HostGit::command held the close. The read is per call, so a
  driver the run defines through such an include is still passed empty.
  HostGit::command is unchanged for every other caller: it is now
  command_with_drivers over the same unbounded read it always made.
- A dispatch.internal step whose dispatch exits non-zero fails with the
  envelope minus its file list (builtins::dispatch_exit_text): that text
  is the step's output and step.error record and reaches run_on: error
  dependents' prompts.
- Gitlink detection streams plain `git ls-tree -r -z` under the
  deadline and keeps only a flag: no 1 MiB capture (big repositories
  were unmeasurable) and no `--format` (git 2.36).
- The git-path label no longer spells "git" as a literal (the
  host-git conformance scan reads it as a spawn).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB
si-agents-bot Bot and others added 3 commits November 27, 2026 11:01
…#3236 CI)

- No alternate object store: through one, git "freshens" each object it
  already holds by rewriting its file's mtime, a write to the operator's
  repository. Every object of both trees now lives in the scratch store.
- Every measuring call adds gc.auto=0, maintenance.auto=false and both
  autoDetach=false (MEASURE_GIT_CONFIG, through HostGit::with_config), so
  no auto gc or auto maintenance (CI's git 2.56 left
  objects/maintenance.lock) runs against the checkout.
- The test fixture's own git calls turn auto maintenance off too, so a
  detached maintenance from a setup commit never races a test's read.
- The repository checks compare every file under .git, mtime included.
- Clippy: no octal-looking escapes, a byte string where it suggested one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB
Under the checkout's core.splitIndex, the scratch index kept its shared
index in the operator's .git and expired old ones there, which could
delete the operator's own and make `git status` fatal. Every measuring
call now sets core.splitIndex=false. The regression test (shortest
expiry, two reads) asserts no file is added, removed or rewritten; git's
own mtime freshen of the shared index on read is the one change, as the
operator's own `git status` makes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFCFz4Ba6sjXBsGaK2g5aB
@si-agents-bot
si-agents-bot Bot merged commit 5bf3f85 into main Nov 27, 2026
25 checks passed
@si-agents-bot
si-agents-bot Bot deleted the 3236-describe-workspace-change branch November 27, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the heavy CI checks (leak check, PR-diff mutation, coverage) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coder: the model claims a fix it never made, and the dispatch reads stop/success

0 participants