os-sdlc hooks create a new pipeline database in a subagent's cwd instead of finding the project root #822
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#822
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 os-sdlc hooks bind the pipeline database from the event's working directory. They do not search for the project root:
Db.connect_project!(root)resolvesroot/.sdlc/pipeline.db(adapter/db.rb:53,model/project/artifact_dir.rb:19).Db.openrunsFileUtils.mkdir_pon that folder. A new empty file hasuser_version0, soDb.opentreats it as stale, moves it topipeline.db.stale, and creates a fresh schema (db.rb:65,:106). So when a subagent's working directory is a source subfolder, its SubagentStart, SubagentStop or PostToolUse:Agent event binds a new empty database there, not the run's database.RootSearch(adapter/project/root_search.rb) exists, but no hook uses it.Observed
On 2026-09-28 two runs left the exact
Db.opensignature, a 57344-bytepipeline.dband a 0-bytepipeline.db.stale:The second folder is the one the programmer edited. Both were removed by hand before commit.
git add -Awould have committed them. No one has yet driven a hook call to reproduce it. The working directory that the harness puts in the event is inferred from the code.Reproduce
Not yet reproduced by a driven hook call. Candidate: send a SubagentStop event whose
cwdisplugins/os-sdlc/libtoplugins/os-sdlc/hooks/<completion hook script>and check forplugins/os-sdlc/lib/.sdlc/pipeline.db.Origin
Db.connect_project!(event.cwd)with no root search, andDb.opencreates a database on open <- DESIGN (controller hooks,adapter/db.rb)VERDICT: CREATE
REASON: The chain ends in DESIGN, not IMPROVISATION. The hooks bind
Db.connect_project!(event.cwd)with no root search, andDb.opencreates a database on open. Two runs on 2026-09-28 left stray databases with the exactDb.opensignature. Fixing the hooks to useRootSearch, or making them stop creating a database on open, removes the problem. Removing the files by hand only hid it.Resolution
Done: Hooks and the dispatch/implementation scripts bind through ProjectBind -> RootSearch.outermost: the outermost .sdlc/project.yaml inside the git or home boundary. Nested target configs (plugins/*/.sdlc) no longer capture the bind. With no project root, hooks skip (exit 0) and scripts fail loudly; neither creates a database.
Evidence: main
675f99f8+9076f428(mergeded3b8295). New hook_project_root_test and script_project_root_test, incl. a nested-project case, red then green. Driven SubagentStop event with cwd plugins/os-sdlc/lib created no pipeline.db in plugins/os-sdlc/.sdlc or lib (ls verified). Suite 1328 runs, 0 failures.Follow-ups: none