Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
lazyxeon
left a comment
There was a problem hiding this comment.
clear on 6c6188fc8bc75a40508fb3a1c972459cf94e63f4 (BS-012 / Fixes #693).
What changed. .github/workflows/benchmark.yml Strict threshold step (shell: pwsh) now ends with exit $LASTEXITCODE so Actions' dot-source shape (pwsh -command ". '{0}'") propagates a -Strict checker failure. scripts/ci/test_workflow_policy.py adds a dotsource harness plus remove-reexit / hardcoded-exit 1 mutants. Docs N/A. benchmark_alert.yml still captures $LASTEXITCODE and continues (unchanged intent).
Mutation / policy. Local python3 scripts/ci/test_workflow_policy.py → 38/38 green (pwsh 7.4.6). Manual probes: fixed body over-limit → process exit 1, in-threshold → 0; remove exit $LASTEXITCODE → over stays 0 (caught); wrong var / exit 0 → over stays 0 (caught by assert); exit 1 → under fails (caught). Strict step stays main-only, no continue-on-error, still passes -Strict + threshold/benchmark JSON paths.
Threads. No open cursor[bot]/Copilot inline threads at review time. Codex code review on this head completed with no findings. Not blocking for RUSTSEC-2026-0441 (pin-utils); Astrid owns that in the 8 AM sweep — this branch does not touch lock/deny.
Merge still needs cursor[bot] on this head + green required CI.
There was a problem hiding this comment.
🟡 Changes recommended
The PowerShell test harness omits Actions runner script wrapping, so its negative control demonstrates a harness artifact rather than an actual loss of checker exit-code propagation.
1 open issue
What changed in this PR
This PR addresses #693 by adding explicit benchmark-checker exit propagation and policy tests intended to verify strict threshold enforcement.
Changes:
- Adds
exit $LASTEXITCODEto the main-branch strict benchmark step. - Adds PowerShell process-exit tests using over-limit and within-threshold fixtures, plus mutation checks.
Verification report:
- Head SHA reported:
6c6188fc8bc75a40508fb3a1c972459cf94e63f4; check status not independently verified. - Commands run during this review: none.
- Tests and builds not run due to review-environment restrictions; relevant Actions runner source inspected.
- Measurements: not measured.
- Replay hashes: reported unchanged; no hashed crate changed.
- Deferred issue links: none reported.
| File | Description |
|---|---|
scripts/ci/test_workflow_policy.py |
Adds strict-step extraction, threshold fixtures, and process-exit checks. |
.github/workflows/benchmark.yml |
Explicitly exits with the strict checker's status and adds explanatory comments. |
Review effort: Balanced
| rendered = body.replace(BENCHMARK_JSON_ARG, _ps_single_quote(str(benchmark_json)), 1) | ||
| with tempfile.TemporaryDirectory(prefix="gha-strict-") as tmp: | ||
| step = Path(tmp) / "gha-strict-step.ps1" | ||
| step.write_text(rendered, encoding="utf-8") |
There was a problem hiding this comment.
Adversarial review of 6c6188fc8bc75a40508fb3a1c972459cf94e63f4. Not a clearance. Not green.
The new exit $LASTEXITCODE returns the same process code the hosted runner already appends to every shell: pwsh step. On pwsh 7.4.6 and 7.6.6, the pre-change strict body inside that wrapper exits 1 for an over-limit row, a missing results file, and a non-numeric value, and exits 0 for an in-threshold row. The wrapper-less dot-source exits 0 with $LASTEXITCODE=1. That is the #693 repro, and it is not the script Actions runs. This line does not change the job result.
- Head
6c6188fc8bc75a40508fb3a1c972459cf94e63f4. Required checks have not all passed. Cargo Deny and the audit/SBOM job failedRUSTSEC-2026-0441(pin-utils0.1.0, unmaintained).Cargo.lockis unchanged fromf4574635e(the crate is at line 8134 on both). Security Audit on mainf4574635esucceeded in run41942502393. This pull request does not add an ignore. Gate and replay hash jobs were still pending. python3 scripts/ci/test_workflow_policy.pyexit 0, 38 tests, pwsh 7.6.6, then the same suite exit 0 on pwsh 7.4.6. Local probes of the raw dot-source and of the runnerFixUpScriptContentswrapper, both versions.- Not run: workspace gate,
actionlint(not installed), GPU frame budget (no render change; this VM cannot measure the 1660 Ti), determinism replay (no hashed crate). - Measurements: not measured.
- Replay hashes: unchanged. No hashed crate was edited.
determinism-replay.ymlis not in the diff. Local hashes were not run. - Deferred issue links: none from this diff.
No new dependency. No model URL. No auth or secret change. The policy test executes the step body. The Gate already runs that Python file from the pull request (contents: read), so this does not widen the token boundary. -Strict, .github/benchmark_thresholds.json, and the main-branch if stay. No continue-on-error was added.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
| # Actions dot-sources shell: pwsh. exit in the called script only | ||
| # sets $LASTEXITCODE, so a -Strict failure would leave the job green. | ||
| exit $LASTEXITCODE |
There was a problem hiding this comment.
The strict step's process exit on a hosted runner is already the checker's $LASTEXITCODE. actions/runner ScriptHandlerHelpers.FixUpScriptContents (tag v2.328.0 and main) rewrites every shell: pwsh script before pwsh -command ". '{0}'":
$ErrorActionPreference = 'stop'
# step body
if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }I ran the pre-change body inside that wrapper against .github/benchmark_thresholds.json (astraweave-core::ecs_benchmarks/world_creation, baseline 25.8, max 38.7). pwsh 7.4.6 and 7.6.6 both exited 1 for value 39.7, for a missing results file, and for a non-numeric value, and exited 0 for the baseline. After the checker, Test-Path variable:\LASTEXITCODE is true and the value is 1, so the appended if runs. The wrapper-less dot-source exits 0 with $LASTEXITCODE=1. That is the #693 repro, and it leaves out this rewrite.
exit $LASTEXITCODE here returns those same codes, and the append never runs. The comment says a -Strict failure would leave the job green. On the runner that executes this step, the pre-change body already exits 1.
| def _dotsource_exit(body: str, benchmark_json: Path, root: Path) -> tuple[int, str]: | ||
| """Run a step body the way Actions runs shell: pwsh (`pwsh -command ". '{0}'"`).""" | ||
| rendered = body.replace(BENCHMARK_JSON_ARG, _ps_single_quote(str(benchmark_json)), 1) | ||
| with tempfile.TemporaryDirectory(prefix="gha-strict-") as tmp: | ||
| step = Path(tmp) / "gha-strict-step.ps1" | ||
| step.write_text(rendered, encoding="utf-8") | ||
| command = ". '{0}'".format(str(step).replace("'", "''")) | ||
| proc = _run_pwsh( | ||
| [_require_pwsh(), "-NoLogo", "-Command", command], | ||
| cwd=root, | ||
| ) | ||
| output = (proc.stdout or "") + (proc.stderr or "") | ||
| return proc.returncode, output |
There was a problem hiding this comment.
_dotsource_exit launches pwsh -NoLogo -Command ". '{0}'" on the step body alone. The runner also prepends $ErrorActionPreference = 'stop' and appends if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }. test_strict_threshold_dotsource_without_reexit_stays_zero deletes exit $LASTEXITCODE and requires process exit 0. With the runner wrapper, that deletion still exits 1 (same fixtures, pwsh 7.4.6 and 7.6.6).
The suite is 38 tests, exit 0, on both versions. It locks the wrapper-less shape, which is the shape shell: pwsh does not execute. A hosted-runner log of the old step with process exit 0 would overturn this. I do not have one.
|
Annubis devastation @ |
Actions dot-sources shell: pwsh, so the call operator only sets $LASTEXITCODE. Re-exit with that code so a -Strict failure fails the job. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
6c6188f to
d268a4b
Compare
|
Rebased onto Old head:
|
lazyxeon
left a comment
There was a problem hiding this comment.
Re-clear (code) at d268a4b8e38471cb9c715e902390d0ff2f1e97d8. No blocking findings.
- Pure rebase. The diff from the prior clear
6c6188fcvs merge-basef4574635, compared with this head vsd01720a8, gives byte-identical patches for.github/workflows/benchmark.ymlandscripts/ci/test_workflow_policy.py. No PR-logic drift. Cargo.lockis not in the PR diff, so the lockfile matches main post-#699 andpin-utilsis absent. That resolves the earlier Cargo Deny red.- Threads: the 3 threads (Copilot test_workflow_policy.py:465, cursor[bot] benchmark.yml:362 and test_workflow_policy.py:472) were all raised on
6c6188fcand covered by the prior clear. Nothing new at this head. - Checklist unchanged: the dot-source policy test proves
exit $LASTEXITCODE, AGENTS.md OK,-Strictand thresholds untouched, no deps.
Merge still waits on green CI and cursor[bot]/Copilot at head.
There was a problem hiding this comment.
Adversarial review of d268a4b8e38471cb9c715e902390d0ff2f1e97d8. Not a clearance. Not green.
git range-diff against 6c6188fc8 is empty (d268a4b8e = 6c6188fc8). Parent is d01720a81 (#699). The two open threads on the strict step and on _dotsource_exit still match this tree.
The new exit $LASTEXITCODE returns the same process code the hosted runner already appends. actions/runner FixUpScriptContents on tag v2.338.2 (latest release, 2026-10-26) and on main still rewrites every shell: pwsh script before pwsh -command ". '{0}'": it prepends $ErrorActionPreference = 'stop' and appends if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }. Fixture astraweave-core::ecs_benchmarks/world_creation (baseline 25.8, max 38.7, value 39.7), pwsh 7.4.6 and 7.6.6:
- Checker
-File: over 1, under 0, missing file 1, value"nope"1. - Raw dot-source, pre-change body: over 0, under 0, missing 0,
"nope"0. - Raw dot-source, this body: over 1, under 0, missing 1,
"nope"0 (exit $nullis 0). - Runner wrapper, pre-change body: over 1, under 0, missing 1,
"nope"1. - Runner wrapper, this body: the same four codes. A marker written after
exit $LASTEXITCODEis not created, so the append does not run. That marker is created for the pre-change body, and the append then exits 1 (over) and 0 (under).
The comment above the new line says a -Strict failure would leave the job green. On the runner that executes this step, the pre-change body already exits 1. Deleting exit $LASTEXITCODE still exits 1 inside the wrapper. test_strict_threshold_dotsource_without_reexit_stays_zero requires process exit 0, which holds for the wrapper-less shape only. The suite is 38 tests, exit 0, on both pwsh versions.
"nope" throws inside the checker before either exit line. With the runner's $ErrorActionPreference = 'stop' that throw exits 1 for the pre-change body and for this body. This line does not change that result.
- Head
d268a4b8e38471cb9c715e902390d0ff2f1e97d8. Required checks have not all passed. OpenSSF Scorecard Analysis, Detect affected crates, and the vocabulary lint passed. Cargo Deny, Security Audit, Gate, and the three replay hash jobs were still pending.Cargo.lockmatchesd01720a81(nopin-utils). python3 scripts/ci/test_workflow_policy.pyexit 0, 38 tests, pwsh 7.4.6, then the same suite exit 0 on pwsh 7.6.6. Local probes of the raw dot-source and of the runner wrapper, both versions.git range-diffof6c6188fc8andd268a4b8e.- Not run: workspace gate (
scripts/ci/run-gate.sh; no crate changed; CI still classifies.github/workflows/**as full),actionlint(not installed), GPU frame budget (no render change; this VM cannot measure the 1660 Ti), determinism replay (no hashed crate). - Measurements: not measured.
- Replay hashes: unchanged. No hashed crate was edited.
determinism-replay.ymlis not in the diff. Local hashes were not run. - Deferred issue links: none from this diff. Discovery mode (
-Strictwith no thresholds file) still exits 0 fromcheck_benchmark_thresholds.ps1. That is the existing #563 behavior, and this line propagates that 0 the same way the runner append does.
No new dependency. No model URL. No auth or secret change. The policy test executes the step body from the pull request. The Gate job already runs that file with contents: read, so this does not widen the token boundary. -Strict, .github/benchmark_thresholds.json, and the main-branch if stay. No continue-on-error was added. benchmark_alert.yml is unchanged (#695 stays outside this diff). The pull request body still names 6c6188fc8.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
| if "continue-on-error:" in block: | ||
| raise AssertionError("Strict threshold step must not set continue-on-error") | ||
| if _step_shell(block) != "pwsh": | ||
| raise AssertionError( | ||
| "Strict threshold step must use shell: pwsh; Actions dot-sources that shell" | ||
| ) | ||
| if "github.ref == 'refs/heads/main'" not in block: |
There was a problem hiding this comment.
These guards do not keep the Strict step on main, and they do not see a job-level continue-on-error.
On this head, strict_threshold_step_body accepts both of these edits:
if: steps.merge.outputs.healthy == 'true' && github.ref == 'refs/heads/main' && false- that
ifreplaced byif: steps.merge.outputs.healthy == 'true'plus a comment# github.ref == 'refs/heads/main'
continue-on-error: true on the aggregate job is also accepted. job_step_block stops at the next step, so the job key is outside block.
assert_strict_threshold_step_propagates_checker_exit then dot-sources the run body and never evaluates if. A Strict step that does not run on main still passes. This is the #696 gap.
lazyxeon
left a comment
There was a problem hiding this comment.
blocking on d268a4b8e38471cb9c715e902390d0ff2f1e97d8. This withdraws my clears 5785220822 and 5792144117.
I cleared this because I thought the dot-source policy test proved exit $LASTEXITCODE. It doesn't. The test models pwsh -command ". '{0}'" without the runner's FixUpScriptContents wrapper, and that wrapper already appends if (Test-Path variable:\LASTEXITCODE) { exit $LASTEXITCODE } (cursor[bot] 5792226237, Copilot 5785232328). On the real runner the old body already exits 1, so the test only proves a harness artifact. I missed that on my checklist item "do the tests prove the stated fix".
Fixes (pick one after @astrid's RCA on #693):
- #693 is not a real bug: close #693 as not-planned and close this PR, or keep the line as harmless belt-and-braces with the fixes in (2).
- Keeping the PR:
scripts/ci/test_workflow_policy.py:465and:472: run the step body inside the runner wrapper (prepend$ErrorActionPreference = 'stop'and append theLASTEXITCODEexit, as inFixUpScriptContents). Assert over-limit exits 1, in-threshold exits 0, and missing file exits 1. Drop or renametest_strict_threshold_dotsource_without_reexit_stays_zero, because it asserts a shape Actions never runs..github/workflows/benchmark.yml:362: reword the comment. A-Strictfailure does not leave the job green today, and the line is defensive only.- Update the PR body, which still names
6c6188fc, and dropFixes #693unless the RCA confirms the bug.
The red job is the shard-health failure on Benchmark Regression Alerts 42108895720, and Andrew's six attempt-2 re-runs failed. The entry no longer calls #694 a fix. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
The red job is the shard-health failure on Benchmark Regression Alerts 42108895720, and Andrew's six attempt-2 re-runs failed. The entry no longer calls #694 a fix. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>



Fixes #693.
The Strict threshold step in
.github/workflows/benchmark.ymlusesshell: pwsh. Actions runs that shell by dot-sourcing the step (pwsh -command ". '{0}'").check_benchmark_thresholds.ps1 -Strictexits 1, and&only sets$LASTEXITCODE, so the step process stayed 0 and a real regression on main could stay green. The step now ends withexit $LASTEXITCODE.-Strictand.github/benchmark_thresholds.jsonare unchanged.benchmark_alert.ymlstill captures$LASTEXITCODEand continues, so it can open an issue. That intent did not change.scripts/ci/test_workflow_policy.pyruns the Strict step body under that dot-source shape. An over-limit row must make the process exit non-zero. The same body with the re-exit removed stays 0. A hardcodedexit 1fails an in-threshold row.Report
6c6188fc8bc75a40508fb3a1c972459cf94e63f4. Green means every required check passed on that SHA. Checks have not finished yet.python3 scripts/ci/test_workflow_policy.py— exit 0 (38 tests, pwsh 7.4.6).pwsh -Fileon an over-limit fixture exit 1; dot-source of the old body exit 0; dot-source of the fixed body exit 1; dot-source of an in-threshold fixture exit 0.scripts/ci/run-gate.sh, clippy,cargo test) — no crate changed. CI still classifies.github/workflows/**asfull=true.actionlint— not installed in this environment.Type of change
Security Considerations
No new dependency. The policy test calls
pwshalready present on the hosted runner.Checklist