|
| 1 | +name: t1-fix-issue |
| 2 | +description: | |
| 3 | + ENGINE-PRIMITIVE TEST — not a quality workflow. Prompts are deliberately minimal; |
| 4 | + the point is to exercise the engine, not to produce good output. |
| 5 | +
|
| 6 | + Proves: bash node (stdout as output) · structured output + strict `.field` access · |
| 7 | + `when:` on a structured field · `cancel:` as a first-class outcome · `loop_group` |
| 8 | + self-heal, where BOTH the validation failure and the review findings feed the next |
| 9 | + implement iteration via `$LOOP_PREV` · `until:` signal · `max_iterations` bound. |
| 10 | +
|
| 11 | + NO ARTIFACTS. Nothing writes to $ARTIFACTS_DIR. Every hand-off between nodes is |
| 12 | + `$node.output`. This is the by-reference-vs-by-value experiment (#2123, #1848) run |
| 13 | + as a workflow: if in-and-out alone is sufficient here, that is evidence. |
| 14 | +
|
| 15 | + Usage: archon workflow run t1-fix-issue "<issue-number>" |
| 16 | +model: '@mini' |
| 17 | + |
| 18 | +nodes: |
| 19 | + - id: fetch |
| 20 | + depends_on: [] |
| 21 | + bash: | |
| 22 | + set -euo pipefail |
| 23 | + gh issue view "$ARGUMENTS" --json number,title,body,comments |
| 24 | +
|
| 25 | + - id: assess |
| 26 | + depends_on: [fetch] |
| 27 | + prompt: | |
| 28 | + $fetch.output |
| 29 | +
|
| 30 | + Read the code this issue refers to. Is the problem real and worth fixing now? |
| 31 | + output_format: |
| 32 | + type: object |
| 33 | + properties: |
| 34 | + verdict: |
| 35 | + type: string |
| 36 | + enum: ['fix', 'skip'] |
| 37 | + reason: |
| 38 | + type: string |
| 39 | + required: [verdict, reason] |
| 40 | + |
| 41 | + - id: bail |
| 42 | + depends_on: [assess] |
| 43 | + when: "$assess.output.verdict == 'skip'" |
| 44 | + cancel: 'Not worth fixing — $assess.output.reason' |
| 45 | + |
| 46 | + - id: build |
| 47 | + depends_on: [assess] |
| 48 | + when: "$assess.output.verdict == 'fix'" |
| 49 | + loop_group: |
| 50 | + until: 'BUILD-CLEAN' |
| 51 | + max_iterations: 3 |
| 52 | + nodes: |
| 53 | + - id: implement |
| 54 | + depends_on: [] |
| 55 | + prompt: | |
| 56 | + Fix this issue with the smallest change that works, then commit. |
| 57 | + Do not write any report files — your reply is the only output that matters. |
| 58 | +
|
| 59 | + $fetch.output |
| 60 | +
|
| 61 | + Findings from the previous attempt (empty on the first iteration): |
| 62 | + $LOOP_PREV.review.output |
| 63 | +
|
| 64 | + - id: check |
| 65 | + depends_on: [implement] |
| 66 | + bash: | |
| 67 | + # This node must ALWAYS exit 0. A failing body node fails the whole |
| 68 | + # loop_group immediately — which would kill the very loop that exists to |
| 69 | + # fix the failure. So the gate REPORTS a verdict and `review` acts on it. |
| 70 | + # (Fail-fast is right for a linear DAG and wrong inside a self-heal loop.) |
| 71 | + set -o pipefail |
| 72 | + ok=1 |
| 73 | + echo '=== type-check ===' |
| 74 | + bun run type-check 2>&1 | tail -30 || ok=0 |
| 75 | + # `bun --filter`, never a bare `bun test <dir>`. A single invocation over a |
| 76 | + # whole package runs every file in ONE process, where conflicting |
| 77 | + # `mock.module()` calls poison each other — 616 spurious failures on an |
| 78 | + # unmodified tree. Each package's own `test` script carries the splits that |
| 79 | + # avoid it (see CLAUDE.md, "Test isolation"). |
| 80 | + for p in $(git diff --name-only "$BASE_BRANCH"...HEAD | grep '^packages/' | cut -d/ -f2 | sort -u); do |
| 81 | + echo "=== tests: @archon/$p ===" |
| 82 | + bun --filter "@archon/$p" test 2>&1 | tail -20 || ok=0 |
| 83 | + done |
| 84 | + if [ "$ok" = 1 ]; then echo 'VALIDATION: PASS'; else echo 'VALIDATION: FAIL'; fi |
| 85 | +
|
| 86 | + - id: review |
| 87 | + depends_on: [check] |
| 88 | + prompt: | |
| 89 | + Validation output — type-check, plus the tests of every package the diff touches: |
| 90 | + $check.output |
| 91 | +
|
| 92 | + Review the working-tree diff against $BASE_BRANCH. |
| 93 | +
|
| 94 | + The validation above is AUTHORITATIVE and you cannot overrule it. If it ends |
| 95 | + in `VALIDATION: FAIL`, do not reply BUILD-CLEAN no matter how the diff reads — |
| 96 | + say what failed and what to change. |
| 97 | +
|
| 98 | + If it ends in `VALIDATION: PASS` and you have no findings of your own, reply |
| 99 | + with exactly: BUILD-CLEAN |
| 100 | + Otherwise list what to fix, in one short paragraph. That text is fed back |
| 101 | + to the implementer verbatim on the next iteration. |
| 102 | +
|
| 103 | + - id: open-pr |
| 104 | + depends_on: [build] |
| 105 | + bash: | |
| 106 | + set -euo pipefail |
| 107 | + git push -u origin HEAD |
| 108 | + gh pr create --base "$BASE_BRANCH" --title "fix: issue $ARGUMENTS" --body "$(cat <<'ARCHON_EOF' |
| 109 | + Automated fix for issue $ARGUMENTS. |
| 110 | +
|
| 111 | + ## Assessment |
| 112 | + $assess.output.reason |
| 113 | +
|
| 114 | + ## Final review pass |
| 115 | + $build.output |
| 116 | + ARCHON_EOF |
| 117 | + )" |
0 commit comments