qwen-code/scripts
Shaojin Wen d9d210eb7a
feat(autofix): seed the takeover round counter with /takeover from N (#9321)
* feat(autofix): seed the takeover round counter with `/takeover from N`

Taking over a PR that has already been through several review rounds
restarted the Critical-only brake from zero: the round counter is
window-scoped, and engaging takeover opens a fresh window, so a PR that
spent nine human rounds getting to "almost mergeable" got five more
suggestion-capable rounds the moment it was managed — the diff grew on
nice-to-haves exactly where it should have been converging.

`@qwen-code /takeover from N` now seeds the window's counter at N, so
CRITICAL_ONLY_AFTER_ROUND is reached in the remainder rather than a full
fresh five. This is the one parameterized command form: the literal
prefix must still match TAKEOVER_COMMAND byte-for-byte, the tail is a
bounded 1-2 digit integer, and the captured value reaches nothing but an
integer comparison. Everything else — a prefixed body, a `stop from N`
hybrid, a substitution payload — still fails closed.

The seed rides as its own `<!-- autofix-round-start N -->` marker on a
separate line of the engage ack, never as a field inside
`<!-- takeover-ack engaged -->`. That literal is matched with jq
contains(), closing `-->` included, at seven read sites — four here and
three in the fleet shepherd's paused/resume detector — so an inline
field would silently break all of them: the window key would fall back
to an older ack and the shepherd would age out a PR that was just
re-armed. Same shape as the existing autofix-redcheck marker.

Both round readers fall back to the seed instead of a hardcoded 0, read
it by created_at equality against the window key (so a superseded
window's seed cannot leak forward), and clamp it strictly below the
effective cap so a seed can never park a PR at its round cap on the very
round it is taken over. The seed is window-scoped like every other
census: `/retry` or a bare re-takeover returns the counter to 0.

Both engage acks and the Critical-only audit record now name the seed
when there is one — otherwise the ack reports "round 4/100" on its first
managed round, and the audit record claims five completed rounds on a PR
the loop has run twice.

The growth brake is deliberately not seeded: its baseline anchors at the
window's first measured round, and a pre-takeover baseline is not
recoverable, so growth stays measured from engagement.

* fix(autofix): address the R1 review findings on the takeover round seed

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

* fix(autofix): address the R2 review findings on the takeover round seed

* fix(autofix): address the R3 review findings on the takeover round seed

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-18 01:53:07 +00:00
..
installation
lib
tests
acp-http-smoke.mjs
audit-runtime-critical.js
benchmark-api-latency.mjs
build-hosted-installation-assets.js
build-standalone-release.js
build.js
build_package.js
build_sandbox.js
build_vscode_companion.js
check-build-status.js
check-desktop-isolation.js
check-i18n.ts
check-lockfile.js
check-serve-fast-path-bundle.js
check-voice-guard-sync.js
clean-package-build-artifacts.js
clean.js
cli-entry.js
copy_bundle_assets.js
copy_files.js
create-standalone-package.js
create_alias.sh
daemon-dev.js
desktop-openwork-sync.ts
dev.js
esbuild-shims.js
generate-changelog.js
generate-git-commit-info.js
generate-release-notes.js
generate-settings-schema.ts
get-release-version.js
lint.js
local_telemetry.js
measure-flicker.mjs
pre-commit.js
prepare-package.js
prepare.js
release-script-utils.js
review-audit-layers.mts
run-java-daemon-sdk-e2e.ts
sandbox_command.js
sdk-node-exporter-stub.js
sign-release.sh
start.js
sync-computer-use-schemas.ts
telemetry.js
telemetry_gcp.js
telemetry_utils.js
test-rewind-e2e.sh
test-windows-paths.js
unused-keys-only-in-locales.json
upload-aliyun-oss-assets.js
verify-capture.mjs
verify-installation-release.js
version.js
workspaces.js