Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
82 changes: 55 additions & 27 deletions .github/workflows/qwen-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4547,6 +4547,30 @@ jobs:
[ .[] | select((.user.login // "") == $ab)
| select((.body // "") | contains("<!-- autofix-base-updated"))
| .created_at ] | max // ""' "${WORKDIR}/ic.json")"
# The instant THIS round's net was measured. Stamped into the
# growth-now marker so the divergence read filters on measurement
# time, not the marker comment's created_at — the report posts the
Comment on lines +4551 to +4552

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recorded rather than changed, per your second option: the sibling GROWTH_BASELINE reader now carries a KNOWN RESIDUAL comment naming the skew, its narrow window (the base update must land inside the anchor round's own agent run) and the first-wins property that keeps it from being re-poisoned later. Stamping measured= into the growth-base marker is tracked with the rest of #9114 rather than widening this change again.

# marker only after the agent's ~120-minute run, so a round in
# flight when a concurrent base update lands would otherwise pass a
# created_at filter while carrying pre-update sums (#9114 R2-6).
MEASURED_AT="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "measured_at=${MEASURED_AT}" >> "${GITHUB_OUTPUT}"
Comment on lines +4556 to +4557

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R4-5: The comparability filter compares values from two domains: measured= is a runner wall-clock stamp (here) while the cutoff BASE_UPD_AT is a GitHub-server created_at — and the admit-direction residual needs NO clock skew at all. Inside prepare, the ic.json fetch (~4317) precedes this stamp by seconds of local computation, so a base update (autofix-base-updated, created_at = B) landing inside that span admits this round's fully pre-update sums past the cutoff; the stamp also postdates the checkout-fixed tree (~4289), so the checkout→stamp span is exposed the same way. A poisoned sum persists for the rest of the window, and nothing logs which sums were incomparable. This is strictly narrower than pre-change behavior (a residual of the #9114 R2-6 fix, not a regression), and Risk & Scope names the clock source but not the admit-direction consequence; the sibling residual (growth-base read) carries a KNOWN RESIDUAL comment while this one does not.

— Failure scenario: a concurrent scheduled-scan base update lands between this round's ic.json fetch and its stamp. The round's marker carries measured= > B while its sums were measured against the pre-update tree; the next round's cutoff filter admits it, and PREV_SUM/OVER_ROUNDS_PRIOR are computed against an incomparable sum — a false escalation, or a still-climbing diff read as shrinking (suppressed handoff). Runner-clock-ahead skew widens the window; the runner-behind drop arm is unreachable on a disciplined clock (verified and rejected).

Witness: not run — the claim requires a concurrent scheduled-scan base update landing inside a live address job's prepare, which only GitHub Actions can produce; verdict rests on the line-level trace (fetch 4317 → stamp 4556 ordering in one bash block, string-comparison semantics) plus probe-verified filter behavior.

Suggested fix — document beside GROWTH_NOW_CUTOFF, mirroring the sibling KNOWN RESIDUAL block (4563–4572): the cross-domain comparison, the [ic.json fetch, stamp] admit window, and the drop-arm unreachability; and/or track it in #9114. (A clock-free causal alternative, unverified: after measuring, re-check for a base-update marker absent from the snapshot the sums came from, and treat the round as unmeasured if one appeared.)

中文说明

[Suggestion] R4-5:可比性过滤在比较两个不同来源的值:measured= 是 runner 墙钟打点(此处),而 cutoff BASE_UPD_AT 是 GitHub 服务器的 created_at —— 而且「放入」方向的残留问题不需要任何时钟偏差就能成立。prepare 内部,ic.json 抓取(约 4317 行)比该打点早数秒的本地计算,因此一次 base 更新(autofix-base-updated,created_at = B)若落在这个区间内,本轮按旧树测得的 sum 会被 cutoff 放入可比窗口;该打点同样晚于 checkout 固定的树(约 4289 行),checkout→打点区间同样暴露。被污染的 sum 会在窗口余下轮次持续存在,且没有任何日志能区分哪些 sum 不可比。这严格窄于改动前的行为(是 #9114 R2-6 修复的残留,而非回归),Risk & Scope 提到了时钟来源但没有提到「放入」方向的后果;兄弟残留(growth-base 读取)有 KNOWN RESIDUAL 注释,而这里没有。

— 失败场景:一次并发的 scheduled-scan base 更新落在本轮 ic.json 抓取与打点之间。本轮 marker 携带 measured= > B,但其 sum 是按更新前的树测得;下一轮 cutoff 过滤将其放入,PREV_SUM/OVER_ROUNDS_PRIOR 基于不可比的 sum 计算 —— 误升级,或仍在增长的 diff 被读作收缩(接管被抑制)。runner 时钟偏快会加宽窗口;runner 时钟偏慢的丢弃分支在受控时钟下不可达(已验证并否决)。

证据:未运行 —— 该主张需要一次并发的 scheduled-scan base 更新恰好落在运行中 address job 的 prepare 内,只有 GitHub Actions 能产生;裁决基于行级追踪(fetch 4317 → 打点 4556 在同一 bash 块中的顺序、字符串比较语义)加探测验证过的过滤行为。

建议修复 —— 在 GROWTH_NOW_CUTOFF 旁仿照兄弟 KNOWN RESIDUAL 块(4563–4572)补充文档:跨时钟域比较、[ic.json 抓取, 打点] 放入窗口、丢弃分支不可达;并/或记录到 #9114。(一个无时钟的因果替代方案,未验证:测量完成后复查是否出现了快照中不存在的 base-update marker,若出现则视本轮为未测量。)

— qwen3.8-max via Qwen Code /review (v0.21.11)

# Author pushes / base updates re-anchor the measurement too, not
# just the bot's own update-branch merge that BASE_UPD_AT tracks: the
# net is measured against origin/main, so any commit an EXTERNAL
# actor (or a stale-base merge) added to the branch since the bot
# last evaluated it inflates this round's sum relative to prior
# rounds' sums, measured on the old head — an incomparable
# comparison that trips (or suppresses) a false handoff (#9114
# R2-8/R6-3). The bot's last judged head rides in its autofix-redcheck
# marker (LIVE_RED_HEAD); if the current head is not it, the head
# moved outside a bot round — drop every prior sum by cutting the
# comparability window at now, so this round re-anchors.
GROWTH_NOW_CUTOFF="${BASE_UPD_AT}"
if [[ -n "${LIVE_RED_HEAD}" && "${LIVE_RED_HEAD}" != "${CHECKED_OUT_HEAD}" ]]; then

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, and it's a regression — fixed by withdrawal in b328bd3. autofix-redcheck records the head the agent was GIVEN (frozen pre-push), so after any pushing round the next round re-anchored and the census reset to 0; the #9104 handoff would never fire in the push regime. The head-move half is removed from this PR and returned to #9114: a correct version needs a bot-authored-move test AND a persisted cut, which is its own change. What remains here is the measurement-time filter (R2-6), which stands alone.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — with no judged head there is nothing comparable to keep, and the -n guard skipped exactly the case that needed the cut. Withdrawn with R1-1/R1-2; recorded on #9114.

echo "🔁 branch head moved outside a bot round (last judged ${LIVE_RED_HEAD:0:9}, now ${CHECKED_OUT_HEAD:0:9}) — re-anchoring growth divergence"
GROWTH_NOW_CUTOFF="${MEASURED_AT}"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — the cut was stateless and would have been re-admitted the next round. Withdrawn with R1-1 (b328bd3); your note that a persisted cut also needs >= semantics (so the re-anchoring round's own marker survives) is captured on #9114 for the redesign.

fi
GROWTH_BASELINE="$(jq -r --arg ab "${AUTOFIX_BOT}" --arg key "${LIVE_REARM_KEY}" --arg baseupd "${BASE_UPD_AT}" '
[ .[] | select((.user.login // "") == $ab) | . as $c | ($c.body // "")
| [ scan("<!-- autofix-growth-base src=(-?[0-9]+) test=(-?[0-9]+) key=([^ ]+) -->") ] | .[]
Expand Down Expand Up @@ -4620,39 +4644,41 @@ jobs:
# Count runs whenever the net is measured (not only over budget), so
# the trajectory clause below is accurate even on a round that pulled
# back under budget. markers:
# <!-- autofix-growth-now src=N test=N over=BOOL round=N run=ID key=W -->
# <!-- autofix-growth-now src=N test=N over=BOOL round=N run=ID measured=TS key=W -->
# Deduped and ordered by run=GITHUB_RUN_ID, the per-workflow-run id:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b328bd3 — reworded in all five places: run= is the DEDUP identity, measured= the ORDER key (the block comment, the 'highest run_id' line, the three writer comments, and the stale test comment).

# the report post's bounded retry re-posts one run's marker (same
# run_id → collapses to the LATEST by created_at, so a re-run's
# fresher attempt wins over its own stale first post), while every
# distinct address run has a fresh, monotonically increasing run_id. round=/eval-watermark are NOT a
# safe identity — a state-triggered lane (a persistent merge conflict
# selects the PR every scan with no new evaluable feedback) freezes
# both NEWEST and ROUND, so distinct over-budget runs would share them
# and collapse, stalling the count. Filtered to markers AFTER any
# mid-window base update (BASE_UPD_AT) — the same re-anchoring the
# growth-base read guards against. The "not shrinking" test compares
# against the MOST RECENT prior over-budget run's sum (highest
# run_id), not the window-wide max: a single transient spike would
# otherwise raise the bar forever and a genuine plateau-over-budget
# runaway (the exact case to escalate) would never clear it. The
# CURRENT run's own markers are excluded (run != GITHUB_RUN_ID): a
# re-run of a failed job keeps the same run id and its failed
# attempt already posted a marker, so counting it would over-report
# the round's own attempt as a PRIOR one.
# run_id → collapses to the LATEST by measured=, so a re-run's fresh
# measurement wins over its own stale first post), while every
# distinct address run has a fresh, monotonically increasing run_id.
# round=/eval-watermark are NOT a safe identity — a state-triggered
# lane (a persistent merge conflict selects the PR every scan with no
# new evaluable feedback) freezes both NEWEST and ROUND, so distinct
# over-budget runs would share them and collapse, stalling the count.
# Filtered on measured= (the prepare-time measurement instant, NOT the
# comment's post-agent created_at) after GROWTH_NOW_CUTOFF, which
# re-anchors on a base update OR any external head move — a prior sum
# measured against a different tree is not comparable to this round's.
# The "not shrinking" test compares against the MOST RECENT prior
# over-budget run's sum (latest measured=), not the window-wide max: a
# single transient spike would otherwise raise the bar forever and a
# genuine plateau-over-budget runaway (the exact case to escalate)
# would never clear it. The CURRENT run's own markers are excluded
# (run != GITHUB_RUN_ID): a re-run of a failed job keeps the same run
# id and its failed attempt already posted a marker, so counting it
# would over-report the round's own attempt as a PRIOR one.
GROWTH_DIVERGED='false'
OVER_ROUNDS_PRIOR=0
PREV_SUM=0
if [[ "${NET_MEASURED}" == 'true' ]]; then
read -r OVER_ROUNDS_PRIOR PREV_SUM < <(jq -r --arg ab "${AUTOFIX_BOT}" --arg key "${LIVE_REARM_KEY}" --arg baseupd "${BASE_UPD_AT}" --arg curr "${GITHUB_RUN_ID}" '
read -r OVER_ROUNDS_PRIOR PREV_SUM < <(jq -r --arg ab "${AUTOFIX_BOT}" --arg key "${LIVE_REARM_KEY}" --arg cutoff "${GROWTH_NOW_CUTOFF}" --arg curr "${GITHUB_RUN_ID}" '
[ .[] | select((.user.login // "") == $ab) | . as $c | ($c.body // "")
| [ scan("<!-- autofix-growth-now src=(-?[0-9]+) test=(-?[0-9]+) over=([a-z]+) round=([0-9]+) run=([0-9]+) key=([^ ]+) -->") ] | .[]
| {sum: ((.[0] | tonumber) + (.[1] | tonumber)), over: .[2], round: (.[3] | tonumber), run: (.[4] | tonumber), win: .[5], at: ($c.created_at // "")} ]
| [ scan("<!-- autofix-growth-now src=(-?[0-9]+) test=(-?[0-9]+) over=([a-z]+) round=([0-9]+) run=([0-9]+) measured=([^ ]+) key=([^ ]+) -->") ] | .[]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b328bd3 — measured= is now OPTIONAL in the scan ((?:measured=([^ ]+) )?) and falls back to the comment's created_at, so deploying does not blank the census of a window already in flight. Two fixtures pin it: a legacy marker counts, and it is still subject to the cutoff via that fallback.

| {sum: ((.[0] | tonumber) + (.[1] | tonumber)), over: .[2], round: (.[3] | tonumber), run: (.[4] | tonumber), measured: .[5], win: .[6]} ]
| map(select(.win == $key and .over == "true"))
| map(select(.run != ($curr | tonumber)))
| map(select($baseupd == "" or (.at > $baseupd)))
| group_by(.run) | map(max_by(.at))
| sort_by(.run)
| map(select($cutoff == "" or (.measured > $cutoff)))
| group_by(.run) | map(max_by(.measured))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b328bd3 — group_by(.run) | map(max_by(.measured)) now runs BEFORE the win/over/current-run/cutoff selects, so a re-run whose fresh attempt came back under budget is no longer represented by its stale over=true attempt. New fixture: attempt 1 over=true + attempt 2 over=false on the same run → false 0.

| sort_by(.measured)
| "\(length) \((last.sum) // 0)"' "${WORKDIR}/ic.json" 2> /dev/null || echo "0 0")
[[ "${OVER_ROUNDS_PRIOR}" =~ ^[0-9]+$ ]] || OVER_ROUNDS_PRIOR=0
[[ "${PREV_SUM}" =~ ^-?[0-9]+$ ]] || PREV_SUM=0
Expand Down Expand Up @@ -5476,6 +5502,7 @@ jobs:
GROWTH_SRC: '${{ steps.prepare.outputs.growth_src }}'
GROWTH_TEST: '${{ steps.prepare.outputs.growth_test }}'
CRITICAL_ONLY_GROWTH: '${{ steps.prepare.outputs.critical_only_growth }}'
MEASURED_AT: '${{ steps.prepare.outputs.measured_at }}'
run: |-
# gh has its own $GITHUB_ENV-injectable channels: pin the host and
# drop any planted token BEFORE the identity check below, so a
Expand Down Expand Up @@ -5866,7 +5893,7 @@ jobs:
# Per-round growth history the next round's divergence read
# counts; run=GITHUB_RUN_ID is the dedup+order identity (a retry
# re-posts the same run, distinct runs get fresh run ids).
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${NEXT_ROUND} run=${GITHUB_RUN_ID} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${NEXT_ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
} > "${WORKDIR}/report.md"
STATUS="pushed (round ${NEXT_ROUND}/${MAX_ROUNDS})"
else
Expand Down Expand Up @@ -5898,7 +5925,7 @@ jobs:
# Per-round growth history the next round's divergence read
# counts; run=GITHUB_RUN_ID is the dedup+order identity (a retry
# re-posts the same run, distinct runs get fresh run ids).
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${ROUND} run=${GITHUB_RUN_ID} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
} > "${WORKDIR}/report.md"
STATUS="no action needed"
fi
Expand Down Expand Up @@ -6054,6 +6081,7 @@ jobs:
GROWTH_SRC: '${{ steps.prepare.outputs.growth_src }}'
GROWTH_TEST: '${{ steps.prepare.outputs.growth_test }}'
CRITICAL_ONLY_GROWTH: '${{ steps.prepare.outputs.critical_only_growth }}'
MEASURED_AT: '${{ steps.prepare.outputs.measured_at }}'
GROWTH_BASE_WIN: '${{ steps.prepare.outputs.growth_base_win }}'
run: |-
# The head the agent actually evaluated — captured in prepare before
Expand Down Expand Up @@ -6564,7 +6592,7 @@ jobs:
# marker the push/no-op report paths write, so an over-budget
# round that timed out or was gate-rejected is not a gap. run=
# (per-workflow-run) is the dedup/order identity.
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${MARK_ROUND} run=${GITHUB_RUN_ID} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
echo "<!-- autofix-growth-now src=${GROWTH_SRC:-0} test=${GROWTH_TEST:-0} over=${CRITICAL_ONLY_GROWTH:-false} round=${MARK_ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=${GROWTH_BASE_WIN:-${WINDOW:-none}} -->"
# A sentinel ts means the agent evaluated NOTHING (crash, API
# error, gate crash) and the next scan must retry. Recording a
# judged head here would make RED_HEAD == LIVE_HEAD, so the
Expand Down
91 changes: 72 additions & 19 deletions scripts/tests/qwen-autofix-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6250,23 +6250,30 @@ exit 1
key = 'W1',
{
login = 'qwen-code-dev-bot',
at = '2026-01-01T00:00:00Z',
// Default run advances with the round so sort_by(.run) is
// deterministic; distinct runs that share round= override it.
// measured= (the prepare-time measurement instant) is the dedup/order
// key; default advances with the round so sort_by/max_by are
// deterministic. A re-run's distinct attempts override it explicitly.
measured = `2026-01-01T00:${String(round).padStart(2, '0')}:00Z`,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already corrected — the preamble now reads "deduped on run= and ordered on measured= (the prepare-time instant; created_at fallback for legacy markers)" and "markers measured after the cutoff", matching your suggested rewording.

// Default run advances with the round; distinct runs that share round=
// override it.
run = 1000 + round,
} = {},
) => ({
user: { login },
created_at: at,
body: `<!-- autofix-growth-now src=${src} test=${test} over=${over} round=${round} run=${run} key=${key} -->`,
// created_at is no longer read (the filter uses measured=), kept only
// as a realistic comment field.
created_at: measured,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b328bd3 — fixture created_at is now a fixed date unrelated to measured=, so ordering/dedup can only come from measured=; the legacy-marker fixtures exercise the created_at fallback explicitly.

body: `<!-- autofix-growth-now src=${src} test=${test} over=${over} round=${round} run=${run} measured=${measured} key=${key} -->`,
});
const diverge = ({
src,
test,
criticalOnlyGrowth = 'true',
history,
div = 2,
baseUpdAt = '',
// The comparability cutoff (base update OR external head move); markers
// measured at/before it are dropped as incomparable.
cutoff = '',
// Distinct from every default fixture run id (1000+round), so existing
// cases see no self-exclusion; a case can set a fixture marker's run to
// this to prove the current run's own attempt is excluded.
Expand All @@ -6281,7 +6288,7 @@ exit 1
'-c',
`set -e\nAUTOFIX_BOT=qwen-code-dev-bot\nLIVE_REARM_KEY=W1\nWORKDIR=${dir}\n` +
`NET_MEASURED=true\nCRITICAL_ONLY_GROWTH=${criticalOnlyGrowth}\n` +
`BASE_UPD_AT='${baseUpdAt}'\nGITHUB_RUN_ID=${currentRun}\n` +
`GROWTH_NOW_CUTOFF='${cutoff}'\nGITHUB_RUN_ID=${currentRun}\n` +
`GROWTH_SRC=${src}\nGROWTH_TEST=${test}\nGROWTH_DIVERGENCE_ROUNDS=${div}\n` +
`${divBlock}\nprintf '\\n%s %s' "$GROWTH_DIVERGED" "$OVER_ROUNDS_PRIOR"`,
],
Expand Down Expand Up @@ -6367,11 +6374,11 @@ exit 1
marker(300, 200, 'true', 1, 'W1', { run: 1001 }),
marker(600, 300, 'true', 2, 'W1', {
run: 1002,
at: '2026-01-01T00:01:00Z',
measured: '2026-01-01T00:01:00Z',
}),
marker(150, 150, 'true', 2, 'W1', {
run: 1002,
at: '2026-01-01T00:02:00Z',
measured: '2026-01-01T00:02:00Z',
}),
],
}),
Expand Down Expand Up @@ -6434,17 +6441,24 @@ exit 1
history: climbing.map((m) => ({ ...m, user: { login: 'attacker' } })),
}),
).toBe('false 0');
// Markers BEFORE a mid-window base update are excluded (re-anchoring makes
// pre-update sums incomparable) — only the post-update round remains.
// Markers measured at/before the comparability cutoff (a base update OR an
// external head move) are excluded — re-anchoring makes pre-cutoff sums
// incomparable; only the post-cutoff round remains.
Comment on lines +6468 to +6470

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R4-2: The documented "at/before the cutoff are dropped" half of the comparability filter is not pinned: the strict-> comparison (.measured > $cutoff, workflow ~4694) has no equality case, so the mutant >= ships green. All three cutoff fixtures pair the 12:00 cutoff only with strictly off-boundary stamps (06:00 / 06:30 / 18:00, plus the two legacy created_at cases).

— Failure scenario: both the cutoff (BASE_UPD_AT, a comment created_at) and measured= are second-precision UTC stamps, so a base update landing in the same second as a prepare-time measurement is a real input. If the operator is ever flipped to >=, a sum measured against the pre-update tree at exactly the cutoff instant is admitted as comparable and feeds OVER_ROUNDS_PRIOR/PREV_SUM — firing or suppressing the maintainer handoff on incomparable values — with the whole suite staying green.

Witness (mutation test on the real harness):

operator >  -> DIVERGED/OVER_PRIOR = false 0   (excluded, as documented)
operator >= -> DIVERGED/OVER_PRIOR = true 1    (pre-cutoff sum admitted, handoff flips)
mutant re-ran the divergence test: 1 passed | 171 skipped

Suggested fix — add one equality case to this cutoff cluster:

expect(
  diverge({
    src: 999,
    test: 999,
    cutoff: '2026-01-01T12:00:00Z',
    history: [
      marker(500, 300, 'true', 1, 'W1', {
        measured: '2026-01-01T12:00:00Z',
      }),
    ],
  }),
).toBe('false 0');
中文说明

[Suggestion] R4-2:可比性过滤中「恰在 cutoff 时刻及之前测量者被丢弃」这一半没有被钉住:严格 > 比较(.measured > $cutoff,workflow 约 4694 行)没有相等用例,因此变异体 >= 可以全绿通过。全部三个 cutoff 夹具都用 12:00 的 cutoff 配严格偏离边界的打点(06:00 / 06:30 / 18:00,以及两个 legacy created_at 用例)。

— 失败场景:cutoff(BASE_UPD_AT,评论的 created_at)与 measured= 都是秒精度 UTC 时间戳,因此 base 更新恰好与某轮 prepare 测量落在同一秒是真实输入。若操作符被改成 >=,恰在 cutoff 时刻按旧树测得的 sum 会被当作可比而进入 OVER_ROUNDS_PRIOR/PREV_SUM —— 基于不可比的值触发或抑制维护者接管 —— 而整个测试套件保持全绿。

证据(在真实夹具上做变异测试):

操作符 >  -> DIVERGED/OVER_PRIOR = false 0   (按文档语义被排除)
操作符 >= -> DIVERGED/OVER_PRIOR = true 1    (cutoff 前的 sum 被放入,接管翻转)
变异体重跑 divergence 测试:1 passed | 171 skipped

建议修复 —— 在此 cutoff 用例簇中补一个相等用例(代码块见英文部分),期望 'false 0'。

— qwen3.8-max via Qwen Code /review (v0.21.11)

expect(
diverge({
src: 999,
test: 999,
baseUpdAt: '2026-01-01T12:00:00Z',
cutoff: '2026-01-01T12:00:00Z',
history: [
marker(500, 300, 'true', 1, 'W1', { at: '2026-01-01T06:00:00Z' }),
marker(600, 400, 'true', 2, 'W1', { at: '2026-01-01T06:30:00Z' }),
marker(200, 100, 'true', 3, 'W1', { at: '2026-01-01T18:00:00Z' }),
marker(500, 300, 'true', 1, 'W1', {
measured: '2026-01-01T06:00:00Z',
}),
marker(600, 400, 'true', 2, 'W1', {
measured: '2026-01-01T06:30:00Z',
}),
marker(200, 100, 'true', 3, 'W1', {
measured: '2026-01-01T18:00:00Z',
}),
],
}),
).toBe('false 1');
Expand Down Expand Up @@ -6492,7 +6506,8 @@ exit 1
[
'-c',
`GROWTH_SRC=500\nGROWTH_TEST=300\nCRITICAL_ONLY_GROWTH=true\n` +
`${roundVar}=2\nGITHUB_RUN_ID=1002\nGROWTH_BASE_WIN=W1\nWINDOW=none\n${line}`,
`${roundVar}=2\nGITHUB_RUN_ID=1002\nMEASURED_AT=2026-01-01T00:05:00Z\n` +
`GROWTH_BASE_WIN=W1\nWINDOW=none\n${line}`,
],
{ encoding: 'utf8' },
).trim();
Expand Down Expand Up @@ -6524,7 +6539,7 @@ exit 1
workflow.match(/<!-- autofix-growth-now src=\$\{GROWTH_SRC:-0\}/g) ?? [],
).toHaveLength(3);
expect(workflow).toContain(
'over=${CRITICAL_ONLY_GROWTH:-false} round=${MARK_ROUND} run=${GITHUB_RUN_ID} key=',
'over=${CRITICAL_ONLY_GROWTH:-false} round=${MARK_ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=',
);
// The failure/handoff report step binds the three growth outputs so its
// marker is not inert-by-omission.
Expand Down Expand Up @@ -6554,11 +6569,49 @@ exit 1
expect(pushAndReportStep).toContain(bind);
}
expect(workflow).toContain(
'over=${CRITICAL_ONLY_GROWTH:-false} round=${NEXT_ROUND} run=${GITHUB_RUN_ID} key=',
'over=${CRITICAL_ONLY_GROWTH:-false} round=${NEXT_ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=',
);
expect(workflow).toContain(
'over=${CRITICAL_ONLY_GROWTH:-false} round=${ROUND} run=${GITHUB_RUN_ID} key=',
'over=${CRITICAL_ONLY_GROWTH:-false} round=${ROUND} run=${GITHUB_RUN_ID} measured=${MEASURED_AT} key=',
);
// Both report STEPS bind MEASURED_AT (push+no-op share one env block, the
// failure/handoff report has its own), so all three marker writers can
// stamp the prepare-time instant (not the post-agent comment created_at).
expect(
workflow.match(
/MEASURED_AT: '\$\{\{ steps\.prepare\.outputs\.measured_at \}\}'/g,
) ?? [],
).toHaveLength(2);
expect(workflow).toContain('echo "measured_at=${MEASURED_AT}"');

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b328bd3 — the test now pins MEASURED_AT=$(date -u …) in prepare and asserts it precedes the measured_at= output, so the instant is taken next to the net it stamps rather than at report time.

// The comparability cutoff re-anchors on an external head move (author
// push / base update), not only the bot's own base-update marker: extract
// the GROWTH_NOW_CUTOFF block and exercise both branches.
const cutoffBlock = prepareBranchAndFeedbackStep.match(
/GROWTH_NOW_CUTOFF="\$\{BASE_UPD_AT\}"\n[\s\S]*?GROWTH_NOW_CUTOFF="\$\{MEASURED_AT\}"\n\s+fi/,
)?.[0];
expect(cutoffBlock).toBeTruthy();
const cutoffOf = (liveRed, head) =>
execFileSync(
'bash',
[
'-c',
`BASE_UPD_AT=base-ts\nMEASURED_AT=now-ts\n` +
`LIVE_RED_HEAD='${liveRed}'\nCHECKED_OUT_HEAD='${head}'\n` +
`${cutoffBlock}\nprintf '%s' "$GROWTH_NOW_CUTOFF"`,
],
{ encoding: 'utf8' },
)
.trim()
.split('\n')
.pop();
// Head unchanged since the bot's last judged head → keep the base-update
// cutoff (prior sums stay comparable across bot rounds).
expect(cutoffOf('abc123', 'abc123')).toBe('base-ts');
// Head moved to something the bot did not record (author push / base
// update) → re-anchor at now, dropping every prior sum.
expect(cutoffOf('abc123', 'def456')).toBe('now-ts');
// First round (no prior bot head) → nothing to re-anchor against.
expect(cutoffOf('', 'def456')).toBe('base-ts');
// growth_diverged is NOT emitted as a step output — the handoff is
// enforced by the feedback.md text, so a dangling dead output would only
// mislead a future consumer.
Expand Down
Loading