Skip to content

ci(desktop): size the batch watchdog cap against the step budget it has to fit - #13551

Closed
aryanorastar wants to merge 3 commits into
BasedHardware:mainfrom
aryanorastar:ci/desktop-swift-batch-ceiling
Closed

aryanorastar wants to merge 3 commits into
BasedHardware:mainfrom
aryanorastar:ci/desktop-swift-batch-ceiling

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A wedged batch currently fails the Desktop Swift suite step by construction, and it fails it as if a test broke.

swift-test-suites.sh gives each batch a watchdog cap, and CI sets it to 1500s. When a batch wedges, the invocation spends that entire cap before the bisect that clears it, so the step pays healthy run + cap + bisect. A healthy PR-lane step is ~870s. 870 + 1500 is already 2370s against the lane's 1800s step guard, so any wedged batch overruns it — there is no run in which that arithmetic works.

Three runs failed exactly that way, each with 823–824 suites executed and zero test failures:

run branch wedged invocation step wall
34609469609 codex/9518-notification-dispatch batch worker-2-0 x100 wall=1649s exit=143 2414s
34641438446 fix/audio-reconfig-retry batch worker-1-0 x100 wall=1648s exit=143 2505s
34655499561 local-llm-provider-macos batch worker-2-0 x100 wall=1648s exit=143 2511s

exit=143 is the watchdog's own SIGTERM at the cap. In all three the log then goes quiet for ~23 minutes with the machine otherwise idle, and the halves of that same batch pass immediately afterwards — 56s and 48s in the second run. Every other invocation in those runs exited 0 in 16–67s.

The failure surfaces as FAIL: the Desktop Swift suite step took 2505s, over its 1800s regression budget, which reads as a performance regression in the diff under test. It is not: it is one batch hanging, and the diffs in question were three unrelated files, a #if DEBUG guard, and a notification refactor.

What this changes

OMI_SWIFT_TEST_BATCH_CEILING_SECONDS: 1500 → 600, and the contract test now bounds it against the step budget rather than the job timeout.

The existing guard in test_ci_batch_ceiling_leaves_fallback_headroom bounded the cap at half the 60-minute job timeout. 1500s passes that comfortably. But the job timeout was never the binding constraint — the step's 1800s regression budget is, and it is less than a third of it. The two numbers were never checked against each other, which is how a cap that guarantees a red step passed review.

The new assertion writes the arithmetic down with its measured inputs, so they cannot drift apart again:

measured_healthy_step_seconds = 900  # 780s and 873s on green runs
bisect_allowance_seconds = 200       # two halves, measured 48-57s each
self.assertLessEqual(
    measured_healthy_step_seconds + ceiling + bisect_allowance_seconds,
    pr_step_budget_seconds,
    ...
)

Mutation-checked: restoring 1500 fails it with 2600 not less than or equal to 1800; 600 passes. It also asserts the PR lane's 'pr' && '1800' literal still exists, so moving the step budget fails here rather than silently invalidating the bound.

Why 600

The slowest healthy batch of 100 I found in any run is 67s; the bisect halves run 48–57s. 600s is ~9x the slowest healthy batch. And the cap is not a failure — a batch that genuinely needs longer is re-run in halves on the per-suite path, which is the harness's existing behaviour and is what already rescues these runs today. So the downside of being wrong here is a slower run, not a false red.

What this does not do

  • It does not explain the wedge. Something hangs an entire SwiftPM process for the full cap. It is not one bad suite: it is always a worker's first batch, and the two wedged batches I could compare share zero suites. This change bounds the cost so the wedge stops failing unrelated PRs; the hang itself deserves its own investigation.
  • It does not touch the release lane. Desktop Swift Release Compile sitting at ~95% of its own 60-minute cap (Desktop Swift Release Compile runs at ~95% of its 60-minute cap; cancellations fail a required check as if tests failed #12735) is a separate problem in a separate job, and nothing here moves it.
  • It weakens nothing. The step budget stays 1800s, the per-suite budget stays 300s, and the batch size stays 100.

Verification

.github/scripts/test_desktop_swift_ci_contract.py   Ran 35 tests — OK
same, with the ceiling reverted to 1500             FAILED (failures=1)

Failure-Class: none

🤖 Generated with Claude Code

Review in cubic

…as to fit

A batch that wedges spends its whole watchdog cap before the bisect that
clears it, so the suite step pays healthy-run + cap + bisect. The cap was
1500s and the PR lane's step guard is 1800s, so any wedged run failed the
step by construction — 870s of healthy work plus a 1500s cap is 2400s.

Three runs failed exactly that way, each with 823-824 suites passing and
zero test failures:

  34609469561  2414s  batch worker-2-0 x100  wall=1649s exit=143
  34641438446  2505s  batch worker-1-0 x100  wall=1648s exit=143
  34655499561  2511s  batch worker-2-0 x100  wall=1648s exit=143

Exit 143 is the watchdog's SIGTERM at the cap. In every case the halves of
that same batch passed in under 60s apiece, and the two wedged batches I
could compare share zero suites, so this is not a slow or bad test. The
failures read as test failures and are not, which is the expensive part.

The existing guard bounded the cap against the 60-minute job timeout. That
was never the binding constraint; the step budget is, and it is less than a
third of it. 600s keeps a wedged run inside the step guard while staying
about 9x the slowest healthy batch of 100 observed (67s), and a batch that
genuinely needs longer is not failed, only re-run in halves.

The contract test now asserts the cap against the step budget, with the
measured healthy wall and bisect cost written down, so the two numbers
cannot drift apart again.

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

… cover

The bound modelled the healthy step as a constant 900s, which is the
ordinary PR-lane run and where all three observed failures happened. It is
not the lane's worst case: the budget comment in this workflow records ~24m
for a PR that wakes the deferred serial cluster.

At 1440s of healthy work the step has ~160s left for a wedged batch and its
bisect — below one suite's own 300s budget, so no ceiling a batch of 100
could honestly carry fits there. That case is not a tuning problem; it needs
the wedge itself fixed.

Rather than leave the gap implicit, assert it: the guard now states that the
serial-wake headroom is smaller than the per-suite budget, and says in its
failure message to re-derive the bound against the worst case if that ever
stops being true. Mutation-checked — modelling the serial-wake step at 10m
fails it with "1000 not less than 300".

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member

Verified this end to end — the cap change is correct and the reasoning holds.

  • desktop-swift-ci.yml: the only functional change is OMI_SWIFT_TEST_BATCH_CEILING_SECONDS 1500 -> 600 in the desktop-swift-verify "Test desktop Swift app" step; the remaining +27/-6 is the rationale comment. No trigger, permission, or action changes.
  • Ran the full contract suite at this head: all 35 tests pass, including the rewritten test_ci_batch_ceiling_leaves_fallback_headroom. The arithmetic checks out (900 healthy + 600 ceiling + 200 bisect = 1700 <= the 1800s PR-lane guard), and the new scope assertion is the right call — it documents that a serial-wake run (~1440s) cannot be rescued by any batch-of-100 ceiling rather than widening a constant no value could satisfy.
  • Consumer semantics are untouched: swift-test-suites.sh clamps each batch (and bisect half) at the ceiling (pre-existing lines 337-338) and a timed-out batch falls through the bisect path rather than failing the run, so "not killed, only re-run in halves" matches the code. With the slowest healthy batch of 100 observed at 67s, 600s leaves ~9x headroom, so false timeouts should be rare.
  • Checked the cited failures: runs 34641438446 and 34655499561 are Desktop Swift CI reds as described. One nit: 34609469561 (also in the PR body) is actually the Backend Unit Tests run from the same push — the desktop run is 34609469609, whose "Test desktop Swift app" step spans 14:21:53 to 15:02:07 (~2414s), exactly matching the claim, so the evidence stands despite the transposed digits.
  • Second nit: the retained sentence "The local default stays 25" no longer corresponds to anything — swift-test-suites.sh's local default is 0 (ceiling disabled), and the 25-minute value it referenced is the 1500s this PR replaces. A one-line comment fix in a follow-up would do; not blocking.

CI-budget changes are maintainer-gated here, so leaving the merge call to a human maintainer — everything verifiable locally is consistent.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior positive-signal Automation verified a genuine fix/quality contribution desktop labels Sep 12, 2026
…means

Two review nits, both in prose rather than behaviour.

34609469561 is the Backend Unit Tests run from that push; the Desktop Swift
CI run whose suite step measured 2414s is 34609469609. Corrected in both the
workflow comment and the contract test's.

"The local default stays 25" meant the batch size, which is still 25 in
swift-test-suites.sh — but the sentence directly above it describes the cap
in minutes, so it reads as a claim about the ceiling, whose local default is
0. Naming both defaults removes the ambiguity rather than the sentence.

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
@aryanorastar

aryanorastar commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Both nits fixed on 4c8072f1aa, and thanks for catching the run id — you are right, 34609469561 is the Backend Unit Tests run from that push and the Desktop Swift CI run is 34609469609. Corrected in the PR body, the workflow comment and the contract test's comment.

On the second one, the sentence was mine and it was ambiguous rather than stale: "The local default stays 25" meant the batch size, which is still SUITE_BATCH_SIZE="${OMI_SWIFT_TEST_SUITE_BATCH_SIZE:-25}" in swift-test-suites.sh. You read it as the ceiling because the sentence immediately above describes the cap in minutes, which is a fair reading of what I wrote. Rather than delete a true statement I named both defaults:

Local runs are unaffected by either number: the script's own defaults are a batch of 25 with the ceiling disabled (0), so this cap exists only for CI's batch of 100.

No behaviour change in either commit; the 35 contract tests still pass.

@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up verification on 4c8072f (the nit-fix commit), building on the earlier end-to-end check:

  • No behavior change in this commit: the diff is comment text in .github/workflows/desktop-swift-ci.yml and assertions/comment text in .github/scripts/test_desktop_swift_ci_contract.py. The PR's single functional change remains OMI_SWIFT_TEST_BATCH_CEILING_SECONDS 1500 → 600 in the desktop-swift-verify step env — no triggers, permissions, or actions touched.
  • Ran the full contract suite at exactly this head: 35/35 pass, including the rewritten test_ci_batch_ceiling_leaves_fallback_headroom.
  • The new bound genuinely binds: with the PR-lane budget pinned at 1800s (OMI_SWIFT_TEST_STEP_BUDGET_SECONDS: ... 'pr' && '1800'), the old 1500s ceiling would fail the new assertion (900 healthy + 1500 + 200 bisect = 2600s > 1800s), while 600s fits (1700s ≤ 1800s) and stays under both the scaled budget (3270s at batch 100) and half the 60-minute job timeout.
  • Re-checked cited run 34641438446's log: batch worker-1-0 x100 wall=1648s exit=143 (budget 1500s), its halves green in 56s/48s, and the step failing at 2505s against the 1800s guard — exactly the failure mode the PR describes. Consumer semantics in desktop/macos/scripts/swift-test-suites.sh (unchanged here) also check out: the ceiling clamps each batch budget (lines 337–338) and a timed-out batch falls into the FALLBACK_BISECT_MIN bisect rather than failing the run, so "not killed, only re-run in halves" is accurate.

The serial-wake scope assertion is a good addition — it pins down that a ~1440s serial-cluster PR leaves ~160s of headroom (below any honest batch-of-100 ceiling) instead of letting a future edit silently widen the bound. The corrected run id and the named local defaults (batch 25, ceiling 0) read much better now.

Verified safe from the automation side; the workflow-review label stays for maintainer sign-off on the CI constant before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@Git-on-my-level need human response — verified end to end on 4c8072f, and the only step left is maintainer sign-off on the CI constant (workflow-review). Could you merge when you can? It is what keeps #13498 (approved, 825/825 suites pass) red: the batch wedge this caps fails its required checks on every run.

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Closing rather than waiting on merge.

This tip still sizes the batch ceiling against an 1800s PR-lane step budget (assertIn("'pr' && '1800'", …) plus 900+ceiling+200 ≤ 1800). Current main is 'pr' && '4400' || '4200' from #14222, which kept the 1500s ceiling and raised the guard so one full-cap wedge plus bisect cascade can finish (measured 3923s). Merging this SHA would land a contract test that fails immediately, and cutting 1500 → 600 now fights that re-baseline.

The original failure mode (wedge vs 1800) is already gone. If we still want a tighter ceiling for faster bisect, that should be a new PR against the 4400 arithmetic, not this branch.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @aryanorastar 👋

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

desktop positive-signal Automation verified a genuine fix/quality contribution workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants