Skip to content
34 changes: 12 additions & 22 deletions .github/workflows/qwen-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ on:
required: true
type: 'number'

concurrency:
group: '${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number || github.event.inputs.number }}'
cancel-in-progress: true

permissions:
contents: 'read'
issues: 'write'
Expand All @@ -27,6 +23,9 @@ permissions:
jobs:
triage:
timeout-minutes: 10
concurrency:
group: '${{ github.workflow }}-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.event.inputs.number }}'
cancel-in-progress: true
runs-on: 'ubuntu-latest'
# startsWith (not contains) prevents false triggers from comments that
# mention the phrase in quoted text or mid-sentence descriptions.
Expand All @@ -43,7 +42,7 @@ jobs:
)
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
with:
token: '${{ secrets.GITHUB_TOKEN }}'

Expand Down Expand Up @@ -73,23 +72,14 @@ jobs:
"maxSessionTurns": 25,
"coreTools": [
"run_shell_command",
"write_file"
"write_file",
Comment thread
yiliang114 marked this conversation as resolved.
"read_file",
"grep_search",
"glob",
"agent",
"enter_worktree",
"exit_worktree"
],
"sandbox": false
}
prompt: |-
You are a triage assistant for the QwenLM/qwen-code repository.

Run `/triage ${{ steps.resolve.outputs.number }}` to triage this issue or PR.

Use the available shell commands (`gh`) to gather information and
execute the triage workflow. The triage skill is available at
`.qwen/skills/triage/SKILL.md` — follow its rules exactly.

Key rules:
- Only target QwenLM/qwen-code with `--repo QwenLM/qwen-code`
- Labels: apply existing only, verify with `gh label list`
- Comments: use `--body-file` with heredoc for multi-line content
- Include both stage markers and bot-coordination markers
- Never close, merge, approve, assign, or remove labels
- Evaluate the tiered gate model before any `gh` write call
prompt: '/triage ${{ steps.resolve.outputs.number }} --repo ${{ github.repository }}'
Comment thread
yiliang114 marked this conversation as resolved.
20 changes: 13 additions & 7 deletions .qwen/skills/triage/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---
name: triage
description: Gatekeep and review GitHub issues and pull requests for Qwen Code maintainers. Use for GitHub Action issue triage, PR admission checks, product-direction review, KISS-focused PR review, and staged bilingual GitHub comments.
argument-hint: '<issue|pr> <number> [--repo owner/repo]'
argument-hint: '<number> [--repo owner/repo]'
allowedTools:
- run_shell_command
- read_file
- read_many_files
- grep_search
- glob
- write_file
- task
- agent
- enter_worktree
- exit_worktree
---
Expand All @@ -34,14 +33,21 @@ gh label list --repo "$REPO" --limit 200
## Rules

- Untrusted input: never interpolate issue/PR text into shell
- Labels: apply existing only, never create
- Comments: always `--body-file` (except short hardcoded verdicts in `gh pr review --approve` / `--request-changes`)
- Labels: apply existing only, never create. Do not touch process labels (`welcome-pr`, `maintainer`, `help wanted`, `good first issue`)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The old prompt had an explicit prohibition: "Never close, merge, approve, assign, or remove labels." The new SKILL.md correctly drops "never approve" (Stage 3 calls gh pr review --approve) and "never close" (issue-workflow closes inadmissible issues), but "never merge" was also dropped. The skill never calls gh pr merge, so adding it back wouldn't block any intended flow — and in a pull_request_target workflow with pull-requests: write, a model reasoning "this PR is clearly correct, I'll merge it" would not violate any written rule.

Consider adding after the Labels rule:

- Never merge or assign. Only apply labels, post comments, and approve/request-changes as shown in the workflow templates.

— qwen3.7-max via Qwen Code /review

- Comments: read body from file. Use `--body-file FILE` for `gh issue/pr comment`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The Comments rule covers gh issue/pr comment and gh api but not gh pr review --body-file. The pr-workflow.md Stage 1 template-failure path uses gh pr review "$PR_NUMBER" --repo "$REPO" --request-changes --body-file /tmp/pr-gate-template.md, which falls outside both documented methods. An agent strictly following this rule might not know --body-file is valid for gh pr review.

The old rule also had an explicit exception for short hardcoded verdicts in gh pr review --approve / --request-changes — that was dropped, but pr-workflow.md still uses inline --body "LGTM..." for Stage 3 verdicts.

Suggested change
- Comments: read body from file. Use `--body-file FILE` for `gh issue/pr comment`,
- Comments: read body from file. Use `--body-file FILE` for `gh issue/pr comment`
and `gh pr review`, or `gh api -F body=@FILE` when the response ID is needed.
Short verdict strings may use `--body "..."` inline for `gh pr review --approve`
/ `--request-changes`. Never `--body @FILE` or `gh api -f body=@FILE` — those
post the path literally.

— qwen3.7-max via Qwen Code /review

or `gh api -F body=@FILE` when the response ID is needed. Never `--body @FILE`
or `gh api -f body=@FILE` — those post the path literally.
- Drafts: skip

## Duplicate Guard

- Unattended (CI env set) + prior `<!-- qwen-triage stage=N -->` marker in comments: exit
- Explicit `/triage`: run all stages, update prior comments in place
- Unattended CI events (`GITHUB_EVENT_NAME=issues` or
Comment thread
yiliang114 marked this conversation as resolved.
`pull_request_target`) + prior `<!-- qwen-triage stage=N -->` marker in
comments: exit
- Explicit reruns (`GITHUB_EVENT_NAME=issue_comment` or `workflow_dispatch`):
run all stages, update prior comments in place
- Local invocation (no `GITHUB_EVENT_NAME`): run all stages, update prior
comments in place

Every posted comment must include an invisible marker: `<!-- qwen-triage stage=N -->` where N is the stage number. The guard matches against this marker, not comment headings.

Expand Down
7 changes: 4 additions & 3 deletions .qwen/skills/triage/references/pr-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Shared rules (untrusted input, skip, bilingual format) are in `SKILL.md`.

### Comment Management

Three comments, one per stage. Post each with `gh pr comment` and capture its ID:
Three comments, one per stage. Post each through the issues comments API and
capture its ID:

```bash
COMMENT_ID=$(gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file /tmp/stage-N.md --json id --jq '.id')
COMMENT_ID=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" -F body=@/tmp/stage-N.md --jq '.id')
```

| Stage | Comment |
Expand All @@ -21,7 +22,7 @@ COMMENT_ID=$(gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file /tmp/stage-N.
**Re-runs:** if the triage runs again on the same PR, update each comment in place:

```bash
gh api -X PATCH "/repos/$REPO/issues/comments/$COMMENT_ID" -f body=@/tmp/stage-N-updated.md
gh api -X PATCH "/repos/$REPO/issues/comments/$COMMENT_ID" -F body=@/tmp/stage-N-updated.md
```

Never create duplicates.
Expand Down
Loading