Repository navigation
fix(autofix): re-anchor growth divergence on measurement time and external head moves #9192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
91eb70b
b328bd3
14b40ce
cbb7186
bf290a1
1737051
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| # 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R4-5: The comparability filter compares values from two domains: — Failure scenario: a concurrent scheduled-scan base update lands between this round's 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 中文说明[Suggestion] R4-5:可比性过滤在比较两个不同来源的值: — 失败场景:一次并发的 scheduled-scan base 更新落在本轮 证据:未运行 —— 该主张需要一次并发的 scheduled-scan base 更新恰好落在运行中 address job 的 prepare 内,只有 GitHub Actions 能产生;裁决基于行级追踪(fetch 4317 → 打点 4556 在同一 bash 块中的顺序、字符串比较语义)加探测验证过的过滤行为。 建议修复 —— 在 — 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 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| 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}" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| 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=([^ ]+) -->") ] | .[] | ||
|
|
@@ -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: | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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=([^ ]+) -->") ] | .[] | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b328bd3 — |
||
| | {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)) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b328bd3 — |
||
| | 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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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`, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b328bd3 — fixture |
||
| 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. | ||
|
|
@@ -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"`, | ||
| ], | ||
|
|
@@ -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', | ||
| }), | ||
| ], | ||
| }), | ||
|
|
@@ -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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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- — Failure scenario: both the cutoff ( Witness (mutation test on the real harness): 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 时刻及之前测量者被丢弃」这一半没有被钉住:严格 — 失败场景:cutoff( 证据(在真实夹具上做变异测试): 建议修复 —— 在此 cutoff 用例簇中补一个相等用例(代码块见英文部分),期望 — 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'); | ||
|
|
@@ -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(); | ||
|
|
@@ -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. | ||
|
|
@@ -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}"'); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b328bd3 — the test now pins |
||
| // 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. | ||
|
|
||
There was a problem hiding this comment.
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_BASELINEreader 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. Stampingmeasured=into the growth-base marker is tracked with the rest of #9114 rather than widening this change again.