Skip to content

ci(autofix): unify issue-fix and review-response into one lifecycle workflow#5233

Merged
qqqys merged 1 commit into
QwenLM:mainfrom
qqqys:chore/autofix-ci-dev-bot-pat
Jun 17, 2026
Merged

ci(autofix): unify issue-fix and review-response into one lifecycle workflow#5233
qqqys merged 1 commit into
QwenLM:mainfrom
qqqys:chore/autofix-ci-dev-bot-pat

Conversation

@qqqys

@qqqys qqqys commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Replaces the issue-only qwen-scheduled-issue-autofix workflow with a single qwen-autofix workflow that runs the entire autonomous-fix lifecycle as one bot identity, qwen-code-dev-bot (via the CI_DEV_BOT_PAT secret, with no token fallback).

A route job forks each scheduled tick into phases:

  • Review phase — every 4h: fans out (matrix) over every open autofix PR that has new, unaddressed feedback or a base conflict. For each, the agent triages comments by severity — critical / merge-blocking are verified against the current code and then fixed; suggestions are judged on engineering merit and only applied when genuinely valuable, without deviating from the PR's direction (over-engineered, low-value, or out-of-date suggestions are explained, not implemented). It resolves any conflict with main, re-runs the same deterministic verification gate (build / typecheck / lint / changed-package tests), force-pushes, and reports the outcome on the PR. When there is nothing worth doing it says so instead of churn-committing.
  • Issue phase — every 12h (00/12 UTC): unchanged behavior — locate one unattended bug, fix it, open a PR.

Safety: a per-PR round cap (MAX_ROUNDS) and an evaluation watermark stop bot-on-bot loops and keep the 4h cadence cheap — heavy per-PR agent jobs only start when there is genuinely new feedback. Review feedback is treated as untrusted input and is gated to maintainers (OWNER/MEMBER/COLLABORATOR) plus the automated reviewer, so a hostile commenter cannot steer the agent.

Why it's needed

The autofix bot previously opened a PR and stopped: review feedback (from the automated reviewer or maintainers) and base conflicts were never acted on, so PRs stalled and a maintainer had to take over. Consolidating issue-fix and review-response into one scheduled lifecycle, under one bot identity, closes that loop.

Reviewer Test Plan

How to verify

This is a CI workflow change; the end-to-end behavior is exercised by dispatching it, not by local app testing.

  • Static: workflow YAML parses; the four jobs (route, issue-autofix, review-scan, review-address) wire up via needs/if; the router's hour-fork, the feedback trust filter, the round-counter, and the conflict-watermark logic were unit-checked offline with jq/bash.
  • Live (recommended before relying on the schedule): workflow_dispatch with phase=review, a specific pr_number, and dry_run=true to confirm scan → triage → verify on a real PR without pushing; then phase=issue dry_run=true for the issue path.

Requires the CI_DEV_BOT_PAT secret (a qwen-code-dev-bot PAT with repo scope).

Evidence (Before & After)

N/A — non-user-visible CI/automation change.

Tested on

OS Status
🍏 macOS ⚠️ offline YAML/jq/bash validation only
🪟 Windows N/A
🐧 Linux ⚠️ runs on ubuntu-latest; end-to-end pending a dispatch run

…orkflow

Replace the issue-only scheduled-issue-autofix workflow with a single
qwen-autofix workflow that runs the whole autonomous-fix lifecycle and acts
as one identity, qwen-code-dev-bot (via CI_DEV_BOT_PAT, no fallback).

A router job forks each scheduled tick: the review phase sweeps the bot's open
PRs every 4h, and the issue phase locates and fixes one new bug every 12h (at
00/12 UTC). The review phase fans out over every PR that has new, unaddressed
feedback or a base conflict, triages each comment by severity (verify-then-fix
for critical/merge-blocking; engineering judgment for suggestions, without
deviating from the PR's direction — low-value or over-engineered ones are
explained, not implemented), resolves any conflict with main, re-runs the same
deterministic verification gate, force-pushes, and reports the outcome on the
PR. A per-PR round cap and an evaluation watermark keep the 4h cadence cheap
and prevent bot-on-bot loops.

Co-authored-by: Qwen-Coder <[email protected]>
@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Template looks good ✓

On direction: this closes a real gap — the autofix bot opens PRs but nobody ever addresses review feedback or base conflicts, so PRs stall. Consolidating issue-fix and review-response into one scheduled lifecycle is the right move. The safety guardrails (MAX_ROUNDS cap, trust gate filtering to OWNER/MEMBER/COLLABORATOR + the review bot, evaluation watermark to avoid re-processing) are well thought out. This is clearly within the CI automation remit.

On approach: the scope feels right — replacing 489 lines with 1088 is proportional to the added review-response capability (a whole new phase with scan + address + verify + push). The issue phase is carried over largely unchanged. Two observations for the maintainer:

  • The token model shifts from QWEN_CODE_BOT_TOKEN || CI_BOT_PAT (old, with fallback) to CI_DEV_BOT_PAT exclusively (new, single token). If that secret isn't provisioned yet, the workflow will fail on first run. The review-scan job also uses CI_DEV_BOT_PAT for read-only API calls where GITHUB_TOKEN would suffice — likely fine for rate limits, but worth being aware that the elevated PAT is used more broadly than strictly needed.
  • The review-address agent runs in a sandboxed action (good), with CI_DEV_BOT_PAT passed only to the push/report step (good). The trust gate logic is in the scan, not the agent, so even if the agent were compromised it couldn't act on untrusted feedback.

Moving on to code review. 🔍

中文说明

感谢贡献!

模板完整 ✓

方向:这个 PR 解决了一个真实的问题——autofix 机器人开了 PR 但从不处理 review 反馈和 base 冲突,导致 PR 停滞。把 issue 修复和 review 响应合并到一个定时生命周期中是正确的做法。安全护栏(MAX_ROUNDS 上限、信任门控只接受 OWNER/MEMBER/COLLABORATOR + review bot、评估水位线避免重复处理)设计合理。完全属于 CI 自动化范畴。

方案:范围合理——用 1088 行替换 489 行,新增的 review 响应能力(完整的 scan + address + verify + push 流程)比例恰当。issue 阶段基本保持不变。两点供维护者参考:

  • Token 模型从 QWEN_CODE_BOT_TOKEN || CI_BOT_PAT(旧的,有回退)变为仅使用 CI_DEV_BOT_PAT(新的,单一 token)。如果这个 secret 还没配置好,workflow 首次运行就会失败。review-scan job 对只读 API 调用也用了 CI_DEV_BOT_PAT,而 GITHUB_TOKEN 就够了——可能是为了 rate limit 考虑,但需要注意提升权限的 PAT 使用范围比严格需要的大。
  • review-address agent 在沙箱化 action 中运行(好的),CI_DEV_BOT_PAT 只在 push/report 步骤传入(好的)。信任门控逻辑在 scan 中而不是 agent 中,所以即使 agent 被攻破也无法对不受信任的反馈采取行动。

进入代码审查 🔍

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Code Review

Read through the entire 1088-line workflow. This is well-engineered — the watermark system, trust gate, and round counter are correct.

What's solid:

  • The evaluation watermark (autofix-eval ts=... acted=... round=...) prevents re-processing the same feedback across runs. Clever approach to the idempotency problem.
  • Trust gate is in the scan job, not the agent — even if the sandboxed agent were compromised, it can only see feedback that already passed the filter.
  • permissions: contents: read at the workflow level is a real improvement over the old contents: write, issues: write, pull-requests: write. All writes go through the PAT, which is scoped to the bot identity.
  • Every bash variable that comes from GitHub API responses is validated before use (regex checks on issue numbers, candidate membership checks).
  • Forced-PR path validates that the PR is still an open autofix PR owned by the bot — prevents using workflow_dispatch to run the review-address agent on arbitrary PRs.

No critical blockers found. The jq expressions, bash logic, and job wiring all check out. A few things worth noting:

  1. Token scope (raised in Stage 1, still relevant here): review-scan uses CI_DEV_BOT_PAT for read-only API calls (listing PRs, fetching comments). GITHUB_TOKEN would work and has lower blast radius. Minor — not a blocker.

  2. Merge conflict resolution in the review-address agent prompt asks the agent to git merge origin/main and resolve conflicts autonomously. This is inherently risky, but the deterministic verification gate (build/typecheck/lint/test) after the agent runs is the right safety net.

  3. Issue frequency change: old workflow ran daily at 19:00 UTC; new runs every 12h (00/12 UTC). This doubles the issue-fix throughput. Intentional, but worth confirming the maintainer wants this.

Action pins verified — all four pinned actions ([email protected], [email protected], [email protected], qwen-code-action) resolve to valid commits.

Testing

This is a CI workflow change — no user-visible TUI behavior to test in tmux. The end-to-end behavior requires workflow_dispatch with the CI_DEV_BOT_PAT secret provisioned in the repo. Static validation performed:

  • YAML parses correctly ✓
  • Job dependency graph: routeissue-autofix / review-scanreview-address
  • All if conditions reference valid needs.*.outputs
  • workflow_dispatch inputs with type: choice and type: boolean are valid ✓

Recommended live test before relying on the schedule: workflow_dispatch with phase=review, a specific pr_number, and dry_run=true.

中文说明

代码审查

通读了整个 1088 行的 workflow。工程质量很高——水位线系统、信任门控和轮次计数器都是正确的。

做得好的地方:

  • 评估水位线(autofix-eval ts=... acted=... round=...)防止跨运行重复处理同一反馈。解决幂等性问题的好方法。
  • 信任门控在 scan job 中而不是 agent 中——即使沙箱 agent 被攻破,它也只能看到已经通过过滤的反馈。
  • workflow 级别的 permissions: contents: read 比旧的 contents: write, issues: write, pull-requests: write 是真正的改进。所有写操作都通过 PAT,限定在 bot 身份下。
  • 每个来自 GitHub API 响应的 bash 变量在使用前都经过验证(issue 编号的正则检查、候选成员资格检查)。
  • 强制 PR 路径验证 PR 仍然是 bot 拥有的 open autofix PR——防止用 workflow_dispatch 在任意 PR 上运行 review-address agent。

未发现关键阻塞问题。 jq 表达式、bash 逻辑和 job 连线都正确。几点值得注意:

  1. Token 范围(Stage 1 已提到):review-scan 对只读 API 调用使用 CI_DEV_BOT_PATGITHUB_TOKEN 也可以,且影响范围更小。非阻塞。
  2. 合并冲突解决review-address agent 被要求自主执行 git merge origin/main 并解决冲突。本质上是有风险的,但 agent 运行后的确定性验证门(build/typecheck/lint/test)是正确的安全网。
  3. Issue 频率变化:旧 workflow 每天 19:00 UTC 运行;新的每 12h(00/12 UTC)运行。issue 修复吞吐量翻倍。是有意的,但值得确认维护者是否想要这个。

Action 依赖已验证 — 四个固定版本的 action 都解析为有效 commit。

测试

这是 CI workflow 变更——没有用户可见的 TUI 行为可以在 tmux 中测试。端到端行为需要在 repo 中配置好 CI_DEV_BOT_PAT secret 后通过 workflow_dispatch 触发。已执行静态验证:

  • YAML 解析正确 ✓
  • Job 依赖图:routeissue-autofix / review-scanreview-address
  • 所有 if 条件引用有效的 needs.*.outputs
  • workflow_dispatchtype: choicetype: boolean 输入有效 ✓

建议在依赖定时调度之前进行实时测试:用 phase=review、指定 pr_numberdry_run=true 进行 workflow_dispatch

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Reflection

Stepping back: this PR replaces a one-shot autofix workflow (open PR, stop) with a full lifecycle system that also responds to review feedback and resolves merge conflicts. The motivation is real — the old bot's PRs would stall waiting for a human to address review comments, defeating the purpose of automation.

The implementation is well above what I'd expect from a typical CI PR. The watermark system for tracking processed feedback, the trust gate against prompt injection, and the round cap to prevent infinite bot loops all show careful thinking about failure modes. The code is honest about what it does — heavy inline bash, yes, but that's the nature of CI workflows, and every non-trivial block is commented.

The one concern I keep coming back to is the token model: the entire workflow now depends on a single CI_DEV_BOT_PAT secret with no fallback. If it's not provisioned or expires, both phases go dark silently. But this is a deployment concern, not a code concern — the workflow fails fast with a clear error message when the PAT is missing.

I compared this against what I would have designed independently. My instinct would have been to add a separate review-response workflow alongside the existing issue-fix one. This PR's approach — merging both into a single workflow with a router — is actually better: less CI surface area, one place to reason about the full lifecycle, and the router pattern makes it easy to add more phases later.

No critical bugs found in the jq expressions, bash logic, or job wiring. Static YAML validation passes. This is ready to ship.

中文说明

退一步看:这个 PR 用一个完整的生命周期系统替换了一次性的 autofix workflow(开 PR,停止),新系统还能响应 review 反馈和解决合并冲突。动机是真实的——旧 bot 的 PR 会停滞等待人类处理 review 评论,违背了自动化的初衷。

实现质量远超典型的 CI PR。用于追踪已处理反馈的水位线系统、防止 prompt 注入的信任门控、以及防止无限 bot 循环的轮次上限,都体现了对失败模式的仔细思考。代码诚实地展示了它的工作——大量内联 bash 是 CI workflow 的本质,每个非平凡的代码块都有注释。

我反复考虑的一个问题是 token 模型:整个 workflow 现在依赖单一的 CI_DEV_BOT_PAT secret,没有回退。如果未配置或过期,两个阶段都会静默失败。但这是部署层面的问题,不是代码问题——当 PAT 缺失时,workflow 会以清晰的错误信息快速失败。

与我独立设计的方案对比:我的直觉是在现有 issue-fix workflow 旁边添加一个单独的 review-response workflow。这个 PR 的方案——用 router 将两者合并到一个 workflow 中——实际上更好:更少的 CI 表面积,一个地方推理完整生命周期,router 模式也便于未来添加更多阶段。

未发现 jq 表达式、bash 逻辑或 job 连线中的关键 bug。静态 YAML 验证通过。可以合并。

Qwen Code · qwen3.7-max

@qwen-code-ci-bot qwen-code-ci-bot left a 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.

LGTM, looks ready to ship. ✅

@yiliang114 yiliang114 left a 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.

LGTM

@qqqys
qqqys merged commit a335f9c into QwenLM:main Jun 17, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants