From dda6af130c1822b47302e755c5ab72705cb5ae0f Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 29 Dec 2025 11:45:31 +0800 Subject: [PATCH] refactor(issue): unify solution ID format to SOL-{issue-id}-{seq} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update solution-schema.json pattern to support new format - Add Solution ID Format specification to plan.md - Fix JSON parsing with extractJsonFromMarkdown + try-catch - Update all examples in agent and prompt files: - issue-plan-agent.md - issue-queue-agent.md - issue-execute.md - issue-queue.md - queue.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/agents/issue-plan-agent.md | 14 +++++++------- .claude/agents/issue-queue-agent.md | 4 ++-- .claude/commands/issue/plan.md | 14 +++++++++++++- .claude/commands/issue/queue.md | 6 +++--- .../cli-templates/schemas/solution-schema.json | 5 +++-- .codex/prompts/issue-execute.md | 6 +++--- .codex/prompts/issue-queue.md | 6 +++--- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.claude/agents/issue-plan-agent.md b/.claude/agents/issue-plan-agent.md index e77a3650..059ed248 100644 --- a/.claude/agents/issue-plan-agent.md +++ b/.claude/agents/issue-plan-agent.md @@ -241,13 +241,13 @@ OUTPUT FORMAT: "conflicts": [{ "type": "file_conflict|api_conflict|data_conflict|dependency_conflict|architecture_conflict", "severity": "high|medium|low", - "solutions_affected": ["SOL-001", "SOL-002"], + "solutions_affected": ["SOL-GH-123-1", "SOL-GH-123-2"], "summary": "brief description", "resolution_strategy": "sequential|parallel_with_coordination|refactor_merge", - "recommended_order": ["SOL-001", "SOL-002"], + "recommended_order": ["SOL-GH-123-1", "SOL-GH-123-2"], "rationale": "why this order" }], - "safe_parallel": [["SOL-003", "SOL-004"]] + "safe_parallel": [["SOL-GH-124-1", "SOL-GH-125-1"]] } `; @@ -287,15 +287,15 @@ Each line is a solution JSON containing tasks. Schema: `cat .claude/workflows/cl ```json { "bound": [{ "issue_id": "...", "solution_id": "...", "task_count": N }], - "pending_selection": [{ "issue_id": "...", "solutions": [{ "id": "SOL-001", "description": "...", "task_count": N }] }], + "pending_selection": [{ "issue_id": "GH-123", "solutions": [{ "id": "SOL-GH-123-1", "description": "...", "task_count": N }] }], "conflicts": [{ "type": "file_conflict|api_conflict|data_conflict|dependency_conflict|architecture_conflict", "severity": "high|medium|low", - "solutions_affected": ["SOL-001", "SOL-002"], + "solutions_affected": ["SOL-GH-123-1", "SOL-GH-123-2"], "summary": "brief description", "resolution_strategy": "sequential|parallel_with_coordination", - "recommended_order": ["SOL-001", "SOL-002"], - "recommended_resolution": "Use sequential execution: SOL-001 first", + "recommended_order": ["SOL-GH-123-1", "SOL-GH-123-2"], + "recommended_resolution": "Use sequential execution: SOL-GH-123-1 first", "resolution_options": [{ "strategy": "...", "rationale": "..." }] }] } diff --git a/.claude/agents/issue-queue-agent.md b/.claude/agents/issue-queue-agent.md index f4d1215f..88641858 100644 --- a/.claude/agents/issue-queue-agent.md +++ b/.claude/agents/issue-queue-agent.md @@ -37,7 +37,7 @@ color: orange { solutions: [{ issue_id: string, // e.g., "ISS-20251227-001" - solution_id: string, // e.g., "SOL-20251227-001" + solution_id: string, // e.g., "SOL-ISS-20251227-001-1" task_count: number, // Number of tasks in this solution files_touched: string[], // All files modified by this solution priority: string // Issue priority: critical | high | medium | low @@ -247,7 +247,7 @@ Queue Item ID format: `S-N` (S-1, S-2, S-3, ...) { "item_id": "S-1", "issue_id": "ISS-20251227-003", - "solution_id": "SOL-20251227-003", + "solution_id": "SOL-ISS-20251227-003-1", "status": "pending", "execution_order": 1, "execution_group": "P1", diff --git a/.claude/commands/issue/plan.md b/.claude/commands/issue/plan.md index c55f6150..dc6d6b7d 100644 --- a/.claude/commands/issue/plan.md +++ b/.claude/commands/issue/plan.md @@ -214,6 +214,8 @@ ${issueList} ### Generate Files \`.workflow/issues/solutions/{issue-id}.jsonl\` - Solution with tasks (schema: cat .claude/workflows/cli-templates/schemas/solution-schema.json) +**Solution ID Format**: \`SOL-{issue-id}-{seq}\` (e.g., \`SOL-GH-123-1\`, \`SOL-ISS-20251229-1\`) + ### Binding Rules - **Single solution**: Auto-bind via \`ccw issue bind --solution \` - **Multiple solutions**: Register only, return for user selection @@ -254,7 +256,17 @@ for (let i = 0; i < agentTasks.length; i += MAX_PARALLEL) { // Collect results from this chunk for (const { taskId, batchIndex } of taskIds) { const result = TaskOutput(task_id=taskId, block=true); - const summary = JSON.parse(result); + + // Extract JSON from potential markdown code blocks (agent may wrap in ```json...```) + const jsonText = extractJsonFromMarkdown(result); + let summary; + try { + summary = JSON.parse(jsonText); + } catch (e) { + console.log(`⚠ Batch ${batchIndex + 1}: Failed to parse agent result, skipping`); + updateTodo(`Plan batch ${batchIndex + 1}`, 'completed'); + continue; + } agentResults.push(summary); // Store for Phase 3 conflict aggregation for (const item of summary.bound || []) { diff --git a/.claude/commands/issue/queue.md b/.claude/commands/issue/queue.md index 46689ced..6d386e0e 100644 --- a/.claude/commands/issue/queue.md +++ b/.claude/commands/issue/queue.md @@ -89,7 +89,7 @@ Queue formation command using **issue-queue-agent** that analyzes all bound solu { "item_id": "S-1", "issue_id": "ISS-20251227-003", - "solution_id": "SOL-20251227-003", + "solution_id": "SOL-ISS-20251227-003-1", "status": "pending", "execution_order": 1, "execution_group": "P1", @@ -102,7 +102,7 @@ Queue formation command using **issue-queue-agent** that analyzes all bound solu { "item_id": "S-2", "issue_id": "ISS-20251227-001", - "solution_id": "SOL-20251227-001", + "solution_id": "SOL-ISS-20251227-001-1", "status": "pending", "execution_order": 2, "execution_group": "P1", @@ -115,7 +115,7 @@ Queue formation command using **issue-queue-agent** that analyzes all bound solu { "item_id": "S-3", "issue_id": "ISS-20251227-002", - "solution_id": "SOL-20251227-002", + "solution_id": "SOL-ISS-20251227-002-1", "status": "pending", "execution_order": 3, "execution_group": "S2", diff --git a/.claude/workflows/cli-templates/schemas/solution-schema.json b/.claude/workflows/cli-templates/schemas/solution-schema.json index 814688bc..c304138e 100644 --- a/.claude/workflows/cli-templates/schemas/solution-schema.json +++ b/.claude/workflows/cli-templates/schemas/solution-schema.json @@ -7,8 +7,9 @@ "properties": { "id": { "type": "string", - "description": "Unique solution identifier", - "pattern": "^SOL-[0-9]+$" + "description": "Unique solution identifier: SOL-{issue-id}-{seq}", + "pattern": "^SOL-.+-[0-9]+$", + "examples": ["SOL-GH-123-1", "SOL-ISS-20251229-1"] }, "description": { "type": "string", diff --git a/.codex/prompts/issue-execute.md b/.codex/prompts/issue-execute.md index 7959b9f8..17dcba24 100644 --- a/.codex/prompts/issue-execute.md +++ b/.codex/prompts/issue-execute.md @@ -40,7 +40,7 @@ ccw issue next This returns JSON with the full solution definition: - `item_id`: Solution identifier in queue (e.g., "S-1") - `issue_id`: Parent issue ID (e.g., "ISS-20251227-001") -- `solution_id`: Solution ID (e.g., "SOL-20251227-001") +- `solution_id`: Solution ID (e.g., "SOL-ISS-20251227-001-1") - `solution`: Full solution with all tasks - `execution_hints`: Timing and executor hints @@ -54,10 +54,10 @@ Expected solution structure: { "item_id": "S-1", "issue_id": "ISS-20251227-001", - "solution_id": "SOL-20251227-001", + "solution_id": "SOL-ISS-20251227-001-1", "status": "pending", "solution": { - "id": "SOL-20251227-001", + "id": "SOL-ISS-20251227-001-1", "description": "Description of solution approach", "tasks": [ { diff --git a/.codex/prompts/issue-queue.md b/.codex/prompts/issue-queue.md index 1fd350ce..de4e4ca3 100644 --- a/.codex/prompts/issue-queue.md +++ b/.codex/prompts/issue-queue.md @@ -78,8 +78,8 @@ Build a file → solutions mapping: ```javascript fileModifications = { - "src/auth.ts": ["SOL-001", "SOL-003"], - "src/api.ts": ["SOL-002"] + "src/auth.ts": ["SOL-ISS-001-1", "SOL-ISS-003-1"], + "src/api.ts": ["SOL-ISS-002-1"] } ``` @@ -129,7 +129,7 @@ Group assignment: { "item_id": "S-1", "issue_id": "ISS-001", - "solution_id": "SOL-001", + "solution_id": "SOL-ISS-001-1", "status": "pending", "execution_order": 1, "execution_group": "P1",