Repository navigation
Conversation
skills/subagent-driven-development/scripts/task-brief toggles an `infence` flag on any line beginning with three backticks, and uses it to avoid treating a `Task N` heading inside a fenced example as a real task boundary. If the plan has an unclosed fence (an odd number of fence-start lines, e.g. a closing fence was deleted while editing), `infence` never flips back off, so every later real `Task` heading becomes invisible to the `!infence && /^#+.../ ` guard and extraction runs to EOF, absorbing all later tasks into the requested task's brief. The script's only guard was "is the output non-empty", so this returns exit 0 with a normal-looking "wrote <path>: <n> lines" message. Add an END block to the awk program that exits 1 when a fence is still open at EOF, and have task-brief turn that into a clear stderr message and exit 4, removing the (bogus, over-captured) output file instead of leaving it on disk. Reproduced deterministically with the plan from the issue: unmodified script exits 0 with a 20-line brief for "Task 1" that contains Task 1 plus Task 2 and Task 3 in full (2 marker lines leaked); closing the fence, the only change, gives a correct 14-line, single-task brief. Added the same repro (and its closed-fence control) as a new case in tests/claude-code/test-sdd-workspace.sh: RED against the unmodified script (confirmed by stashing the fix and re-running), GREEN with the fix. Full suite: 26/26 assertions pass. scripts/lint-shell.sh (default and --strict) is clean on both changed files. Fixes obra#2436.
3 of 5 tasks
4 of 5 tasks
2 tasks done
Merged
3 of 5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Who is submitting this PR? (required)
What problem are you trying to solve?
#2436:
skills/subagent-driven-development/scripts/task-brieftoggles aninfenceflag on any line beginning with three backticks, and uses it toavoid treating a
Task Nheading inside a fenced example as a real taskboundary:
If the plan contains an unclosed fence — an odd number of fence-start
lines, e.g. an edit deletes a closing ``` while touching a code block —
infencenever flips back to false. Every later real `Task` heading isthen invisible to the `!infence && ...` guard, `intask` is never cleared,
and extraction silently runs to EOF, absorbing every later task's content
into the requested task's brief.
The script's only guard on its output is "is it non-empty"
(
[ ! -s "$out" ]), so this returns exit 0 with a normal-lookingwrote <path>: <n> linesmessage — nothing signals that the brief nowcontains several tasks' worth of requirements.
Reproduced deterministically from the issue's plan
(
skills/subagent-driven-development/scripts/task-brief plan.md 1 out.md,unmodified
devHEAD):### Taskheadings in outputThis matches the issue report exactly. In real SDD use this hands an
implementer subagent "its requirements" that are actually several tasks'
worth of scope, including work explicitly assigned to later tasks.
What does this PR change?
Adds an
ENDblock to theawkprogram that exits 1 when a fence isstill open at EOF, and has
task-briefturn that into a clear stderrmessage and a new exit code (4), removing the bogus, over-captured output
file instead of leaving it on disk. The normal (closed-fence) path is
byte-for-byte unchanged.
Is this change appropriate for the core library?
Yes.
task-briefis a core script in the shippedsubagent-driven-developmentskill, called once per task on every SDD run. The fix is a correctness/
safety check on that script's own output, with no new dependency, no new
file, and no project-specific behavior.
What alternatives did you consider?
Taskheadings in the output instead of tracking fencestate. Rejected: a
### Task Nheading can legitimately appear insidea properly closed fenced example (it's meant as illustrative text), so
"a Task heading is present in the output" isn't by itself a reliable
signal of over-capture. Fence-open-at-EOF is a direct, unambiguous fact
about the document instead.
a next task after the unclosed fence). Rejected: an unclosed fence
makes the plan itself malformed, and silently trusting it for any task
silently extracted before this point is already underwriting the exact
gap this issue reports. Failing unconditionally also keeps the fix a
single small, easily-audited change instead of a second code path.
length,
~~~, nesting, etc.). That's task-brief: track fence character and length so fenced examples cannot end a task early #2304, already open, and itexplicitly does not address this: every case it fixes causes extraction
to stop early; this issue is extraction running long because of a
fence that is genuinely never closed in the source document, which no
refinement of fence detection can close. I did not check out task-brief: track fence character and length so fenced examples cannot end a task early #2304's
branch; this assessment is from its diff and stated scope, not a tested
claim about interaction effects.
Does this PR contain multiple unrelated changes?
No — one change to
task-brief's awk program plus the matching test-suiteaddition (and control case) for the same script.
Existing PRs
sanity check, confirmed by reading its diff) and fix(sdd): stop task-brief leaking trailing plan sections #2359 (ends a task at
trailing plan sections like
## Self-review; also gated on its ownfence-tracking variable never resetting, so it does not cover this case
either). Neither closes or references task-brief: an unclosed fence makes one task's brief absorb every later task, at exit 0 (Claude Code) #2436. No open or merged PR
mentions task-brief: an unclosed fence makes one task's brief absorb every later task, at exit 0 (Claude Code) #2436.
Environment tested
Ran
tests/claude-code/test-sdd-workspace.sh: added the issue's repro andits closed-fence control as two new assertions. Confirmed RED against the
unmodified script (stashed the fix, re-ran:
[FAIL] task-brief fails (exit 4) and writes no brief when the plan has an unclosed fence) andGREEN with the fix; full suite 26/26 assertions pass.
scripts/lint-shell.sh(default and
--strict) is clean on both changed files.Evaluation
Rigor
superpowers:writing-skillsandcompleted adversarial pressure testing (paste results below) — N/A,
this is a bash script fix (
task-brief's awk extraction), not skill prose.(confirmed the failure path reproduces exactly as described in the
issue before the fix; confirmed the closed-fence control path is
byte-for-byte unchanged after the fix)
rationalizations, "human partner" language) without extensive evals
showing the change is an improvement
Human review
Opened as a draft pending that human review — not to be merged as-is.