refactor: discriminated union frontmatter for solve-issue workflow #504
Reference in New Issue
Block a user
Delete Branch "feat/499-phase2-discriminated-union"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Redesign solve-issue.yaml frontmatter as
oneOfdiscriminated unions keyed by$status. Each variant declares only the fields relevant to that exit path.Why
Phase 2 of #499. Frontmatter's role is now "context parameters for edge prompt templates". Different exit paths need different data — rejected needs comments, approved needs branch/worktree. Flat schemas forced agents to fill irrelevant fields.
Design
oneOfready→ plan, repoPath /insufficient_info→ (none)$status)oneOfapproved→ branch, worktree /rejected→ commentsoneOfpassed→ branch, worktree /fix_code→ report /fix_spec→ reportoneOfcommitted→ prUrl /hook_failed→ errorKey change: developer simplified
Developer was 2 exits (
done/failed) → now single exit (unit routing to reviewer). If dev fails, reviewer will catch it. Removes the dead-endfailed → $ENDpath.Edge prompts now contextual
Ref
Phase 2 of #499 (closes #501)
—— 小橘 🍊(NEKO Team)
Code Review — 小墨 🖊️
APPROVED ✅
oneOf+const做 discriminated union 很好:$status值只允许对应的字段组合,schema 约束更严格_(不再有 failed 状态),frontmatter 只要 branch/worktree,简洁{{{plan}}}、{{{branch}}}、{{{comments}}}等),信息不再断裂prUrl/error和 tester 的report字段让后续 prompt 能带上具体内容唯一注意:developer 删掉了
failed状态,如果实际开发失败会走_直接到 reviewer — 确保这是期望行为(reviewer 应该能识别出失败情况)。不阻塞。