qwen-code/scripts/tests
Shaojin Wen cef54b8340
refactor(autofix): move the push-and-report body out of the workflow file (#9653)
* refactor(autofix): move the push-and-report body out of the workflow file

qwen-autofix.yml was 462,656 bytes — 90% of GitHub's 500 KB start-runs
limit and inside the 470,000-byte gate's warning band. Past that limit
GitHub stops starting runs and says nothing: schedule ticks vanish,
dispatches sit queued with zero jobs, and only PR-event runs keep working
because they resolve an older copy from the PR's branch. The file crossed
it once already, on 2026-08-19, and the loop went dark for a day.

'Push and report' was the largest single block in the file at 626 lines of
inline shell. Its body moves to .github/scripts/autofix-push-and-report.sh
byte-identically — the YAML keeps the step's if: and env:, which is where
the questions of when it runs and what reaches it belong. The file drops
to 422,447 bytes.

Extraction moves the trust problem with it. By the time this step runs the
agent and the verification gate have executed branch code on this host, so
the workspace copy is branch-controlled. The step runs the trusted-base
copy staged before any of that, after proving its digest — recorded in
GITHUB_OUTPUT, which a disk write cannot reach — still matches, that the
staged path is a regular file, and with both reads bounded so a planted
FIFO is a refusal rather than a hang until timeout-minutes. A new contract
test pins all of that, including that the workspace copy is never what
runs; each of its assertions was checked against a mutant of the line it
guards.

The census assertions that counted sites across the workflow now count the
script too, so an extraction cannot silently drop a site from a count that
exists to pin it. The two emit_growth_audit_marker copies are compared
dedented, since one is now at column 0 and its twin is still at ten.

This is also the step docs/design/autofix-gate-runner-isolation.md moves
into its own publish job. Carrying it as a file makes that a small diff,
and deletes the staging scaffolding added here: a job that checks out the
trusted base and never executes branch code can run the script where it
lies.

Refs #9089.

* fix(autofix): close the push-and-report gate's env-import and TOCTOU holes

The wrapper verified the staged script in the step's inherited shell:
a $GITHUB_ENV-planted PATH or BASH_FUNC_* import could swap the gate's
own words, and the staged path was opened three times, so a watcher
could swap the file between the digest check and the execution read.
Run the whole verify-and-run sequence in one env -i clean child that
opens the staged path once, verifies the digest of the captured bytes,
and executes those same bytes. Also fail staging closed on any cp
failure, fix the script's env contract, and pin the new guards.

* fix(autofix): close the push-and-report gate's silent no-op hole

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(autofix): pin gate pass-through, refusal order, and continuation bans (#9653)

Address review suggestions on the push-and-report extraction:

- R2-3: pin the gate child's env -i pass-through list as a sorted
  allow-list equality check (R9-10 precedent), so a dropped variable
  fails loudly instead of expanding empty.
- R4-4: pin the sentinel refusal BEFORE the round_reported write —
  shape-only pins let the ordering rot (probe-verified mutant).
- R4-6: make the execution bans continuation-tolerant; bash joins
  `\<newline>` before tokenizing, so line-continued spellings evaded
  the `[^\n|]*` middle (probe: old regex misses, new catches).
- R1-6: re-scope the paired R10-8 upsert negatives to both halves,
  matching the positive censuses.
- R3-2: correct the stale workflow-size figure (462,656 -> 463,004
  bytes at the post-merge base; 90%/98% still hold).
- R1-5/R1-15/R1-11: correct three disproved claims in the trust-model
  doc (block rank, GITHUB_OUTPUT qualifier, which call sites hold the
  single-open shape).

* refactor(autofix): deliver the push-and-report body as content, not a staged file

The extraction put the body in a file and then had to defend that file: a
staged copy under RUNNER_TEMP, a digest recorded in step output, a type
check, bounded reads, and — after three rounds of findings against those —
an env -i clean child with a liveness sentinel and a 38-entry pass-through
list wrapping the whole verify-and-run sequence. Four review rounds have
now been spent on that machinery, and the open findings against it are
about the machinery, not about the move: output buffering that costs the
live log the inline body had, an env allow-list nothing pins, and pin gaps
in the tests that exist only to hold the gate together.

Delete the object being guarded instead. The stage step already reads the
trusted base before any branch code runs, so it captures the body as text
into step output and the step runs those bytes — the delivery the inline
block had, and the one upsert-deferred-issue.sh already uses. With no
agent-writable copy on disk there is nothing to stage, digest, type-check
or re-open, and no check→use window between the steps: R1-2's TOCTOU,
R1-13's FIFO double-open, R2-2/R2-5/R2-6/R2-7's single-open pins and
R4-1's buffering all describe a mechanism that no longer exists.

This is not a security regression. What it drops is protection the inline
block never had; what it keeps is the one property that matters — the
bytes come from the trusted-base checkout through expression context, not
from a path the branch can write. The step shell's inherited environment
(R1-1, R1-3) is the status quo this PR preserves rather than the thing an
extraction should be fixing: #9525's publish job takes the PAT out of that
shell entirely, which is the real close.

Kept from the gate work: the round_reported output. A loader plant that
kills this shell at execve exits 0 having written nothing, so 'Finalize
autofix status comment' can still tell a published round from a no-op —
now without a sentinel, because the write is simply last.

Also corrected, from the same review: the header no longer claims the
block was the largest in the file (it is third, after 'Scan for PRs with
new feedback' and 'Prepare branch and feedback'), the size is measured at
this branch's merge-base (462,720), the env contract is stated as a rule
rather than a list that went stale within one round, and the shellcheck
note says which lane and which severity it is clean under. The R10-8
execution-ban negatives now cover the scripts as well as the workflow, and
the script's own flag line is pinned as a whole rather than by spelling.

Refs #9089, #9525.

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-22 10:23:46 +00:00
..
ai-release-notes-workflow.test.js chore(ci): Disable install scripts in release CI and guard security-checks workflow (#9577) 2026-08-21 03:48:03 +00:00
audit-runtime-critical.test.js ci: run Windows merge queue tests on ECS (#8386) 2026-08-05 12:14:42 +00:00
build-and-publish-image-workflow.test.js ci(autofix): restore sandbox image flow (#6261) 2026-07-03 15:30:58 +00:00
capture-tmux-ci.test.js ci: install tmux and zip tooling on the Linux test lane, and pin it (#8792) 2026-08-11 05:47:39 +00:00
check-build-status.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
check-i18n.test.ts fix(cli): localize approval mode UI labels (#6592) 2026-07-11 00:07:03 +00:00
check-voice-guard-sync.test.js feat(voice): support trusted private ASR base URLs (#8350) 2026-08-06 14:04:57 +00:00
chrome-extension-package.test.js fix(ci): cover release integration regressions (#5994) 2026-06-29 11:54:11 +00:00
ci-flaky-rerun-workflow.test.js fix(ci): stop dropping agent settings in resolve and follow-up workflows (#9252) 2026-08-16 03:27:00 +00:00
ci-flaky-rerun.test.js feat(ci): auto-open a deflake fix issue for confirmed flaky tests (#7231) 2026-07-19 16:49:29 +00:00
clean-package-build-artifacts.test.js test(core): stabilize file history eviction test (#6637) 2026-07-10 06:39:52 +00:00
cli-entry.test.js fix(cli): preserve Qwen Review startup version in footers (#8431) 2026-08-04 14:58:56 +00:00
comment-attachment-guard-workflow.test.js ci: route trusted-author fork PRs and no-checkout jobs to the ECS pool (#8502) 2026-08-04 03:48:24 +00:00
cross-package-contracts.test.js refactor: centralize cross-package contracts (#9497) 2026-08-20 06:24:41 +00:00
desktop-oss-workflow.test.js fix(desktop): harden release pipeline (#9009) 2026-08-12 16:38:12 +00:00
dev.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
e2e-workflow.test.js fix(ci): keep the post-merge E2E signal on main alive (#7795) 2026-07-28 11:54:52 +00:00
generate-changelog.test.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
generate-release-notes.test.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
get-release-version-python-sdk.test.js feat(sdk-python): add network timeouts to release version helper (#3833) 2026-05-05 19:25:00 +08:00
get-release-version.test.js fix(ci): force-push release branch so retries replace failed attempts (#9076) (#9082) 2026-08-16 16:33:14 +00:00
install-script.test.js fix(install): avoid Get-FileHash for Windows checksums (#9112) 2026-08-14 01:12:08 +00:00
integration-vitest-config.test.ts fix(tests): apply integration worker limits to forks (#8689) 2026-08-08 00:53:33 +00:00
issue-triage-ownership-workflow.test.js ci: remove broken legacy scheduled PR triage workflow (#8434) 2026-08-03 10:20:42 +00:00
lint.test.js fix(ci): cache downloaded linters on ECS runners (#9001) 2026-08-13 05:13:23 +00:00
live-host-oss-workflow.test.js fix(ci): restore Live Host release mirroring (#8917) 2026-08-11 07:08:26 +00:00
main-ci-failure-issue-workflow.test.js fix(ci): keep the post-merge E2E signal on main alive (#7795) 2026-07-28 11:54:52 +00:00
no-ak-integration-ci.test.js feat(web-shell): add transcript contract prevalidation (#9388) 2026-08-19 14:13:12 +00:00
package-assets.test.js fix(review): harden the pipeline against four live-run failures (#9086) 2026-08-14 04:38:49 +00:00
package-scripts.test.js feat(autofix): audit the approach instead of stopping on growth-budget breach (#9262) 2026-08-21 04:54:07 +00:00
pr-force-push-reminder-workflow.test.js ci(autofix): run agents on dedicated ECS runners (#6207) 2026-07-03 07:40:07 +00:00
pr-self-report-label.test.js feat(autofix): escalate stopped takeover PRs and age out unanswered pauses (#8960) 2026-08-15 17:32:23 +00:00
qwen-autofix-fork-bridge-workflow.test.js feat(autofix): bridge fork-PR reviews into the credentialed review lane (#8676) 2026-08-07 16:11:48 +00:00
qwen-autofix-workflow.test.js refactor(autofix): move the push-and-report body out of the workflow file (#9653) 2026-08-22 10:23:46 +00:00
qwen-fleet-shepherd-workflow.test.js fix(ci): stop counting wedged queued runs as in-flight in the shepherd (#9518) 2026-08-20 13:37:22 +00:00
qwen-pr-review-workflow.test.js fix(ci): stop the fallback comment from denying a review it already posted (#9462) 2026-08-20 23:51:05 +00:00
qwen-repo-hygiene-workflow.test.js fix(ci): route workflow label mutations through REST (#8761) 2026-08-09 15:05:15 +00:00
qwen-resolve-workflow.test.js fix(ci): keep the review workflow under the expression-length limit (#8720) 2026-08-08 05:53:35 +00:00
qwen-triage-finalize-workflow.test.js fix(ci): rename triage status marker to avoid duplicate-guard collision (#7723) 2026-07-26 15:51:22 +00:00
qwen-triage-workflow.test.js fix(ci): heal a symlinked workspace instead of wedging the runner on it (#9498) 2026-08-20 13:54:36 +00:00
release-helpers.test.js refactor: extract shared release helper utilities (#3834) 2026-05-05 10:15:17 +08:00
release-sdk-workflow.test.js fix(ci): skip empty SDK release PR (#6861) 2026-07-14 13:19:42 +00:00
release-workflow.test.js fix(ci): force-push release branch so retries replace failed attempts (#9076) (#9082) 2026-08-16 16:33:14 +00:00
review-source-digest.test.ts refactor(cli): consolidate shared helpers ahead of the legacy audit skill (#9345) 2026-08-19 14:53:44 +00:00
review-worktree-cleanup-workflow.test.js fix(ci): clean review worktrees after cancellation (#8474) 2026-08-05 02:39:36 +00:00
sandbox-command.test.js fix(scripts): avoid shell injection in sandbox command detection (#6108) 2026-07-01 16:20:40 +08:00
sdk-java-workflow.test.js ci: route trusted-author fork PRs and no-checkout jobs to the ECS pool (#8502) 2026-08-04 03:48:24 +00:00
sdk-node-exporter-stub.test.js chore(deps): Clear high-severity CVE baseline and harden the security gate (#9584) 2026-08-21 07:43:32 +00:00
security-workflows.test.js chore(deps): Clear high-severity CVE baseline and harden the security gate (#9584) 2026-08-21 07:43:32 +00:00
serve-ab-workflow.test.js fix(ci): heal a symlinked workspace instead of wedging the runner on it (#9498) 2026-08-20 13:54:36 +00:00
serve-fast-path-bundle-check.test.js feat(ci): fail the startup bundle check when the CLI entry is hoisted into a chunk (#8203) 2026-07-31 08:57:57 +00:00
start.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
test-setup.ts feat(installer): add standalone archive installation (#3776) 2026-05-11 13:25:48 +08:00
update-ecs-runner-qwen-workflow.test.js fix(ci): reconcile ECS runner updater on workflow changes (#8373) 2026-08-02 09:25:17 +00:00
upload-aliyun-oss-assets.test.js feat(installer): add standalone hosted install and uninstall flow (#3828) 2026-05-21 11:57:10 +08:00
verify-capture.test.js fix(ci): avoid verify capture color conflict (#8236) 2026-07-31 14:15:40 +00:00
vitest-global-setup.test.js fix(devx): fail with actionable message when unit-test build prerequisites are missing (#9149) (#9171) 2026-08-18 13:19:09 +00:00
vitest.config.ts fix(ci): back-port the checkout-heal wipe guard to the triage and serve-ab wipes (#9277) 2026-08-18 06:49:40 +00:00
workflow-helpers.js ci: run Windows merge queue tests on ECS (#8386) 2026-08-05 12:14:42 +00:00
workflow-size.test.js refactor(autofix): move the push-and-report body out of the workflow file (#9653) 2026-08-22 10:23:46 +00:00
workspaces.test.js feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00