feat(prometheus): integrate hierarchical plan generation#1889
feat(prometheus): integrate hierarchical plan generation#1889rentiansheng wants to merge 2 commits intocode-yeongyu:devfrom
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
5 issues found across 27 files
Confidence score: 3/5
- Several medium-high severity issues in
src/agents/prometheus/plan-generation.tscould cause tool misuse: prompt examples reference a non-existentpriorityarg and promote a flawed task-creation workflow that may yield race conditions or hallucinated IDs. src/features/claude-tasks/tree-numbering.tshas concrete numbering bugs (duplicate sibling indexes and deleted roots never numbered), which can affect visible task ordering for users.- Given multiple user-facing logic issues (severity ~6–7/10), there is some regression risk; this PR feels slightly risky to merge without fixes.
- Pay close attention to
src/agents/prometheus/plan-generation.tsandsrc/features/claude-tasks/tree-numbering.ts- prompt/tool mismatches and numbering logic errors.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/agents/prometheus/plan-generation.ts">
<violation number="1" location="src/agents/prometheus/plan-generation.ts:41">
P1: Rule violated: **Opencode Compatibility**
The `task_create` prompt examples use `priority` as a top-level parameter, but the actual `task_create` tool (defined in `src/tools/task/task-create.ts`) has no `priority` arg. Priority must be passed inside the `metadata` field: `metadata: { priority: "high" }`. All 8 example calls will either silently drop the priority or fail validation when the AI follows this template.</violation>
<violation number="2" location="src/agents/prometheus/plan-generation.ts:51">
P1: Flawed few-shot example for task creation workflow encourages race condition/hallucinated IDs</violation>
</file>
<file name="src/agents/prometheus/markdown-renderer-v2.ts">
<violation number="1" location="src/agents/prometheus/markdown-renderer-v2.ts:20">
P2: Inefficient O(N²) tree reconstruction - `getNumberingPath` rebuilds the task tree for each task</violation>
</file>
<file name="src/features/claude-tasks/tree-numbering.ts">
<violation number="1" location="src/features/claude-tasks/tree-numbering.ts:86">
P2: Deleted root tasks are never numbered due to flawed lookup logic: `activeRoots` filters out deleted tasks, but the fallback numbering logic for deleted roots searches within `activeRoots`, causing a guaranteed lookup failure (-1) for any deleted root task. This also prevents numbering of their subtrees.</violation>
<violation number="2" location="src/features/claude-tasks/tree-numbering.ts:97">
P1: Incorrect sibling index calculation assigns the same duplicate index to all deleted siblings. The filter().length - 1 always returns the last position for every task, not each task's specific position.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Pay close attention to src/agents/prometheus/plan-generation.ts and src/features/claude-tasks/tree-numbering.ts - prompt/tool mismatches and numbering logic errors. |
- Update system-prompt.ts to include PROMETHEUS_PLAN_TEMPLATE_V2 - Prometheus now generates v2 hierarchical plans for complex tasks - Update plan-generation.ts to conditionally use task_create/task_update when available - Fall back to TodoWrite when task_system disabled - Add step-by-step guidance for both tooling paths - Maintain V2 hierarchical TODO format requirement - Resolve conflicts with tasks-todowrite-disabler hook expectations issue code-yeongyu#1785
… numbering bugs
- Fix task_create examples to use metadata: { priority } instead of top-level priority parameter
- Fix task creation workflow example to demonstrate proper ID capture from response
- Add hierarchical parent-child examples for task_create using parentID (1., 1.1, 1.1.1 format)
- Add hierarchical examples for TodoWrite showing nested numbering (1., 1.1, 1.1.1 format)
- Both flat (sequential) and hierarchical (parent-child) workflows now documented
- Optimize markdown-renderer-v2 to eliminate O(N²) tree reconstruction
- Fix deleted root task numbering lookup failure in tree-numbering.ts
- Fix duplicate sibling index calculation in tree-numbering.ts
- Add regression tests for deleted task numbering scenarios
|
Going forward, I plan to add a todo list to the chat process before "Generate work plan to .sisyphus/plans/user-management.md", allowing discussion of the plan. |
c9c1410 to
0f7761b
Compare
|
@rentiansheng Thanks for the PR! The rebase looks good and it is now mergeable. However, the Cubic AI reviewer identified 5 issues that need attention before merging:
Also the CLA check is currently failing - please make sure to sign it. Could you address these issues? Happy to re-review once fixed. |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
Summary
Changes
Screenshots
Testing
bun run typecheck bun testRelated Issues
Closes #1785
Summary by cubic
Adds hierarchical plan generation (V2) to Prometheus with numbered task trees, markdown rendering, and a new task_tree tool. Backward compatible (v1 by default) and addresses #1785.
New Features
Bug Fixes
Written for commit 0f7761b. Summary will update on new commits.