Skip to content

ci-flake: allowlist batch retry-cap closure test against the CPU duration guard - #23362

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/m1-studio-zcode-glm-5-3/5e02664406c6
Oct 23, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/m1-studio-zcode-glm-5-3/5e02664406c6

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

CI flake fixed at the root

cpu-duration-guard-test_runtime_image_contracts-gpu_batch_retry_cap-1.15s — the fast-unit CPU duration guard failed tests/unit/test_runtime_image_contracts.py when test_gpu_batch_retry_cap_does_not_reach_cloud_tasks's call phase exceeded the 1.00s fail budget.

This is a standing CI-flake fix request from David (2026-10-22: every caught CI flake gets fixed at the root; caching and flake fixes approved). No .github/ changes — the fix is a single evidence-documented entry in backend/tests/fast_unit_duration_allowlist.txt.

Evidence it is a flake, not a regression

The test was added ~23:00Z on 2026-10-22 by #23358 (ed2c03440d, the batch retry-cap closure regression). Every CI run of the identical code since then measured it right on the 1.00s budget — passing once by 0.02s and failing three times — while all 66 tests in the file passed in every run; the only failure output is the guard section:

Run Context Guard measurement (CPU, call phase) Result
39873589152 job 120154114649 #23358 head 58d4c61a23, shard 2/6, 23:55Z 0.98s (warn only) pass
39871080428 job 120145388808 #23358 head 58d4c61a23, shard 2/6, 23:33Z 1.07s > 1.00s fail
39876683920 job 120163867960 main push of merge c39757a13a, shard 2/6, 00:25Z 1.13s > 1.00s fail
39878478985 attempt 1 PR #23356, shard 3/6, 00:42Z 1.15s > 1.00s fail

No run before the test existed shows this signature (all failing Backend Unit Tests runs back to 19:31Z on 10-22 were checked; the other failures are unrelated classes).

Root cause

The test proves the batch worker's retry policy stays off Cloud Tasks. It walks the 109-module batch-pipeline-worker first-party import closure twice — first_party_import_closure() for the first-party membership assertions, then third_party_dependency_modules() for the google.cloud.tasks third-party assertion; both AST-parse the same files. Measured on a quiet host: 0.136s + 0.139s = 0.275s CPU. On the hosted CI shard runners the same work reads 0.98–1.15s (slower per-core runners plus parallel-load CPU inflation, the phenomenon the guard's own docs measure at ~2x on a saturated host), landing exactly on the 1.00s fail budget — so every PR whose selection includes this file flakes on shard runners.

Fix

Add the node ID to backend/tests/fast_unit_duration_allowlist.txt with the measured evidence — the repo's purpose-built mechanism for genuine unit tests whose measured CPU exceeds the failure threshold (three entries were added in the last 48h for this same CI-shard-at-the-limit shape, most recently test_batch_audio_language.py::test_admitted_short_false_permission_cannot_bypass_worker_barrier[zh-clean_speech-6s-pcm16]). The test keeps running at full strength in the unit lane; only the duration guard is suppressed for this node ID.

Deliberately not done:

  • No traversal restructuring of runtime_image_contracts.py: the two walks compute distinct contract facts with different import-candidate semantics (membership vs third-party probe); sharing one traversal would change a contract script that CI image gates depend on, and halving the cost would still leave ~0.5s on loaded runners with no deterministic margin over a budget the test already straddles by 0.02s margins.
  • No global BACKEND_FAST_UNIT_FAIL_SECONDS bump: a global budget change weakens the guard for every other test; the per-node allowlist is the documented exception path.
  • No skip/xfail/deletion: the test's assertions are untouched and keep gating every run.

Local verification (nice -n 19)

BACKEND_UNIT_TEST_FILE_LIST=<3 files> bash backend/test.sh   # warn=0.1 fail=1.0, file isolation
  tests/unit/test_runtime_image_contracts.py                  66 passed, 0 duration-guard failures
  tests/unit/test_fast_unit_duration_guard.py                 5 passed
  tests/unit/test_fast_unit_duration_allowlist_selection.py   2 passed

The allowlist entry was additionally verified through backend/tests/conftest.py::_read_duration_allowlist/_duration_allowlisted (node ID parses and matches, 360 entries). scripts/pr-preflight --suggest: lane=ci, no product-invariant citations, no failure-class declaration required.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T23:45:51.140253Z 4886cc7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…-glm-5-3/5e02664406c6

# Conflicts:
#	backend/tests/fast_unit_duration_allowlist.txt
@Git-on-my-level
Git-on-my-level merged commit d8bb5fd into main Oct 23, 2026
57 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-zcode-glm-5-3/5e02664406c6 branch October 23, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant