Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/qwen-triage-finalize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ jobs:
CI_BEGIN="<!-- qwen-triage-ci sha=${HEAD_SHA} -->"
CI_END='<!-- /qwen-triage-ci -->'
APPROVE_MARKER="<!-- qwen-triage approve-on-green sha=${HEAD_SHA} -->"
STATUS_MARKER='<!-- qwen-triage stage=status -->'
STATUS_MARKER='<!-- qwen-triage lifecycle -->'
LEGACY_STATUS_MARKER='<!-- qwen-triage stage=status -->'

if ! BOT_LOGIN="$(gh api user --jq '.login')" || [ -z "$BOT_LOGIN" ]; then
echo "::warning::Cannot resolve the bot identity; skipping (markers cannot be author-verified)."
Expand Down Expand Up @@ -320,8 +321,8 @@ jobs:
;;
*) return 0 ;;
esac
sid="$(jq -r --arg bot "$BOT_LOGIN" --arg m "$STATUS_MARKER" \
'[.[] | select(.user.login == $bot) | select(.body | contains($m))] | last | .id // empty' \
sid="$(jq -r --arg bot "$BOT_LOGIN" --arg m "$STATUS_MARKER" --arg legacy "$LEGACY_STATUS_MARKER" \
'[.[] | select(.user.login == $bot) | select((.body | contains($m)) or (.body | contains($legacy)))] | last | .id // empty' \
Comment thread
yiliang114 marked this conversation as resolved.
Outdated
"/tmp/comments-$pr.json")"
[ -n "$sid" ] || return 0
printf '%s\n\n%s\n\n%s' "$STATUS_MARKER" "$en" "$zh" > /tmp/status-body.md
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/qwen-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,17 @@ jobs:
RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
run: |-
set -uo pipefail
MARKER='<!-- qwen-triage stage=status -->'
MARKER='<!-- qwen-triage lifecycle -->'
LEGACY_MARKER='<!-- qwen-triage stage=status -->'
printf -v BODY '%s\n\n%s\n\n%s' \
"$MARKER" \
"🔄 **Qwen Triage is running** — [watch live progress]($RUN_URL). Stage results will post in this thread as they complete." \
"🔄 **Qwen Triage 正在运行** —— [查看实时进度]($RUN_URL)。各阶段结果完成后会更新在本线程。"
EXISTING_ID="$(
gh api "repos/$GITHUB_REPOSITORY/issues/$NUMBER/comments" \
--method GET --paginate -F per_page=100 |
jq -rs --arg m "$MARKER" \
'[.[][] | select(.body | contains($m))] | last | .id // empty'
jq -rs --arg m "$MARKER" --arg legacy "$LEGACY_MARKER" \
'[.[][] | select((.body | contains($m)) or (.body | contains($legacy)))] | last | .id // empty'
)" || EXISTING_ID=''
if [ -n "$EXISTING_ID" ]; then
gh api --method PATCH \
Expand Down Expand Up @@ -673,7 +674,8 @@ jobs:
TRIAGE_OUTCOME: '${{ steps.triage.outcome }}'
run: |-
set -uo pipefail
MARKER='<!-- qwen-triage stage=status -->'
MARKER='<!-- qwen-triage lifecycle -->'
LEGACY_MARKER='<!-- qwen-triage stage=status -->'
if [ "${TRIAGE_OUTCOME:-}" = 'success' ]; then
EN="✅ **Qwen Triage finished** — [view run]($RUN_URL). See the stage comments in this thread for the result."
ZH="✅ **Qwen Triage 已完成** —— [查看运行]($RUN_URL)。结果见本线程中的各阶段评论。"
Expand All @@ -685,8 +687,8 @@ jobs:
EXISTING_ID="$(
gh api "repos/$GITHUB_REPOSITORY/issues/$NUMBER/comments" \
--method GET --paginate -F per_page=100 |
jq -rs --arg m "$MARKER" \
'[.[][] | select(.body | contains($m))] | last | .id // empty'
jq -rs --arg m "$MARKER" --arg legacy "$LEGACY_MARKER" \
'[.[][] | select((.body | contains($m)) or (.body | contains($legacy)))] | last | .id // empty'
)" || EXISTING_ID=''
if [ -n "$EXISTING_ID" ]; then
gh api --method PATCH \
Expand Down
4 changes: 4 additions & 0 deletions scripts/tests/qwen-triage-finalize-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ describe('qwen-triage-finalize workflow', () => {
expect(workflowText).toContain(
"HEAD_SHA: '${{ github.event.workflow_run.head_sha }}'",
);
expect(script).toContain("STATUS_MARKER='<!-- qwen-triage lifecycle -->'");
expect(script).toContain(
"LEGACY_STATUS_MARKER='<!-- qwen-triage stage=status -->'",
);
});

it('sanitizes attacker-influenced check names before the table', () => {
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/qwen-triage-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ describe('qwen-triage tmux workflow', () => {
it('posts an early live-progress status comment and finalizes the same one', () => {
const statusStep = step('Post triage status comment');
// Announced up front (before the long agent step) with the live run link.
expect(statusStep).toContain('<!-- qwen-triage lifecycle -->');
expect(statusStep).toContain('<!-- qwen-triage stage=status -->');
Comment thread
yiliang114 marked this conversation as resolved.
Outdated
expect(statusStep).toContain('actions/runs/${{ github.run_id }}');
expect(statusStep).toContain('watch live progress');
Expand All @@ -230,6 +231,7 @@ describe('qwen-triage tmux workflow', () => {

const finalizeStep = step('Finalize triage status comment');
// Runs on both outcomes and edits the SAME marker comment (no second post).
expect(finalizeStep).toContain('<!-- qwen-triage lifecycle -->');
expect(finalizeStep).toContain('<!-- qwen-triage stage=status -->');
expect(finalizeStep).toContain('success() || failure()');
expect(finalizeStep).toContain('steps.triage.outcome');
Expand Down
Loading