Runner auto-commit must accept already-staged deletions #907
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#907
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Runner auto-commit step stages changed paths with
git add -- <paths>.When an agent already staged a deletion with
git rm, the path is in neither the index nor the working tree.Then
git addexits 128 and the Runner raisesOsSdlc::HarnessError.Observed
The Runner raised
OsSdlc::HarnessErrorat contract-auditor dispatch 63, soos-sdlc-subagent-stopexited 3.Reproduce
Approach
Git::Repo#stagedoes not send a path whose deletion is already staged togit add. The deletion is already in the index, andgit commit --only -- <paths>commits it.Implementation::Commitand ADR-0171 do not change: the verbs are stillgit add --andgit commit --only.Probe on git 2.55.0, in a scratch repository with one modified file, one new file, one unstaged deletion, and one staged deletion:
git add -- <all>,git add -A -- <all>,git add -u -- <all>: each exits 128 on the staged deletion.git diff --cached --name-only --diff-filter=Dlists the staged deletion.git add -- <the other three>and thengit commit --only -- <all four>exits 0. The commit contains all four changes.git add --with no paths exits 0 and adds nothing.stagedoes not runaddwhen no paths remain.The git knowledge stays in the adapter, which owns the git process (lens-architecture:
adapter/talks to a process).Required work:
add— check: present"--diff-filter=D"inplugins/os-sdlc/lib/os_sdlc/adapter/git/repo.rbRejected:
git add -A -- <paths>(the first approach). It also exits 128 on a staged deletion, and ADR-0171 decision 3 says "never-A".git update-index --add --remove -- <paths>. It works for all four states, but it replaces thegit addverb of ADR-0171 decision 3 (kept by ADR-0249). That needs a user ruling, and an option that keeps the ADR is available.git rm. The Runner must accept any index state that an agent or the user leaves (feedback-lens-request-is-a-design-symptom).git reset -- <path>beforeadd(the workaround used in this session). ADR-0171 decision 3 allows only additive verbs.Relation to #906: #906 changes only
agents/refactorer.md. No overlap, no dependency. Either order works.Acceptance criteria
commit.pathslists all three.git addwith no paths, and the commit includes the deletion.Owner sketch
Origin
plugins/os-sdlc/maps/drafts/.gitkeepwithgit rm; Runner failed at dispatch 63.git reset -q -- <path>thenos-sdlc-next, which committed.git addexit 128 on staged deletion ←Repo#stagerunsadd --(plugins/os-sdlc/lib/os_sdlc/adapter/git/repo.rb:72-73, called from plugins/os-sdlc/lib/os_sdlc/command/implementation/commit.rb:28) ← IMPROVISATION (reset workaround)Parent: #904. VERDICT: CREATE
PREDICTED RULING: REVISE
a. Accept as written? No.
b. Reasons.
git add -A -- <staged-deleted path>also exits 128 ("pathspec did not match any files").add -u --also exits 128.-Aconflicts with ADR-0171 decision 3 ("never-A"), which ADR-0249 kept. The memory file feedback-os-sdlc-runs-afk-decide-and-report says: prefer the option that keeps the ADR when one is viable.git rm" is a design symptom (feedback-lens-request-is-a-design-symptom). The Runner must accept any index state.c. What is lazy or wrong. The ticket proposes a git verb without running it. I did the research in a scratch repo.
git commit --only -- <paths>already commits a staged deletion. Onlygit addfails.git diff --cached --name-only --diff-filter=Dlists staged deletions.add -- <the other paths>followed bycommit --only -- <all paths>commits all four states: modified, new, staged deletion, and unstaged deletion.git update-index --add --removealso works, but it changes the verb in ADR-0171 decision 3, so the user must rule on it.d. Predicted approach.
Git::Repo#stageremoves the staged deletions from its argument and runsadd --on the remaining paths. If no paths remain, it does not runadd. ADR-0171 is unchanged. The fix is in the adapter, which owns the git process.Commitis unchanged.e. Not read. Full lens skills;
commit_test.rbbodies. #906 changes only refactorer.md: no overlap, no dependency.Work started on branch ticket-907 through /os-sdlc:implement (poodr-ticket-implementation map).
Resolution
Done: Git::Repo#stage now leaves out paths whose deletion is already staged (diff --cached --name-only --diff-filter=D) and skips the staging call when nothing remains; commit --only still commits the deletion. ADR-0171 decision 3 (never -A) kept.
Evidence: Implementation 22 complete, 8 dispatches all pass, suite gate exit 0. Three new tests in tests/command/implementation/commit_test.rb: staged deletion alone, staged deletion with modified and new paths, no raise. Commits
10b106ef,80362511on main.Follow-ups: none