Skip to content

fix(plan): fill task issue numbers at apply time instead of predicting them - #12

Open
matthewtsmith wants to merge 1 commit into
mainfrom
fix/plan-task-placeholders
Open

matthewtsmith wants to merge 1 commit into
mainfrom
fix/plan-task-placeholders

Conversation

@matthewtsmith

Copy link
Copy Markdown
Member

Problem

The planner had to predict the issue numbers its new tasks would get, because .issues.json had no way for one new task to name another. Those predictions went into every Depends on line and e2e file name. Any issue or PR opened between drafting and approval shifted the real numbers.

In litart phase 9 the plan predicted that task N would be #N+279. Two builder PRs (#280, #281) opened while the plan waited for approval, so the tasks landed on #N+281. Every new-to-new dependency then pointed two numbers too low, mostly at closed issues. #288 and #289 were dispatched before their real dependencies existed, and both builders blocked.

Fix

  • Task bodies in .issues.json write {{task:K}} for the plan's K-th task (1-based, so a dependency reads #{{task:3}}) and {{issue}} for the task's own number (for example e2e/{{issue}}-<slug>.spec.ts).
  • applyPlan creates or reuses every issue first, then fills the placeholders with the real numbers. Each task gets agent-ready only after its own body is filled.
  • A {{task:K}} outside the plan refuses the whole plan before any write. The error names the file and the task, and the tick fails the same way a schema error does today.
  • If an apply dies between creating and filling, the retry reuses the issues by title and fills them.
  • A plan with no placeholders makes the same gh calls as before.
  • roles/planner.md explains the placeholders and tells the planner never to predict numbers. Its JSON example uses the placeholders. The README documents them and adds a troubleshooting entry for the new error.

Tests

  • src/phase.test.ts: filling, detection, and out-of-range errors.
  • src/loop.test.ts: apply_plan fills created and existing tasks with the numbers they actually got, and does not re-edit a created task that has nothing to fill. Each task's body is filled before it is armed. A bad placeholder throws with no gh writes.
  • src/roles.test.ts: {{issue}} is allowed in planner.md as a placeholder that apply_plan fills, not the prompt composer.

pnpm lint, pnpm typecheck, pnpm test (714 passed) and pnpm build are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JrFSqr3eJsNihHcgYph1hB

…g them

The planner had to guess the issue numbers its new tasks would get and wrote
those guesses into every `Depends on` line and e2e file name. Any issue or PR
opened between drafting and approval shifted the real numbers, so tasks
pointed at the wrong, already-closed issues and were dispatched before their
dependencies existed (litart phase 9: off by two after two builder PRs).

Plan task bodies now write `{{task:K}}` for the plan's K-th task and
`{{issue}}` for their own number. apply_plan creates or reuses every issue
first, then fills both with the real numbers before arming a task. A
`{{task:K}}` outside the plan refuses the whole plan before any write.
Plans without placeholders apply exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrFSqr3eJsNihHcgYph1hB
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