Skip to content

fix(subagent-driven-development): namespace SDD scratch workspace by plan#1949

Open
natem1095 wants to merge 1 commit into
obra:mainfrom
natem1095:fix/sdd-workspace-namespace-collision
Open

fix(subagent-driven-development): namespace SDD scratch workspace by plan#1949
natem1095 wants to merge 1 commit into
obra:mainfrom
natem1095:fix/sdd-workspace-namespace-collision

Conversation

@natem1095

Copy link
Copy Markdown

Problem

scripts/task-brief and scripts/review-package write SDD's scratch
artifacts to a fixed per-repo path (.superpowers/sdd/task-N-brief.md,
and — per SKILL.md's Durable Progress section — .superpowers/sdd/progress.md),
scoped only by task number, not by plan/epic/session.

Two unrelated orchestrator sessions running subagent-driven-development
concurrently in the same working tree, each numbering their tasks from 1,
collide on the same filenames and silently overwrite each other's briefs,
reports, and progress ledger. Observed live: a task-1-report.md at that
path was overwritten by two unrelated task sequences before a third
session's own Task 1 implementer overwrote it a third time.

Fix

  • sdd-workspace gains an optional --ns NAMESPACE that scopes the
    returned directory to a subdirectory of .superpowers/sdd/. Omitting it
    preserves the exact prior behavior (flat .superpowers/sdd/), so this is
    fully backward compatible.
  • task-brief derives NAMESPACE automatically from PLAN_FILE's
    basename (minus extension) and passes --ns internally — no change to
    task-brief's own call sites.
  • review-package accepts --ns NAMESPACE (parsed as a flag so it can
    appear anywhere relative to BASE/HEAD/OUTFILE, preserving the
    existing positional contract).
  • SKILL.md now defines NAMESPACE once (right after reading the plan)
    in the Durable Progress section, and threads it through every
    review-package invocation and the progress ledger path
    (scripts/sdd-workspace --ns NAMESPACE), so briefs, reports, review
    packages, and the ledger all land in the same per-plan subdirectory.

Testing

Extended tests/claude-code/test-sdd-workspace.sh with a new scenario:
two unrelated plans (plan-a.md, plan-b.md), each with a "Task 1",
run through task-brief in the same repo — asserts the two briefs land
in different files with the correct per-plan content, that
sdd-workspace --ns resolves the namespaced subdirectory, and that
review-package --ns writes under it too.

$ bash tests/claude-code/test-sdd-workspace.sh
=== Test: sdd-workspace ===
  [PASS] prints <repo-root>/.superpowers/sdd
  [PASS] self-ignoring .gitignore created with '*'
  [PASS] workspace invisible to git status
  [PASS] git add -A does not stage the workspace
  [PASS] task-brief writes its brief under the workspace
  [PASS] review-package writes its diff under the workspace
  [PASS] task-brief namespaces unrelated plans' Task 1 briefs into different files
  [PASS] each namespaced brief holds only its own plan's content
  [PASS] sdd-workspace --ns resolves the namespaced subdirectory
  [PASS] review-package --ns writes its diff under the namespaced subdirectory
  [PASS] linked worktree resolves its own distinct workspace
  [PASS] worktree workspace invisible to git status

PASS

All 8 pre-existing assertions still pass unmodified, confirming the
no---ns path is unchanged.

…plan

scripts/task-brief and scripts/review-package wrote to a fixed per-repo
path (.superpowers/sdd/task-N-brief.md, .superpowers/sdd/progress.md)
scoped only by task NUMBER, not by plan. Two unrelated orchestrator
sessions running the skill concurrently in the same working tree, each
numbering tasks from 1, silently overwrote each other's briefs, reports,
and progress ledger — observed live: a task-1-report.md was clobbered by
two unrelated task sequences before a third session's own Task 1 overwrote
it again.

sdd-workspace now takes an optional --ns NAMESPACE that scopes the
returned directory to a subdirectory. task-brief derives NAMESPACE
automatically from PLAN_FILE's basename, so its own call sites need no
change. review-package and the progress ledger path in SKILL.md now take
an explicit --ns, with SKILL.md instructing the controller to compute
NAMESPACE once from the plan and reuse it. Omitting --ns preserves the
prior flat-directory behavior for backward compatibility.
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