mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-05 06:44:47 +00:00
feat(autofix): collapsed-Chinese bilingual takeover comments; fix ESLint regex-spaces
Every takeover-flow comment — engage ack, release ack, re-arm ack, and
the cap-pause notice — now follows the project convention: English
body plus Chinese collapsed under <details><summary>中文说明</summary>
(pinned at exactly four sites). Bodies are built via printf so no
workflow indentation leaks into the markdown: the previous literal
multi-line strings embedded 10 leading spaces, which would have
rendered the trailing marker comment as a visible code block.
Also fixes the CI failure at 1497a7e6f: three extraction regexes used
literal space runs, tripping ESLint no-regex-spaces — now {n}
quantifiers. Lesson applied: prettier alone is not the lint gate.
58/58 + 12/12.
This commit is contained in:
parent
1497a7e6fe
commit
c2d8a8941c
2 changed files with 13 additions and 15 deletions
19
.github/workflows/qwen-autofix.yml
vendored
19
.github/workflows/qwen-autofix.yml
vendored
|
|
@ -1161,9 +1161,7 @@ jobs:
|
|||
# a PR that exhausted its rounds continues under management —
|
||||
# no label churn needed. The watermark is untouched: feedback
|
||||
# already addressed is never replayed.
|
||||
gh pr comment "${PR}" --repo "${REPO}" --body "🔄 Takeover re-armed: the round counter starts a fresh window (previous rounds no longer count toward the cap); management continues. / 已重新武装:轮次计数开启新窗口(此前轮次不再计入上限),托管继续。
|
||||
|
||||
<!-- takeover-ack engaged -->"
|
||||
gh pr comment "${PR}" --repo "${REPO}" --body "$(printf '🔄 Takeover re-armed: the round counter starts a fresh window (previous rounds no longer count toward the cap); management continues.\n\n<details>\n<summary>中文说明</summary>\n\n🔄 已重新武装:轮次计数开启新窗口(此前轮次不再计入上限),托管继续。\n\n</details>\n\n<!-- takeover-ack engaged -->')"
|
||||
echo "🔄 re-armed ${TAKEOVER_LABEL} window on #${PR}"
|
||||
else
|
||||
gh pr edit "${PR}" --repo "${REPO}" --add-label "${TAKEOVER_LABEL}"
|
||||
|
|
@ -1211,14 +1209,13 @@ jobs:
|
|||
echo "::error::CI_DEV_BOT_PAT authenticates as '${bot_actor:-unknown}'; expected ${AUTOFIX_BOT}."
|
||||
exit 1
|
||||
fi
|
||||
# Bilingual with COLLAPSED Chinese (project convention), built via
|
||||
# printf so no workflow indentation leaks into the markdown (4+
|
||||
# leading spaces would render the marker line as a code block).
|
||||
if [[ "${ACK}" == 'engaged' ]]; then
|
||||
BODY="🤝 Takeover engaged: the autofix loop now manages this PR — it will address new review feedback and resolve base conflicts until the label is removed or the round cap is reached. Remove the \\`${TAKEOVER_LABEL}\\` label to release. / 已接管:autofix 循环现在管理此 PR —— 将持续处理新的评审反馈与 base 冲突,直到移除标签或达到轮次上限。移除 \\`${TAKEOVER_LABEL}\\` 标签即可释放。
|
||||
|
||||
<!-- takeover-ack engaged -->"
|
||||
BODY="$(printf '🤝 Takeover engaged: the autofix loop now manages this PR — it will address new review feedback and resolve base conflicts until the label is removed or the round cap is reached. Remove the `%s` label (or comment `%s stop`) to release.\n\n<details>\n<summary>中文说明</summary>\n\n🤝 已接管:autofix 循环现在管理此 PR —— 将持续处理新的评审反馈与 base 冲突,直到移除标签或达到轮次上限。移除 `%s` 标签(或评论 `%s stop`)即可释放。\n\n</details>\n\n<!-- takeover-ack engaged -->' "${TAKEOVER_LABEL}" "${TAKEOVER_COMMAND}" "${TAKEOVER_LABEL}" "${TAKEOVER_COMMAND}")"
|
||||
else
|
||||
BODY="👋 Takeover released: the autofix loop will no longer engage this PR (an in-flight round, if any, completes its bounded work). Re-apply \\`${TAKEOVER_LABEL}\\` to re-engage. / 已释放:autofix 循环不再介入此 PR(在飞的一轮如有,将完成其有界工作)。重新打上 \\`${TAKEOVER_LABEL}\\` 标签即可再次接管。
|
||||
|
||||
<!-- takeover-ack released -->"
|
||||
BODY="$(printf '👋 Takeover released: the autofix loop will no longer engage this PR (an in-flight round, if any, completes its bounded work). Re-apply `%s` (or comment `%s`) to re-engage.\n\n<details>\n<summary>中文说明</summary>\n\n👋 已释放:autofix 循环不再介入此 PR(在飞的一轮如有,将完成其有界工作)。重新打上 `%s` 标签(或评论 `%s`)即可再次接管。\n\n</details>\n\n<!-- takeover-ack released -->' "${TAKEOVER_LABEL}" "${TAKEOVER_COMMAND}" "${TAKEOVER_LABEL}" "${TAKEOVER_COMMAND}")"
|
||||
fi
|
||||
gh pr comment "${PR}" --repo "${REPO}" --body "${BODY}"
|
||||
|
||||
|
|
@ -1442,9 +1439,7 @@ jobs:
|
|||
| select((.body // "") | contains("<!-- takeover-cap-reached -->"))
|
||||
| select((.created_at // "") > $rt) ] | length' "${WORKDIR}/ic.json")"
|
||||
if [[ "${CAP_NOTICED}" == "0" ]]; then
|
||||
if ! gh pr comment "${PR}" --repo "${REPO}" --body "⏸️ Takeover paused: this PR reached its round cap (${ROUND}/${EFF_MAX_ROUNDS}). Comment \\`${TAKEOVER_COMMAND}\\` to re-arm a fresh window and continue management, or \\`${TAKEOVER_COMMAND} stop\\` to release. / 托管已暂停:本 PR 达到轮次上限(${ROUND}/${EFF_MAX_ROUNDS})。评论 \\`${TAKEOVER_COMMAND}\\` 可重新武装、开启新窗口继续托管;或评论 \\`${TAKEOVER_COMMAND} stop\\` 释放。
|
||||
|
||||
<!-- takeover-cap-reached -->"; then
|
||||
if ! gh pr comment "${PR}" --repo "${REPO}" --body "$(printf '⏸️ Takeover paused: this PR reached its round cap (%s/%s). Comment `%s` to re-arm a fresh window and continue management, or `%s stop` to release.\n\n<details>\n<summary>中文说明</summary>\n\n⏸️ 托管已暂停:本 PR 达到轮次上限(%s/%s)。评论 `%s` 可重新武装、开启新窗口继续托管;或评论 `%s stop` 释放。\n\n</details>\n\n<!-- takeover-cap-reached -->' "${ROUND}" "${EFF_MAX_ROUNDS}" "${TAKEOVER_COMMAND}" "${TAKEOVER_COMMAND}" "${ROUND}" "${EFF_MAX_ROUNDS}" "${TAKEOVER_COMMAND}" "${TAKEOVER_COMMAND}")"; then
|
||||
echo "::warning::cap-paused notice failed for #${PR}; will retry next scan"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -607,6 +607,9 @@ describe('qwen-autofix workflow', () => {
|
|||
expect(workflow).toContain("${{ needs.route.outputs.takeover_ack != '' }}");
|
||||
expect(workflow).toContain('<!-- takeover-ack engaged -->');
|
||||
expect(workflow).toContain('<!-- takeover-ack released -->');
|
||||
// Every takeover-flow comment is bilingual with COLLAPSED Chinese
|
||||
// (project convention): engage ack, release ack, re-arm ack, cap pause.
|
||||
expect(workflow.split('<summary>中文说明</summary>').length - 1).toBe(4);
|
||||
expect(workflow).toMatch(
|
||||
/takeover-ack:[\s\S]*?CI_DEV_BOT_PAT identity[\s\S]*?gh pr comment "\$\{PR\}"/,
|
||||
);
|
||||
|
|
@ -881,7 +884,7 @@ describe('qwen-autofix workflow', () => {
|
|||
// the accepted path only records the toggle for the takeover-command
|
||||
// job.
|
||||
const cmdBranch = routeStep.match(
|
||||
/if \[\[ "\$\{EVENT_NAME\}" == 'issue_comment' \]\]; then([\s\S]*?)\n fi/,
|
||||
/if \[\[ "\$\{EVENT_NAME\}" == 'issue_comment' \]\]; then([\s\S]*?)\n {14}fi/,
|
||||
)?.[1];
|
||||
expect(cmdBranch).toBeTruthy();
|
||||
expect(cmdBranch).not.toContain('DO_REVIEW=true');
|
||||
|
|
@ -904,10 +907,10 @@ describe('qwen-autofix workflow', () => {
|
|||
// API: author and write+ pass, read-permission strangers do not, bodies
|
||||
// with extra text do not, non-PR comments and closed PRs do not.
|
||||
const sanitize = routeStep.match(
|
||||
/(sanitize_number\(\) \{[\s\S]*?\n \})/,
|
||||
/(sanitize_number\(\) \{[\s\S]*?\n {10}\})/,
|
||||
)?.[1];
|
||||
const cmdBranch = routeStep.match(
|
||||
/(if \[\[ "\$\{EVENT_NAME\}" == 'issue_comment' \]\]; then[\s\S]*?\n fi)/,
|
||||
/(if \[\[ "\$\{EVENT_NAME\}" == 'issue_comment' \]\]; then[\s\S]*?\n {14}fi)/,
|
||||
)?.[1];
|
||||
expect(sanitize).toBeTruthy();
|
||||
expect(cmdBranch).toBeTruthy();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue