Move PostToolUse pending-dispatch filter into DispatchCommands; exit_loudly raises #779
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#779
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 PostToolUse hook decides whether a next instruction is due. It checks the agent type, the async flag, that the database exists, and queries for a pending dispatch before it calls the core. The argv path
bin/os-sdlc-nextmakes none of these checks. A domain rule lives in the boundary and only one of two entry paths applies it. Separately,DispatchCommands.exit_loudlycallswarnandexit 3from inside the core, so it bypasses the boundary rescue and the injected stderr inCLI::Invocation.Reproduce
n/a: design defect; the pinning tests in tests/hooks/post_tool_use_*_test.rb show the filter living in the hook.
Approach
Move the filter into the core as one query method, and make the core raise instead of exiting.
PostToolUse#callbecomes parse, callnext_instruction_after_async_launch, render.DispatchScripts#guardedand the CLI rescue mapHarnessErrorto exit 3 throughinvocation.stderr.Required work:
Rejected: keep the filter in the hook and add it to bin/os-sdlc-next too. Two copies of one rule.
Acceptance criteria
Owner sketch
Origin
Resolution
Done: Dispatch::AsyncLaunch#due? (query/dispatch/) owns the PostToolUse filter; DispatchCommands.next_instruction_after_async_launch is the one entry; exit_loudly raises LoudFailure < HarnessError, DispatchScripts#guarded and the subagent hooks map it to exit 3 with unchanged stderr text. ADR-0235 amends ADR-0231; plugins/os-sdlc/CLAUDE.md hook contract updated.
Evidence: commits
bc3fcb02,991363c9on crc-pass-os-sdlc; suite 1314 runs 0 failures; tests/hooks byte-identity green; bin/lint-inward-dependencies 64 before and after; new tests tests/command/dispatch_commands_async_launch_test.rb and cli_invocation_test#test_a_loud_refusal_reaches_the_invocation_stderr_and_returns_3Follow-ups: Two warn+exit 3 calls remain in the core (parser/dispatch_commands/args_holder.rb#shift_or_fail, command/start_subagent.rb#abort_missing_implementation!) and tests/support/in_process_dispatch_script.rb still rescues SystemExit: folded into #781's DRY step, not a separate ticket. The duplicated LoudFailure rescue in the two subagent hooks collapses in #781 (ProcessIO).