Repository navigation
fix(sdd): remove empty task brief file when task is not found (#2611) - #2613
Open
chiragjangiir wants to merge 1 commit into
Open
chiragjangiir wants to merge 1 commit into
chiragjangiir wants to merge 1 commit into
Conversation
) When `task-brief` extracts a task from an implementation plan, shell redirection creates `$out` before verifying whether any task content was found. If no matching task heading exists, `task-brief` exits 3 with a 'task N not found' error but previously left an empty file at `$out`. This empty file can mislead downstream tooling or implementer subagents into reading an empty brief rather than failing loudly. Delete `$out` when no content was matched and add regression test coverage in `test-sdd-workspace.sh`.
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 your human partner asked you to do, in their words:
Autonomous open-source portfolio audit and contribution session: identify and fix genuine open-source defects with verified regression test coverage following project conventions and guidelines.
Human-authored summary (required, under 200 words)
When running
task-brief PLAN_FILE TASK_NUMBER, if the specified task heading does not exist in the plan file, shell redirection (> "$out") created an empty file before checking[ ! -s "$out" ]. When the check triggered,task-brieflogged an error to stderr and exited with code 3, but left the 0-byte file in the workspace. Downstream tools or implementers checking for the file's presence encounter an empty brief rather than failing cleanly.This PR ensures that on the not-found exit path, the empty file is deleted with
rm -f "$out"before exiting 3. A regression test is added totests/claude-code/test-sdd-workspace.shconfirming that a nonexistent task number exits with 3 and leaves no brief file behind.What problem are you trying to solve?
Issue #2611:
task-briefcreatestask-N-brief.mdbefore searching for task N. If task N is not found, it exits with status 3 but leaves an empty file on disk. Subsequent workflows inspecting file existence see a present (empty) brief rather than detecting that the brief was never generated.What does this PR change?
Adds
rm -f "$out"inside theif [ ! -s "$out" ]branch inskills/subagent-driven-development/scripts/task-briefbefore printing the error and exiting 3. Adds an automated regression assertion intests/claude-code/test-sdd-workspace.sh.Is this change appropriate for the core library?
Yes,
task-briefis a core SDD helper script distributed with the subagent-driven-development skill.What alternatives did you consider?
Writing to a temporary file and atomically moving on success. Directly cleaning up the empty file in the failure branch is smaller, avoids cross-device/temp directory issues, and directly fixes the root cause.
Does this PR contain multiple unrelated changes?
No, only the fix in
task-briefand its regression test intest-sdd-workspace.sh.Existing PRs
Environments tested
Rigor
Human review