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
bug(cli): apply recreates a deleted target tree and reports it as a plain write #1118
agent-workingAn agent has claimed this issue (the claim comment names the branch)area:cliThe agentdescent command line (cli.py, doctor, plan/evolve/status/apply)bugSomething isn't working
apply latest into a target that no longer exists recreates the tree and prints a plan that never says so; backup: [] / noop: false read like an ordinary in-place update.
Why
apply_payload resolves dest from the run spec (agentdescent/cli.py:3389) and calls result._write_to(...) (cli.py:3428-3436); that method's plan has only written/unchanged/extra/deleted/backup/noop (agentdescent/evolution.py:2078-2081) and no way to record "dest did not exist". cmd_apply prints the JSON (cli.py:3648) and its only note is the noop one (cli.py:3653). The backup slot is only taken when os.path.isdir(dest) (evolution.py:2082), so a recreated root is also the one case with nothing to roll back to.
Repro at 5048349a, from a checkout with export PYTHONPATH=$PWD
created = not os.path.isdir(dest) before result._write_to(...) (cli.py:3428), then plan["created"] = created beside plan["dest"] (:3436); cmd_apply prints one stderr line when created — created <dest> from run <id>; nothing was restored and no backup was taken. Recreating stays legitimate; the text branch (:3400-3427) untouched; flag on the CLI side so evolution*.py (T3) is not touched.
Acceptance
deleted target → "created": true and the line once; in-place apply → "created": false, no line; tests/test_apply*.py green.
Non-goals
refusing to recreate, backup policy for existing trees, --from.
Claimed — Claim-Id: #1118 Branch:agent/1118-apply-created-target
Base: bdaa0200b5494fd42fe5403f1cd022af5f04b2b5 (live main at this read).
Scope as written: created = not os.path.isdir(dest) in apply_payload before _write_to, plan["created"] beside plan["dest"], and one stderr line in cmd_apply when it is true. The text branch and evolution*.py are untouched.
agent-workingAn agent has claimed this issue (the claim comment names the branch)area:cliThe agentdescent command line (cli.py, doctor, plan/evolve/status/apply)bugSomething isn't working
Activity
HugoXK commentedon Nov 16, 2026
Claimed —
Claim-Id: #1118Branch:agent/1118-apply-created-targetBase:
bdaa0200b5494fd42fe5403f1cd022af5f04b2b5(livemainat this read).Scope as written:
created = not os.path.isdir(dest)inapply_payloadbefore_write_to,plan["created"]besideplan["dest"], and one stderr line incmd_applywhen it is true. The text branch andevolution*.pyare untouched.Written-by: AgentDescent Dev-1
Bot: AgentDescent Dev-1
docs(changelog): scope the created flag to tree targets (#1118)
fix(cli): report created only when apply actually writes (#1118)