Repository navigation
Conversation
`show --diff` guarded only the destination. A directory artifact backs up under `$AGENTDESCENT_HOME/backups/...`, not beside the target, so a destination inside `AGENTDESCENT_SURFACE_WRITE_DIRS` whose home is outside it was reported as `written` while the same `apply` exited 2 on the backup slot -- a preview for a call that cannot run. `show` now runs apply's own check set: the destination, every path in the plan's write set and the backup slot. A single-file artifact checks through `_check_apply_paths`, as `apply` does; a tree through `_write_to(check_write=...)`, the call `apply` makes, with `dry_run` the only difference. An unset allowlist still means allow-anywhere. Partial: #1082 Partial: #963
|
Advisory QA read — #1200 at Read live at that head ( Ran (fresh clone, fetched
Probes at the tip, independent of the new test's assertions:
Not run: docker sandboxes (no daemon — the same 10 errors at both ends), wheel smoke (no packaging path), real-model path (offline; the diff is path checking), Findings: none blocking. Recorded, not a defect: the preview assumes a default No UI surface: CLI No merge action from QA: this report is advisory, the merge gate is the repo's review decision on the head sha, and the merge itself is executed by the repo's merge process. |
Fixes #1188. Partial: #1082. Partial: #963.
Base: 8d75685
Tip SHA: b9b6202
What changed
show --diffpreviewed a write that the sameapplyrefuses. Its only guardwas
_refuse_plan_outside_write_dirs, which checked the destination;applyadditionally checks every file the plan names and the backup slot
(
_check_apply_paths). A directory artifact backs up under$AGENTDESCENT_HOME/backups/..., so withAGENTDESCENT_SURFACE_WRITE_DIRSset to the destination's tree the preview listed the files as
writtenwhileapplyexited 2 on the backup path.shownow runs apply's own check set:slot = _backup_slot(dest) if backup and not plan["noop"] and os.path.exists(dest) else None, then_check_apply_paths(dest, plan["written"], slot, _operator_write_guard())— the expression and callapplymakes atcli.py:3561;result._write_to(dest, backup=..., dry_run=True, check_write=_operator_write_guard())— apply's call atcli.py:3604withonly
dry_rundifferent, and_write_toruns_check_apply_pathsbeforeits
dry_runreturn (evolution.py:2102-2105)._refuse_plan_outside_write_dirs(payload, target, written=(), backup=None)carries the extra paths instead of guarding the destination alone; the
tree branch's call to it was dropped because
_write_tonow performs thatsame set. An unset
AGENTDESCENT_SURFACE_WRITE_DIRSstill meansallow-anywhere.
One asymmetry is deliberate: the preview assumes the default apply, so it
checks the backup slot.
apply --no-backuptakes no such slot and refusesnothing extra; the preview is therefore stricter than that one flag
combination, not wrong about it.
Red first, at this PR's base (
8d75685a) in a clean worktree with only the newtest file present:
showreturnedapply_plan {"written": ["alpha/SKILL.md", "alpha/references/rules.md", "beta/SKILL.md"], ..., "noop": false}with noerror, while the same call through
applyexited 2 witherror: backup '<tmp>/ad-home/backups/seed-lib-e25afdcf43d6/bak-0' is outside the operator's write allowlist (AGENTDESCENT_SURFACE_WRITE_DIRS); allowed roots: '<tmp>/seed-lib', dest unchanged and home never created.Ran at
b9b62024PYTHONPATH=. python -m pytest -o addopts="" tests/test_write_dirs_apply_show.py -q—
3 passed;tests/test_*.py(516 files), eachPYTHONPATH=. python -m pytest -o addopts="" -q <chunk>—7935 passed, 22 failed, 10 errors, 51 skipped;8d75685aworktree run of thesame ten files (
22 failed, 442 passed, 15 skipped, 10 errors, 137.81s):commbetween the two sorted id lists is empty. All 32 are environment rows—
OSError: [Errno 30] Read-only file system: '/home/xuke/.agentdescent-tests'— plus the Docker sandbox rows intest_sandbox_container.py;python -m tools.gen_api_docs --check—docs/api.md is up to date;python -m tools.changelog_fragments check—9 changelog fragment(s) OK.Not run
mkdocs build --strictin its exact form: this host is offline and thesocialplugin fetchesfonts.google.com, so the build dies atERROR - Error building page 'index.md': ... ConnectTimeout. Verifiedinstead with
mkdocs build --strict -f mkdocs.local.yml, whose onlydifference is
social: {cards: false}— pass,Documentation built in 12.91 seconds. The CI build online is not claimed here.