fix(automation): triage owns routing for every portal issue #39

Merged
shad0w merged 3 commits from fix/triage-owns-portal-routing into master 2026-06-19 08:45:22 +00:00
2 changed files with 20 additions and 7 deletions
Showing only changes of commit 520b1527e0 - Show all commits

View file

@ -111,9 +111,10 @@ portal ──(triage)──▶ triaged + claude-queue ─▶ claude-working ─
```
- **Triage owns routing for every `portal` issue.** Each untriaged portal issue is
triaged once (`maxTriagePerRun` per run); triage adds `triaged` plus `claude-queue`
or `interactive` and posts a breakdown. Triage skips an issue only once it carries
`triaged`, `interactive`, `claude-working`, `claude-pr`, or `claude-failed`.
triaged once (`maxTriagePerRun` per run); triage adds `triaged`, a routing label
(`claude-queue` or `interactive`), a type label (`bug` or `feature`), and posts a
breakdown. Triage skips an issue only once it carries `triaged`, `interactive`,
`claude-working`, `claude-pr`, or `claude-failed`.
- **`claude-queue` alone does NOT skip triage on a portal issue.** The Report Issue
button may stamp `claude-queue` at creation; triage still claims the issue and
decides routing (stripping the stray `claude-queue` if it routes to `interactive`).

View file

@ -171,7 +171,7 @@ while [ "$t" -lt "$n_triage" ]; do
log "-- Triaging #$num: $title"
reset_clone
comments=$(comments_block "$num")
rm -f "$WORKDIR/CLAUDE_TRIAGE_LABEL.txt" "$WORKDIR/CLAUDE_TRIAGE.md"
rm -f "$WORKDIR/CLAUDE_TRIAGE_LABEL.txt" "$WORKDIR/CLAUDE_TRIAGE_TYPE.txt" "$WORKDIR/CLAUDE_TRIAGE.md"
prompt_file=$(mktemp)
{
@ -192,8 +192,11 @@ while [ "$t" -lt "$n_triage" ]; do
printf '%s\n' " - interactive = needs human steering: ambiguous or underspecified, needs business content"
printf '%s\n' " or a design decision, a schema migration, permissions/payments changes, an external"
printf '%s\n' " dependency, or a large feature needing visual verification."
printf '%s\n' "3. Write TWO files in the repository root, nothing else:"
printf '%s\n' " - CLAUDE_TRIAGE_LABEL.txt -- a single line with EXACTLY one word: claude-queue OR interactive"
printf '%s\n' "3. Classify the issue as a BUG (something is broken / not working as intended) or a"
printf '%s\n' " FEATURE (new capability or a change/enhancement to existing behaviour)."
printf '%s\n' "4. Write THREE files in the repository root, nothing else:"
printf '%s\n' " - CLAUDE_TRIAGE_LABEL.txt -- one line, EXACTLY one word: claude-queue OR interactive"
printf '%s\n' " - CLAUDE_TRIAGE_TYPE.txt -- one line, EXACTLY one word: bug OR feature"
printf '%s\n' " - CLAUDE_TRIAGE.md -- your requirements breakdown as markdown: action items, files/areas"
printf '%s\n' " involved, open questions, and a final one-line 'Routing rationale: ...'."
} > "$prompt_file"
@ -212,8 +215,17 @@ while [ "$t" -lt "$n_triage" ]; do
fi
breakdown=""
[ -f "$WORKDIR/CLAUDE_TRIAGE.md" ] && breakdown=$(cat "$WORKDIR/CLAUDE_TRIAGE.md")
type=""
if [ -f "$WORKDIR/CLAUDE_TRIAGE_TYPE.txt" ]; then
traw=$(cat "$WORKDIR/CLAUDE_TRIAGE_TYPE.txt")
if printf '%s' "$traw" | grep -qiw feature; then type=feature
elif printf '%s' "$traw" | grep -qiw bug; then type=bug; fi
fi
reset_clone
# Classify bug/feature regardless of routing outcome (additive, never clears).
[ -n "$type" ] && { add_labels "$num" "$type"; log "Classified #$num as $type"; }
if [ -z "$label" ]; then
log "Triage for #$num produced no valid decision; leaving for a human"
# Mark triaged + strip any button-stamped claude-queue so it is NOT auto-fixed.
@ -238,7 +250,7 @@ while [ "$t" -lt "$n_triage" ]; do
$note
**Routing:** \`$label\`"
**Routing:** \`$label\`${type:+ | **Type:** \`$type\`}"
log "Triaged #$num -> $label"
done