Repository navigation
Description
A landing that could not save the work merges anyway, and then deletes it
Parent: #228 follow-up
Problem
comeHome (internal/session/task_run.go, near 6017) is the one road every merging landing takes. It commits the node's ledger and throws the answer away:
_ = commitTaskWork(t.dir, title, wrote)commitTaskWork (near 6294) can answer nil three ways and none of them reaches a caller: stageTaskWork said the directory is not a worktree, nothing ended up staged, or git commit itself failed — the commit's own error is dropped on the floor (_, _ = git(dir, …, "commit", …)). stageTaskWork (near 6374) has the same shape one level down: it returns false only for a non-worktree, and ignores the error from git add --all -- and from every per-path retry under it.
comeHome then carries on regardless. It merges a branch that holds nothing — which succeeds, because there is nothing there to conflict with — and releaseLanded (internal/session/groundladder.go, near 765) removes the worktree, with --force when the plain removal refuses. The node settles TaskDone.
Evidence at dev@c1776b76. One repository ground, one file the worker wrote, and the worktree's git directory made unwritable — a full disk, a read-only mount, a permission somebody changed:
merge="merged" detail="it left files it did not write, and they went with its working copy rather than onto your branch: parser.py"
parser.py on the person's branch: false · still in the worktree: false
Two things are in that line. The work is gone from both places. And leftBehind read the node's own unstaged deliverable as somebody else's droppings, so the landing's own sentence names the file it has just destroyed — as junk.
Since #237 the ledger composes, so at a family's landing this is not one node's slice: the parent's list carries every landed part's paths, and the one discarded commit is every generation's work.
Decision
A landing that could not save the work does not merge, does not release anything, and does not say done.
-
stageTaskWorkandcommitTaskWorkanswer WHAT WENT WRONG instead of a barenil/false: git's own first line for the add, the commit, or the reset that failed. -
comeHomestops at the first failure. It does not merge, it does notreleaseLanded, and the branch and the worktree both stay exactly where they are — the work is on disk and that is the only copy of it. -
The outcome is the one that already exists for a branch that never came home,
mergeAborted, carrying a sentence in the shapeunreachedSentencealready uses:its work is in
<dir>and could not be saved to its branch:<git's first line> -
The node settles needing your look (
TaskUnverified,needsLookLead), not done and not failed: nobody made a finding about the work, the harness simply could not put it away. That is the same endinglandConflictedandlandShiftedgive, for the same reason. -
One road. Every landing road already asks
comeHomeone question and gets one pair back; what changes is that the roads test did it merge rather thanmerge == mergeConflicted, andlandConflictedcarries the mark it is handed instead of hardcodingmergeConflicted.
Acceptance
- e2e: a repository-ground task whose worktree cannot be staged into settles
TaskUnverifiedwithfinished, but needs your look —leading its report and the directory named;bin/aforgejob log printsnot merged: …; the file the worker wrote is still on disk in the task's directory afterwards, and the worktree is still registered (git worktree listnames it). - e2e: the control — the same task with a writable worktree still lands
merged, the file reaches the person's branch, the worktree is gone and the branch is deleted. Nothing about the ordinary road moves. - Unit:
commitTaskWorkanswers the failure for each of its three silent endings, and no caller of it discards the answer (a structural assertion in the shape ofinternal/session/principal_structure_test.go: every call site either reads the failure or is named in a ledger with a reason). - The manual page that covers this (
internal/manual/chat/how-tasks-run.md) quotes the new sentence, and the change entry'sinvalidatessays that a landing used to reportmergedfor work it had not committed.
Verification recipe
Deterministic, no model — internal/session, beside task_landing_test.go, which already builds a real repository in a temp directory:
repo := newTestRepo(t)
tree, _ := prepareTaskTree(Place{}, repo, "ffff6666ffff6666", 17, "add the parser")
writeFile(t, filepath.Join(tree.dir, "parser.py"), "def parse():\n return 1\n")
// The one place git has to write to stage anything.
gitdir := strings.TrimSpace(gitOut(t, tree.dir, "rev-parse", "--absolute-git-dir"))
os.Chmod(gitdir, 0o555)
t.Cleanup(func() { os.Chmod(gitdir, 0o755) })
merge, detail := tree.comeHome("add the parser", []string{"parser.py"})Today: merge is "merged", and parser.py is in neither the repository nor the worktree. Wanted: mergeAborted, the sentence naming the directory, and the file still on disk.
Drafted with CodeAF · reviewed and owned by the author
Activity
task families: a landing that could not save the work keeps it and as…
docs: the task-family design page says what the code now does
docs: the family page carries the merge record, the two later refusal…
docs: fold the parallel rewrite's findings into the task-family record
task families: a landing that could not save the work keeps it and as…
docs: the task-family record — the two laws, nine refusals, and what …
task families: a landing that could not save the work keeps it and as…
task families: a landing that could not save the work keeps it and as…
task families: a landing that could not save the work keeps it and as…
task families: the two roads the family work lands in have too many e…
task families: rebase the ceiling onto #277's landing law (#260)
task families: complexity debt on the division and landing seams — ex…