You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): show --diff checks only the destination, so it advertises a write apply refuses on the backup path #1188
Slice of #1082 (itself the remainder of #963). The write-dir row only.
AGENTDESCENT_SURFACE_WRITE_DIRS is enforced on the MCP surface today; the other write paths still accept a path outside it, so a worker that writes out of its allowed dirs is caught by review, not by code.
What changes
apply: refuse a target outside the allowed dirs before anything touches disk, including the materialised tree it builds on the way.
show --diff: when the diff would write, apply the same check to the paths it names, so the preview cannot advertise a write the apply would refuse.
the materialised tree itself, not only the final rename.
Acceptance
a path outside the allowed dirs is refused with the offending path and the allowed dirs named in the message; nothing is created, truncated or renamed (no partial file, no mtime change on an existing file);
the same call with a path inside the allowed dirs still writes and still passes its existing tests;
offline tests only — no new sandbox, no auth layer, no network;
Partial: #1082, Partial: #963 (the parent stays open for its other two rows); changelog fragment; the env var's docs line says which paths it now covers.
Evidence the PR must carry
red-first: the refusal test fails on the PR's base, with the failing id and the exact command;
green at the tip, same command;
the per-file diff.
Sequencing: red test and branch work can start now; the PR opens when a queue slot frees (the Lead says when), so a review seat never has three AD PRs at once.
Closing as already shipped — opened by me from #1082's acceptance text without reading that issue's own thread. My error.
Evidence: #1082's comment at 2026-11-20T05:12:58Z records the write-dir row as shipped by PR #1087, and the later slice PRs (#1088, #1178) built on the same helper. The row this slice asked for — AGENTDESCENT_SURFACE_WRITE_DIRS applied on apply, on show --diff and on the materialised tree, refused before disk — is therefore already carried by a merged PR, and Partial: #1082 / Partial: #963 already live on those carriers.
What remains of #1082 is only its middle row (host-worker budget defaults: max_concurrency, a per-Ticket cap, and the USD question), which is deliberately not sliced yet because it edits the same mcp.py helper as #1186, still in review. That is recorded on the parent.
No work lost: Dev-2 had not pushed anything, no branch reached the remote.
changed the title [-]feat(cli): enforce AGENTDESCENT_SURFACE_WRITE_DIRS on apply, show --diff and the materialised tree (slice of #1082)[/-][+]fix(cli): `show --diff` checks only the destination, so it advertises a write `apply` refuses on the backup path[/+]on Nov 20, 2026
Reopening — my earlier close was too broad, and the correction is narrower than the original issue.
I closed this as "already shipped by #1087". That is true for apply and for the materialised tree, and not true for show --diff, which is one of the three lines this issue names. What #1087 shipped, read at f5017f93:
apply → _check_apply_paths(dest, plan["written"], slot, check_write) (cli.py:3549, :3670, :3768), and that helper checks dest, every written leaf, and the backup slot (evolution.py:1582-1590).
show → _refuse_plan_outside_write_dirs(payload, target) (cli.py:3093-3109) checks only the target, never the leaves and never the backup path, though its own docstring says it must not print a plan naming a file apply would refuse.
So the contract breaks at exactly one seam: AGENTDESCENT_SURFACE_WRITE_DIRS covering the destination while $AGENTDESCENT_HOME/backups/... sits outside it (a directory artifact backs up under the home, not beside the target — cli.py:3638-3640). Then show --diff reports written: ["SKILL.md"], noop: false and apply exits 2 with backup '.../ad-home/backups/demo-.../bak-0' is outside the operator's write allowlist. A preview that advertises a write the apply refuses is the exact failure #1082 asked to prevent.
Acceptance (narrowed to the one seam)
show --diff applies the same check set apply does: destination, every path in written, and the backup slot when one would be taken; a plan it cannot apply is reported as an error instead of as written;
the text-file case (backup is a sibling .bak-N, inside the allowlist when the dest is) stays green and unchanged;
one offline test that is red at base for the right reason — the preview claims a write, then the same call through apply exits 2 — not a reshaped assertion;
no change to apply's own refusal, to the allowlist semantics, or to the tree path;
Partial: #1082 / Partial: #963 (their other rows stay closed).
Evidence the PR must carry: the red run at the PR's base with the failing id and command, green at the tip, per-file diff.
Sequencing: red test may be prepared now on a local branch; the PR opens when a queue slot frees. Note for whoever picks it up: AGENTDESCENT_SURFACE_WRITE_DIRS unset must keep today's allow-anywhere (cli.py:3437-3439), so the test must set the variable explicitly.
Activity
HugoXK commentedon Nov 20, 2026
Closing as already shipped — opened by me from
#1082's acceptance text without reading that issue's own thread. My error.Evidence:
#1082's comment at2026-11-20T05:12:58Zrecords the write-dir row as shipped by PR#1087, and the later slice PRs (#1088,#1178) built on the same helper. The row this slice asked for —AGENTDESCENT_SURFACE_WRITE_DIRSapplied onapply, onshow --diffand on the materialised tree, refused before disk — is therefore already carried by a merged PR, andPartial: #1082/Partial: #963already live on those carriers.What remains of
#1082is only its middle row (host-worker budget defaults:max_concurrency, a per-Ticket cap, and the USD question), which is deliberately not sliced yet because it edits the samemcp.pyhelper as#1186, still in review. That is recorded on the parent.No work lost: Dev-2 had not pushed anything, no branch reached the remote.
[-]feat(cli): enforce AGENTDESCENT_SURFACE_WRITE_DIRS on apply, show --diff and the materialised tree (slice of #1082)[/-][+]fix(cli): `show --diff` checks only the destination, so it advertises a write `apply` refuses on the backup path[/+]HugoXK commentedon Nov 20, 2026
Reopening — my earlier close was too broad, and the correction is narrower than the original issue.
I closed this as "already shipped by
#1087". That is true forapplyand for the materialised tree, and not true forshow --diff, which is one of the three lines this issue names. What#1087shipped, read atf5017f93:apply→_check_apply_paths(dest, plan["written"], slot, check_write)(cli.py:3549,:3670,:3768), and that helper checks dest, every written leaf, and the backup slot (evolution.py:1582-1590).show→_refuse_plan_outside_write_dirs(payload, target)(cli.py:3093-3109) checks only the target, never the leaves and never the backup path, though its own docstring says it must not print a plan naming a fileapplywould refuse.So the contract breaks at exactly one seam:
AGENTDESCENT_SURFACE_WRITE_DIRScovering the destination while$AGENTDESCENT_HOME/backups/...sits outside it (a directory artifact backs up under the home, not beside the target —cli.py:3638-3640). Thenshow --diffreportswritten: ["SKILL.md"], noop: falseandapplyexits 2 withbackup '.../ad-home/backups/demo-.../bak-0' is outside the operator's write allowlist. A preview that advertises a write the apply refuses is the exact failure #1082 asked to prevent.Acceptance (narrowed to the one seam)
show --diffapplies the same check setapplydoes: destination, every path inwritten, and the backup slot when one would be taken; a plan it cannot apply is reported as an error instead of aswritten;.bak-N, inside the allowlist when the dest is) stays green and unchanged;applyexits 2 — not a reshaped assertion;apply's own refusal, to the allowlist semantics, or to the tree path;Partial: #1082/Partial: #963(their other rows stay closed).Evidence the PR must carry: the red run at the PR's base with the failing id and command, green at the tip, per-file diff.
Sequencing: red test may be prepared now on a local branch; the PR opens when a queue slot frees. Note for whoever picks it up:
AGENTDESCENT_SURFACE_WRITE_DIRSunset must keep today's allow-anywhere (cli.py:3437-3439), so the test must set the variable explicitly.HugoXK commentedon Nov 20, 2026
Claim renewed: the controller expired
agent-workingon this issue in its22:27:21Zrun, before the branch was on the remote.agent/1188-show-diff-write-dirs8d75685aecdecb9a93056d8abee661b827a83c28mainafter itOne PR for this issue.