@@ -31,22 +31,55 @@ nodes:
3131
3232 Request: $ARGUMENTS
3333
34- Rules:
35- - If the message contains an explicit issue number (e.g., "#709", "issue 709", "709"), extract that number.
36- - If the message is ambiguous (e.g., "fix the SQLite timestamp bug"), use `gh issue list` to search for matching issues and pick the best match.
37-
38- CRITICAL: Your final output must be ONLY the bare number with no quotes, no markdown, no explanation. Example correct output: 709
34+ A reference is an ATOMIC pair: a number, and the repo it belongs to. Never take the
35+ number from one reference and the repo from another — that combination fetches an
36+ issue nobody asked for.
37+
38+ Recognised reference forms, each yielding one complete pair:
39+ - `#709`, `issue 709`, `709` -> {issue_number: "709", repo: ""}
40+ - `owner/repo#709` -> {issue_number: "709", repo: "owner/repo"}
41+ - `https://github.com/owner/repo/issues/709`
42+ -> {issue_number: "709", repo: "owner/repo"}
43+
44+ An empty `repo` means "the current checkout" — the common case. NEVER guess a repo.
45+
46+ Then:
47+ - Exactly one reference -> use it.
48+ - Several references, all resolving to the SAME pair -> use it.
49+ - Several DIFFERENT references (e.g. a bare number and a cross-repo URL) -> the
50+ request is ambiguous. Do NOT pick one. Fail with a message naming every pair you
51+ found and asking which was meant. Guessing here silently investigates the wrong
52+ issue, which is worse than stopping.
53+ - No reference at all (e.g. "fix the SQLite timestamp bug") -> search the CURRENT
54+ repo with `gh issue list`, pick the best match, and leave `repo` empty.
55+ output_format :
56+ type : object
57+ properties :
58+ issue_number :
59+ type : string
60+ repo :
61+ type : string
62+ required :
63+ - issue_number
64+ - repo
3965
4066 - id : fetch-issue
4167 bash : |
42- # $extract-issue-number.output is injected pre-quoted by Archon — do NOT
43- # wrap it in double quotes (that corrupts the value; see issue #1884).
44- ISSUE_NUM=$(echo $extract-issue-number.output | grep -oE '[0-9]+' | head -1)
45- if [ -z "$ISSUE_NUM" ]; then
46- echo "Failed to extract issue number from:" $extract-issue-number.output >&2
68+ # Substitutions are injected already shell-quoted by Archon — assign them
69+ # unquoted, then quote normally as locals (see #1884).
70+ num=$extract-issue-number.output.issue_number
71+ repo=$extract-issue-number.output.repo
72+ if ! printf '%s' "$num" | grep -qE '^[0-9]+$'; then
73+ echo "extract-issue-number did not yield a numeric issue id: $num" >&2
4774 exit 1
4875 fi
49- gh issue view "$ISSUE_NUM" --json title,body,labels,comments,state,url,author
76+ # An explicit owner/repo must be preserved: `gh issue view <n>` resolves against
77+ # the CURRENT checkout, so a cross-repo URL would silently read this repo's #<n>.
78+ if [ -n "$repo" ]; then
79+ gh issue view "$num" --repo "$repo" --json title,body,labels,comments,state,url,author
80+ else
81+ gh issue view "$num" --json title,body,labels,comments,state,url,author
82+ fi
5083 depends_on : [extract-issue-number]
5184
5285 - id : classify
0 commit comments