Skip to content

fix(sdd): remove empty task brief file when task is not found (#2611) - #2613

Open
chiragjangiir wants to merge 1 commit into
obra:devfrom
chiragjangiir:fix/2611-clean-empty-task-brief-dev
Open

chiragjangiir wants to merge 1 commit into
obra:devfrom
chiragjangiir:fix/2611-clean-empty-task-brief-dev

Conversation

@chiragjangiir

Copy link
Copy Markdown

Who is submitting this PR? (required)

Field Value
Your model + version Gemini 3.8 Flash (Low)
Harness + version Antigravity IDE (macOS arm64)
All plugins installed None
Human partner who reviewed this diff Chirag Jangir (@chiragjangiir)

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-brief logged 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 to tests/claude-code/test-sdd-workspace.sh confirming that a nonexistent task number exits with 3 and leaves no brief file behind.

What problem are you trying to solve?

Issue #2611: task-brief creates task-N-brief.md before 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 the if [ ! -s "$out" ] branch in skills/subagent-driven-development/scripts/task-brief before printing the error and exiting 3. Adds an automated regression assertion in tests/claude-code/test-sdd-workspace.sh.

Is this change appropriate for the core library?

Yes, task-brief is 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-brief and its regression test in test-sdd-workspace.sh.

Existing PRs

Environments tested

Harness (e.g. Claude Code, Cursor) Harness version Model Model version/ID
Antigravity IDE Local Gemini 3.8 Flash Direct CLI / bash execution

Rigor

  • This change was tested adversarially, not just on the happy path (verified exit code 3 and verified nonexistent file).
  • Clean shell execution and verified test-sdd-workspace.sh test suite passes all 26 assertions.

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

)

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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant