repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/ultra/workflows/bug.json

Raw
{
	"name": "bug",
	"description": "Investigate a bug, prove it with a regression test, implement the fix, then verify adversarially.",
	"args": { "hint": "<bug>", "params": ["bug"] },
	"schemas": {
		"Investigation": {
			"type": "object",
			"properties": {
				"summary": { "type": "string" },
				"reproduction": { "type": "string" },
				"likely_cause": { "type": "string" },
				"files": { "type": "array", "items": { "type": "string" } }
			},
			"required": ["summary", "reproduction", "likely_cause", "files"]
		},
		"Regression": {
			"type": "object",
			"properties": {
				"ready": {
					"type": "boolean",
					"description": "true only when the regression test fails for the expected bug"
				},
				"test_files": { "type": "array", "items": { "type": "string" } },
				"command": { "type": "string" },
				"failure": { "type": "string" }
			},
			"required": ["ready", "test_files", "command", "failure"]
		},
		"Fix": {
			"type": "object",
			"properties": {
				"fixed": {
					"type": "boolean",
					"description": "true only when the regression test and relevant checks pass"
				},
				"summary": { "type": "string" },
				"modified_files": { "type": "array", "items": { "type": "string" } },
				"checks": { "type": "array", "items": { "type": "string" } }
			},
			"required": ["fixed", "summary", "modified_files", "checks"]
		},
		"Verdict": {
			"type": "object",
			"properties": {
				"dimension": { "type": "string" },
				"passed": { "type": "boolean" },
				"findings": { "type": "array", "items": { "type": "string" } }
			},
			"required": ["dimension", "passed", "findings"]
		}
	},
	"phases": [
		{
			"id": "investigate",
			"kind": "single",
			"step": {
				"summary": "Investigate bug: {args.bug}",
				"prompt": "Investigate this bug without modifying files: {args.bug}. Reproduce or trace the failing path, inspect callers and shared routes, identify the likely root cause, and list relevant files. Use read/grep/find/bash as needed. Return JSON matching Investigation.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "medium",
				"thinkingLevel": "high",
				"schema": "Investigation"
			}
		},
		{
			"id": "regression",
			"kind": "single",
			"step": {
				"summary": "Create regression test: {args.bug}",
				"prompt": "Create the smallest regression test for this bug: {args.bug}. Investigation: {investigate.results}. Do not fix production code. Run the focused test and set ready=true only when it fails for the expected reason, not from a test error. Return JSON matching Regression.",
				"tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
				"model": "big",
				"thinkingLevel": "medium",
				"schema": "Regression"
			}
		},
		{
			"id": "fix",
			"kind": "single",
			"when": "{regression.results | where ready}",
			"step": {
				"summary": "Fix root cause: {args.bug}",
				"prompt": "Fix the root cause of this bug: {args.bug}. Investigation: {investigate.results}. Regression evidence: {regression.results}. Prefer the shared route over caller-specific patches. Make the minimum production change, run the regression test and relevant checks, and set fixed=true only when they pass. Then return JSON matching Fix.",
				"tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
				"model": "big",
				"thinkingLevel": "medium",
				"schema": "Fix"
			}
		},
		{
			"id": "verify",
			"kind": "fanout",
			"when": "{fix.results | where fixed}",
			"over": ["regression", "correctness", "security"],
			"step": {
				"summary": "Verify fix from {item} perspective",
				"prompt": "Adversarially verify the bug fix from the {item} perspective. Bug: {args.bug}. Investigation: {investigate.results}. Regression: {regression.results}. Fix: {fix.results}. Inspect the diff and run focused checks as needed; do not modify files. Set passed=false and list concrete findings if the fix is incomplete, the regression test is weak, or new risk was introduced. Echo dimension as {item}. Return JSON matching Verdict.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "big",
				"thinkingLevel": "high",
				"schema": "Verdict"
			}
		}
	],
	"return": "{verify.results}"
}