Repository navigation
ci-flake: raise the backend unit shard wall budget to 900s with measured evidence - #23322
Git-on-my-level wants to merge 1 commit into
Conversation
…red evidence The 720s step budget on 'Run authoritative backend unit contract' was set when the worst observed green wall was 602s. The selection has since grown from 1727 files (run 38168319908) to 2201, and the same 366-367-file main slices now wall 389-697s green (five runs sampled 2026-10-22). Run 39806368285 shard 1 failed at 747s with every test passing; its attempt 2 walled 461s on the identical selection, so the overrun is runner variance over a larger suite, not a regression. - BACKEND_UNIT_STEP_BUDGET_SECONDS 720 -> 900: restores the ~19.6% headroom-over-worst-observed-wall methodology that set 600 -> 720. - shard job timeout 20m -> 25m: worst-plausible setup (~300s: checkout ~90s + the 3m apt step cap) + 900s would sit exactly on the old 20m line; keeps the ceiling a hang bound above the gate. - Update the pinned contract assertions (test_workflow_contracts.py, test_nightly_main_workflow.py) and the backend guide's budget mention.
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. |
There was a problem hiding this comment.
6 issues found across 4 files
Confidence score: 4/5
- The timeout rationale in
.github/workflows/backend-unit-tests.ymlandscripts/ci/test_nightly_main_workflow.pyuses outdated setup limits. Update it to reflect the 5-minute install cap and the 25-minute job timeout. backend/AGENTS.mddescribes the 900-second test-step limit as a shard wall-time budget, but setup is excluded from that timer. Document it as the test-step limit.- The workflow’s maintained budget narratives still describe a 720-second gate. Update them to match the configured 900-second gate.
- The headroom calculation in
.github/workflows/backend-unit-tests.ymlis inaccurate: 900 seconds over 747 seconds is about 20.5%, not 19.6%.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/backend-unit-tests.yml">
<violation number="1" location=".github/workflows/backend-unit-tests.yml:175">
P2: The setup math in this comment uses a 3m apt cap, but the apt step is now `timeout-minutes: 5`. With a 5m cap, worst setup is ~420s, and 420s + 900s overruns the old 20m line. Correct the reasoning so the 25m value is justified by the real numbers.</violation>
<violation number="2" location=".github/workflows/backend-unit-tests.yml:287">
P3: The headroom figure is off. 900s over 747s is about 20.5%, not 19.6%. State the actual percentage.</violation>
<violation number="3" location=".github/workflows/backend-unit-tests.yml:289">
P3: This comment still describes the regression gate as 720s. Update it to 900s, or drop the number, so it matches `BACKEND_UNIT_STEP_BUDGET_SECONDS`.</violation>
<violation number="4" location=".github/workflows/backend-unit-tests.yml:289">
P3: The 900-second gate now contradicts the repository's maintained budget narratives, which still say the 720-second gate is unchanged. Update the workflow overview and CI-budget rationale to describe 900 seconds, while retaining 720 only where it is explicitly identified as historical.</violation>
</file>
<file name="scripts/ci/test_nightly_main_workflow.py">
<violation number="1" location="scripts/ci/test_nightly_main_workflow.py:37">
P3: This rationale does not match the configured workflow: the old job timeout was 20 minutes and the install step is capped at 5 minutes, not 15 minutes and 3 minutes. Correct the evidence so the contract test documents why 25 minutes is sufficient.</violation>
</file>
<file name="backend/AGENTS.md">
<violation number="1" location="backend/AGENTS.md:216">
P3: `backend/AGENTS.md` now describes the 900-second test-step gate as a 900-second shard wall budget, but the job can run for 25 minutes and excludes setup from that timer. Document the 900-second authoritative test-step budget separately from the 25-minute job timeout.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| # the 3m apt step cap + ~30s) reaches ~300s, and 300s + 900s sits | ||
| # exactly on the old 20m line, so the ceiling moves to 25m. Slow TEST |
There was a problem hiding this comment.
P2: The setup math in this comment uses a 3m apt cap, but the apt step is now timeout-minutes: 5. With a 5m cap, worst setup is ~420s, and 420s + 900s overruns the old 20m line. Correct the reasoning so the 25m value is justified by the real numbers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/backend-unit-tests.yml, line 175:
<comment>The setup math in this comment uses a 3m apt cap, but the apt step is now `timeout-minutes: 5`. With a 5m cap, worst setup is ~420s, and 420s + 900s overruns the old 20m line. Correct the reasoning so the 25m value is justified by the real numbers.</comment>
<file context>
@@ -163,18 +163,20 @@ jobs:
- timeout-minutes: 20
+ # 39741901310, 39739120103, 39676205452, 39668020536). With the step
+ # budget at 900s (2026-10-22), worst-plausible setup (checkout ~90s +
+ # the 3m apt step cap + ~30s) reaches ~300s, and 300s + 900s sits
+ # exactly on the old 20m line, so the ceiling moves to 25m. Slow TEST
+ # steps still fail loudly through the step's own 900s budget check, so
</file context>
| # the 3m apt step cap + ~30s) reaches ~300s, and 300s + 900s sits | |
| # exactly on the old 20m line, so the ceiling moves to 25m. Slow TEST | |
| # the 5m apt step cap + ~30s) reaches ~420s, and 420s + 900s = 1320s | |
| # overruns the old 20m line, so the ceiling moves to 25m. Slow TEST |
| # spread is runner variance, not a regression. 900s restores the | ||
| # same ~19.6% headroom over the new 747s worst observed wall. | ||
| # Raise only with measured evidence. | ||
| BACKEND_UNIT_STEP_BUDGET_SECONDS: "900" |
There was a problem hiding this comment.
P3: This comment still describes the regression gate as 720s. Update it to 900s, or drop the number, so it matches BACKEND_UNIT_STEP_BUDGET_SECONDS.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/backend-unit-tests.yml, line 289:
<comment>This comment still describes the regression gate as 720s. Update it to 900s, or drop the number, so it matches `BACKEND_UNIT_STEP_BUDGET_SECONDS`.</comment>
<file context>
@@ -274,12 +276,17 @@ jobs:
+ # spread is runner variance, not a regression. 900s restores the
+ # same ~19.6% headroom over the new 747s worst observed wall.
+ # Raise only with measured evidence.
+ BACKEND_UNIT_STEP_BUDGET_SECONDS: "900"
run: |
step_started=$SECONDS
</file context>
| # 39806368285 shard 1 failed at 747s with every test passing — | ||
| # its attempt 2 walled 461s on the identical selection, so the | ||
| # spread is runner variance, not a regression. 900s restores the | ||
| # same ~19.6% headroom over the new 747s worst observed wall. |
There was a problem hiding this comment.
P3: The headroom figure is off. 900s over 747s is about 20.5%, not 19.6%. State the actual percentage.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/backend-unit-tests.yml, line 287:
<comment>The headroom figure is off. 900s over 747s is about 20.5%, not 19.6%. State the actual percentage.</comment>
<file context>
@@ -274,12 +276,17 @@ jobs:
+ # 39806368285 shard 1 failed at 747s with every test passing —
+ # its attempt 2 walled 461s on the identical selection, so the
+ # spread is runner variance, not a regression. 900s restores the
+ # same ~19.6% headroom over the new 747s worst observed wall.
+ # Raise only with measured evidence.
+ BACKEND_UNIT_STEP_BUDGET_SECONDS: "900"
</file context>
| # same ~19.6% headroom over the new 747s worst observed wall. | |
| # same ~20.5% headroom over the new 747s worst observed wall. |
| # checkout 72s, apt-get 155s), so 227s + 720s crossed the old 15m | ||
| # ceiling and the shard was cancelled mid-run while still inside its | ||
| # step budget — four such 917-920s walls in the week to 2026-10-22 | ||
| # (39741901310, 39739120103, 39676205452, 39668020536). With the budget | ||
| # at 900s, worst-plausible setup (~300s: checkout ~90s + the 3m apt | ||
| # step cap) would sit exactly on 20m, so the ceiling is 25m; the step | ||
| # budget stays the regression gate, so budget_p50 stays 8. |
There was a problem hiding this comment.
P3: This rationale does not match the configured workflow: the old job timeout was 20 minutes and the install step is capped at 5 minutes, not 15 minutes and 3 minutes. Correct the evidence so the contract test documents why 25 minutes is sufficient.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/ci/test_nightly_main_workflow.py, line 37:
<comment>This rationale does not match the configured workflow: the old job timeout was 20 minutes and the install step is capped at 5 minutes, not 15 minutes and 3 minutes. Correct the evidence so the contract test documents why 25 minutes is sufficient.</comment>
<file context>
@@ -31,16 +31,17 @@ def jobs(text):
- # worst-plausible setup; the step budget stays the regression gate, so
- # budget_p50 stays 8.
- ("backend-unit-tests.yml", "backend-unit-shard", "timeout-minutes"): "20",
+ # checkout 72s, apt-get 155s), so 227s + 720s crossed the old 15m
+ # ceiling and the shard was cancelled mid-run while still inside its
+ # step budget — four such 917-920s walls in the week to 2026-10-22
</file context>
| # checkout 72s, apt-get 155s), so 227s + 720s crossed the old 15m | |
| # ceiling and the shard was cancelled mid-run while still inside its | |
| # step budget — four such 917-920s walls in the week to 2026-10-22 | |
| # (39741901310, 39739120103, 39676205452, 39668020536). With the budget | |
| # at 900s, worst-plausible setup (~300s: checkout ~90s + the 3m apt | |
| # step cap) would sit exactly on 20m, so the ceiling is 25m; the step | |
| # budget stays the regression gate, so budget_p50 stays 8. | |
| # checkout 72s, apt-get 155s); the old 20m job ceiling left those | |
| # 917-920s walls below the ceiling, so the 720s step budget was the | |
| # limiting gate. With the budget at 900s, worst-plausible setup (~420s: | |
| # checkout ~90s + the 5m apt step cap + ~30s) plus the step budget is | |
| # ~22m, so the ceiling is 25m; the step budget stays the regression | |
| # gate, so budget_p50 stays 8. |
| ``` | ||
|
|
||
| **Tests are selector-driven.** `scripts/run-unit-ci.sh` is the full GitHub Actions contract: it selects changed-file tests on PRs, runs preflight and type-checking, then invokes `test.sh`; main CI uses it with `--all`. Local pre-push intentionally keeps its own 40-file cap and runs changed test files when a broad selector exceeds that budget. Do not make the hook call the CI runner: bounded push latency protects the normal development loop. Local `test.sh` runs the selected set from `tests/unit/`, `tests/services/`, and `tests/routers/` via `scripts/select_backend_unit_tests.py`. The `Backend Unit Tests` workflow fans the same selection out to six shard jobs (sorted round-robin slices, union = the full selection), each under a 720 s wall budget; every file keeps its own pytest process because sharing sessions is blocked by `sys.modules` contamination. Tests that need live services (Redis, Firebase, real API keys) go in `tests/integration/`, which is not part of selector auto-discovery; note in the PR how you ran them. | ||
| **Tests are selector-driven.** `scripts/run-unit-ci.sh` is the full GitHub Actions contract: it selects changed-file tests on PRs, runs preflight and type-checking, then invokes `test.sh`; main CI uses it with `--all`. Local pre-push intentionally keeps its own 40-file cap and runs changed test files when a broad selector exceeds that budget. Do not make the hook call the CI runner: bounded push latency protects the normal development loop. Local `test.sh` runs the selected set from `tests/unit/`, `tests/services/`, and `tests/routers/` via `scripts/select_backend_unit_tests.py`. The `Backend Unit Tests` workflow fans the same selection out to six shard jobs (sorted round-robin slices, union = the full selection), each under a 900 s wall budget; every file keeps its own pytest process because sharing sessions is blocked by `sys.modules` contamination. Tests that need live services (Redis, Firebase, real API keys) go in `tests/integration/`, which is not part of selector auto-discovery; note in the PR how you ran them. |
There was a problem hiding this comment.
P3: backend/AGENTS.md now describes the 900-second test-step gate as a 900-second shard wall budget, but the job can run for 25 minutes and excludes setup from that timer. Document the 900-second authoritative test-step budget separately from the 25-minute job timeout.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/AGENTS.md, line 216:
<comment>`backend/AGENTS.md` now describes the 900-second test-step gate as a 900-second shard wall budget, but the job can run for 25 minutes and excludes setup from that timer. Document the 900-second authoritative test-step budget separately from the 25-minute job timeout.</comment>
<file context>
@@ -213,7 +213,7 @@ bash test.sh # Run all tests (CI source of truth)
-Tests are selector-driven. scripts/run-unit-ci.sh is the full GitHub Actions contract: it selects changed-file tests on PRs, runs preflight and type-checking, then invokes test.sh; main CI uses it with --all. Local pre-push intentionally keeps its own 40-file cap and runs changed test files when a broad selector exceeds that budget. Do not make the hook call the CI runner: bounded push latency protects the normal development loop. Local test.sh runs the selected set from tests/unit/, tests/services/, and tests/routers/ via scripts/select_backend_unit_tests.py. The Backend Unit Tests workflow fans the same selection out to six shard jobs (sorted round-robin slices, union = the full selection), each under a 720 s wall budget; every file keeps its own pytest process because sharing sessions is blocked by sys.modules contamination. Tests that need live services (Redis, Firebase, real API keys) go in tests/integration/, which is not part of selector auto-discovery; note in the PR how you ran them.
+Tests are selector-driven. scripts/run-unit-ci.sh is the full GitHub Actions contract: it selects changed-file tests on PRs, runs preflight and type-checking, then invokes test.sh; main CI uses it with --all. Local pre-push intentionally keeps its own 40-file cap and runs changed test files when a broad selector exceeds that budget. Do not make the hook call the CI runner: bounded push latency protects the normal development loop. Local test.sh runs the selected set from tests/unit/, tests/services/, and tests/routers/ via scripts/select_backend_unit_tests.py. The Backend Unit Tests workflow fans the same selection out to six shard jobs (sorted round-robin slices, union = the full selection), each under a 900 s wall budget; every file keeps its own pytest process because sharing sessions is blocked by sys.modules contamination. Tests that need live services (Redis, Firebase, real API keys) go in tests/integration/, which is not part of selector auto-discovery; note in the PR how you ran them.
Runtime image contracts. runtime_images.json registers each deployed Python image, its Dockerfile, build context, entrypoints, and deployment workflows. Run make runtime-image-source-closure to verify final-stage first-party source closure and that every registered deployment workflow smokes its declared Dockerfile; it is the fast pre-push and CI gate. make runtime-image-smoke SERVICE=pusher builds one image, checks every reachable third-party module is installed offline, then imports the registered isolated entrypoint. PR CI builds every registry-selected CPU image; deployment workflows build, smoke, then publish. GPU images use the same dependency-presence probe after their deployment build but defer full import until model initialization is lazy. Do not add a hand-maintained image-layout test or workflow mapping; add the service to the registry instead.
</file context>
</details>
| # spread is runner variance, not a regression. 900s restores the | ||
| # same ~19.6% headroom over the new 747s worst observed wall. | ||
| # Raise only with measured evidence. | ||
| BACKEND_UNIT_STEP_BUDGET_SECONDS: "900" |
There was a problem hiding this comment.
P3: The 900-second gate now contradicts the repository's maintained budget narratives, which still say the 720-second gate is unchanged. Update the workflow overview and CI-budget rationale to describe 900 seconds, while retaining 720 only where it is explicitly identified as historical.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/backend-unit-tests.yml, line 289:
<comment>The 900-second gate now contradicts the repository's maintained budget narratives, which still say the 720-second gate is unchanged. Update the workflow overview and CI-budget rationale to describe 900 seconds, while retaining 720 only where it is explicitly identified as historical.</comment>
<file context>
@@ -274,12 +276,17 @@ jobs:
+ # spread is runner variance, not a regression. 900s restores the
+ # same ~19.6% headroom over the new 747s worst observed wall.
+ # Raise only with measured evidence.
+ BACKEND_UNIT_STEP_BUDGET_SECONDS: "900"
run: |
step_started=$SECONDS
</file context>
|
Closing as a duplicate of #23692 — the earliest cut of the same recalibration (shard step budget 720→900s, contract pin, nightly ledger pin, Two things make #23692 the keeper: its evidence is current (breaches through 2026-10-26 with an 841s worst legitimate wall and the 808s fail → 719s pass same-code re-run; this PR's table ends at the 2026-10-22 747s event), and its ceiling arithmetic is against the current 25m ceiling — main already contains the 20m→25m raise this PR proposed, so only the 25m→30m step in #23692 is still wanted. Single survivor: #23692. This branch is not rebased. |
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
The
backend-unit-shard1-wall-budget-747s-over-720sflake: run 39806368285 (PR #23309) shard 1 failed itsRun authoritative backend unit contractstep at 747s against the 720s budget with every test passing. This is the wall-budget gate tripping over runner variance on a suite that has outgrown the budget, not a test or code regression.Evidence that it is a flake, not a regression:
test_sync_v2.py92.7s, present in green shard-1 runs too).Changes (all inside this flake's own job/step)
BACKEND_UNIT_STEP_BUDGET_SECONDS720 → 900 in.github/workflows/backend-unit-tests.yml, following the gate's own documented methodology: hold the worst observed wall with ~19.6% headroom (747s × 1.196 ≈ 894 → 900; the 600→720 raise used exactly this arithmetic on 602s).timeout-minutes20 → 25: the ceiling must cover setup plus the step budget, and worst-plausible setup (~300s: checkout ~90s + the 3m apt step cap + ~30s) + 900s would sit exactly on the old 20m line. The ceiling stays a hang bound; the step budget remains the regression gate.backend/tests/unit/test_workflow_contracts.py(asserts the budget literal) andscripts/ci/test_nightly_main_workflow.py(INTENTIONAL_BUDGET_CHANGESpin for the timeout, with the measured rationale), plus the720 s→900 smention inbackend/AGENTS.md..githubis edited only for this flake's own step and no workflow is added, per the 10-22 CI flake-fix direction. No test is skipped, xfailed, or deleted; the gate still fails any shard that exceeds 900s.Verification
backend/.venv/bin/python -m pytest backend/tests/unit/test_workflow_contracts.py— 94 passed.python3 scripts/ci/test_nightly_main_workflow.py— 5 tests OK (runs the merge-base drift check against the new 25m pin).actionlint .github/workflows/backend-unit-tests.yml— clean.scripts/pr-preflight --suggest— ci lane, no product-invariant citations, no failure-class declaration required (nofix:commit).Risk
BACKEND_FAST_UNIT_FAIL_SECONDS=1.0), the marker selection, and every assertion are unchanged. Suite growth (~70 files/week at the current rate) puts the next budget conversation at roughly a quarter out, and the evidence trail in the workflow comment shows exactly how to re-measure.