Skip to content

ci-flake: raise the backend unit shard wall budget to 900s with measured evidence - #23322

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
agent/m1-studio-zcode-glm-5-3/51140af31cfd
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
agent/m1-studio-zcode-glm-5-3/51140af31cfd

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

The backend-unit-shard1-wall-budget-747s-over-720s flake: run 39806368285 (PR #23309) shard 1 failed its Run authoritative backend unit contract step 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:

  • Paired attempts on identical work: attempt 1 of that job walled 747s and failed; the re-run (attempt 2) of the same shard on the same 367-file selection walled 461s and passed — a 286s (62%) swing with zero code change.
  • Main is already at the line: the budget was set (600→720) from a 602s worst green wall when the selection had 1727 files (run 38168319908). The selection is now 2201 files, and the same 366-367-file main slices walled 389-697s green across the five main runs of 2026-10-22 (39807667829, 39798383701, 39773622719, 39771108524, 39768035294). A 697s green wall is 97% of the budget; one slow runner tips it over.
  • No other wall-budget failures in the last 60 workflow runs — the other failed shards in that window were genuine test failures on their own PRs or the apt/native-audio setup timeouts already fixed by ci-flake: keep native audio apt install off the network when warm #23308. The 747s event is the tail of the wall distribution, and per-file durations in the failing log match green runs (largest: test_sync_v2.py 92.7s, present in green shard-1 runs too).

Changes (all inside this flake's own job/step)

  • BACKEND_UNIT_STEP_BUDGET_SECONDS 720 → 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).
  • Shard job timeout-minutes 20 → 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.
  • Contract surfaces that pin these numbers updated together: backend/tests/unit/test_workflow_contracts.py (asserts the budget literal) and scripts/ci/test_nightly_main_workflow.py (INTENTIONAL_BUDGET_CHANGES pin for the timeout, with the measured rationale), plus the 720 s → 900 s mention in backend/AGENTS.md.

.github is 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 (no fix: commit).

Risk

  • A slower regression gate in wall terms only: a change that adds ~180s of shard wall now lands before failing, while the per-file duration guard (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.

View guided diff Turn on auto-fix

…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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-22T16:19:22.872920Z 909d35c PR opened
ℹ️ 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

6 issues found across 4 files

Confidence score: 4/5

  • The timeout rationale in .github/workflows/backend-unit-tests.yml and scripts/ci/test_nightly_main_workflow.py uses outdated setup limits. Update it to reflect the 5-minute install cap and the 25-minute job timeout.
  • backend/AGENTS.md describes 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.yml is 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

Comment on lines +175 to +176
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
# 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
# same ~19.6% headroom over the new 747s worst observed wall.
# same ~20.5% headroom over the new 747s worst observed wall.

Comment on lines +37 to +43
# 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
# 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.

Comment thread backend/AGENTS.md
```

**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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing as a duplicate of #23692 — the earliest cut of the same recalibration (shard step budget 720→900s, contract pin, nightly ledger pin, backend/AGENTS.md mention).

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.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

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!

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