Skip to content

ci(desktop): stop the release job compiling the world twice for one test suite - #13553

Closed
aryanorastar wants to merge 2 commits into
BasedHardware:mainfrom
aryanorastar:ci/release-notification-target
Closed

aryanorastar wants to merge 2 commits into
BasedHardware:mainfrom
aryanorastar:ci/release-notification-target

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Desktop Swift Release Compile runs two sequential release compiles inside a 60-minute job, and the second one is a full rebuild that nobody intended. From run 34610634122, on a warm dependency cache:

step span outcome
run-swift-ci.sh --release-compile 14:33:21 → 15:04:53 Build complete! (1887.11s) — 31.5 min
run-swift-ci.sh --release-notification-regression 15:04:54 → 15:32:44 cancelled mid-compile at [124/128] Compiling Omi_Computer APIClient+AuthPolicy.swift — 27.8 min, unfinished

That is 60m24s against a 60-minute cap, and the aggregate Desktop Swift Build & Tests then hard-fails on RELEASE_RESULT: cancelled — so it reads as a test failure when nothing failed a test.

The second compile was never reusing the first

--release-compile's own comment says "The release-notification-regression mode below also reuses this build." It does not, and the run log says so — counting what that step compiled:

14 Compiling FirebaseCore        1 Compiling Omi_Computer      1 Compiling PostHog
 5 Compiling GTMSessionFetcher   1 Compiling OmiWALTests       1 Compiling PHPLCrashReporter
 2 Compiling FirebaseCoreExt     1 Compiling OmiSupportTests   1 Compiling VoiceTurnDomain  ...

Omi_Computer and the whole dependency graph, a second time. Same .build/arm64-apple-macosx/release directory, so it is not a path mismatch — it is the flags. A plain swift build -c release has testability off; swift test -c release needs it on for @testable import Omi_Computer, and that difference invalidates every module.

The change

Build the test targets with testability in the first step, and let the second reuse them.

swift build -c release --build-tests -Xswiftc -enable-testing ...   # step 1
swift test  -c release --skip-build --filter UserNotif...           # step 2

Measured locally end to end:

STEP1  swift build -c release --build-tests -Xswiftc -enable-testing   Build complete
STEP2  swift test  -c release --skip-build --filter UserNotif...       6.9s, 11 tests, 0 failures

The second step goes from ~28 minutes (unfinished) to under 7 seconds. And the negative control is what proves the products were never shared before: the same --skip-build without the step-1 flags fails with

error: ... Omi ComputerPackageTests.xctest doesn't exist in file system

Local timings are on Xcode 26.6 rather than CI's pinned 16.4, so treat the minutes as indicative; the part that transfers is --skip-build finding a bundle instead of not finding one.

Gated, so the other triggers don't pay

The regression step only runs on notification-touching diffs, but this job also runs on main pushes, scheduled health, and Package.swift PRs. Those would otherwise start compiling test targets nothing executes, so both steps read should_notification_release_regression — the same output that decides whether the regression runs at all.

The contract test pins that pairing, because a mismatch is silent rather than loud: the build would quietly omit the test targets and the regression would quietly rebuild the world again. Mutation-checked — dropping the env from the build step alone fails with 1 != 2 : the release build and the regression step must both read should_notification_release_regression.

The trade, stated plainly

On notification-path PRs the release-compile check now verifies a testability-enabled release build rather than a plain one. Type checking and the release-only Sendable diagnostics the check exists for are unaffected; what differs is cross-module optimization, so it is no longer byte-identical to what a signed candidate compiles. If that matters more than the lane being runnable, the alternative is raising the job timeout — but that leaves two full release compiles in the job and it will drift back.

Scope

This is the release lane only. The suite step's reds on other PRs are a different failure — every suite passes and one batch wedges for the full watchdog cap — fixed separately in #13551. Neither PR affects the other's lane.

Context and the other two options considered: #12735.

Failure-Class: none

🤖 Generated with Claude Code

Review in cubic

…est suite

Desktop Swift Release Compile runs two sequential release compiles inside a
60-minute job. Run 34610634122: the app build finished at 31.5 min
("Build complete! (1887.11s)"), then the regression step was cancelled at
27.8 min still mid-compile, on a warm dependency cache.

The step's own comment claimed it reused the first build. It did not. A plain
`swift build -c release` has testability off; `swift test -c release` needs it
on for `@testable import Omi_Computer`, and that flag difference invalidates
the module graph, so the step recompiled Omi_Computer, FirebaseCore, PostHog,
PLCrashReporter and every other dependency a second time. The module list in
that run's log is the evidence.

Build the test targets with testability in the first step and let the second
reuse them. Measured locally: `swift build -c release --build-tests
-Xswiftc -enable-testing` then `swift test -c release --skip-build --filter
UserNotificationCallbackBridgeTests/` runs the suite in 6.9s, 11 tests, 0
failures. Without the flags the same --skip-build fails with "Omi
ComputerPackageTests.xctest doesn't exist in file system", which is what
proved the products were never shared.

Gated on should_notification_release_regression, the same output that decides
whether the regression runs at all, so main pushes and Package.swift PRs do
not pay to compile test targets nothing executes. The contract test pins that
both steps read that one output: if they ever disagree nothing errors — the
build quietly omits the test targets and the step rebuilds the world again.

The trade worth naming: the release-compile check now verifies a
testability-enabled release build on notification-path PRs rather than a
plain one. Type checking and the release-only Sendable diagnostics the check
exists for are unaffected; cross-module optimization differs, so it is not
byte-identical to a signed candidate's compile.

Refs BasedHardware#12735

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 4 files

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

Re-trigger cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified end to end against the head. This is a well-diagnosed fix for a real failure mode: the release lane's second swift test -c release was rebuilding the entire module graph because the preceding release build lacked -enable-testing, putting a ~31 min build plus a ~28 min rebuild against a 60-minute job on every notification-path PR.

Per file:

  • desktop/macos/scripts/run-swift-ci.sh — --release-compile now conditionally adds --build-tests -Xswiftc -enable-testing when OMI_SWIFT_RELEASE_BUILD_TESTS=true, and --release-notification-regression mirrors the same env check to use --skip-build, falling back to the old build-then-test behavior when invoked standalone. The empty-array guard around "${release_build_args[@]}" is the right call for system bash 3.2 under set -u; syntax and guard semantics check out.
  • .github/workflows/desktop-swift-ci.yml — both the "Release compile" step and the regression step set OMI_SWIFT_RELEASE_BUILD_TESTS from the same needs.changes.outputs.should_notification_release_regression output, so the build and its consumer cannot disagree. The gate string appears exactly twice, matching the new contract assertion, and non-"true" values (empty/false) degrade to the previous plain build on both sides — consistent in every direction.
  • .github/scripts/test_desktop_swift_ci_contract.py — the new assertions (gate count == 2, regression if keyed on the same output) lock the wiring against future desync, which is exactly the silent-failure mode this PR eliminates. Running the full contract suite against the head files passes all 35 tests, and the check is selected for this diff via desktop-swift-ci-contract in .github/checks-manifest.yaml; this PR's own CI also forced the full debug suite against the changed runner script (lane full because run-swift-ci.sh changed) and is green.
  • desktop/macos/changelog/unreleased/20260912-release-lane-single-compile.json — {"kind":"none"} matches the existing convention for CI-only changes (e.g. the e2e-pool entry).

One residual note, not a blocker: "Desktop Swift Release Compile" is skipped on this PR itself (the PR lane reserves it for manifest changes), so the new single-compile path gets its first end-to-end exercise on the next notification-boundary PR or scheduled run after merge. If the wiring were ever wrong the failure is fail-closed — --skip-build errors on a missing test bundle and the job goes red rather than silently skipping — and the contract test now guards the desync case.

Excellent diagnosis; the run-log forensics in the description made this easy to verify. Because this changes release-lane CI machinery, it should get a human maintainer sign-off before merge rather than an automated one.


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 docs-tooling Layer: Documentation, examples, dev tools labels Sep 12, 2026
The regression step's condition was asserted with a job-wide assertIn, and
should_notification_release_regression appears three more times in that job —
the job-level `if:`, RELEASE_REQUIRED, and the build step's env. So the
assertion passed on the job body no matter what the step itself said, and
deleting the step's own `if:` left it green.

That is the one mistake this guard exists to catch. If the regression step
ever runs without the build step having been gated, `--skip-build` finds no
test bundle and the step recompiles the entire module graph — the ~28 min
rebuild this PR removes, reintroduced silently.

Extract the named step's own YAML and assert against that. Mutation-checked
both ways: deleting the regression step's `if:` now fails, and so does
dropping the env from the build step; the previous shape caught neither.

Failure-Class: none

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

Copy link
Copy Markdown
Member

Follow-up verified on 3693863: the contract assertions are now scoped the way they should have been. _step_block() in .github/scripts/test_desktop_swift_ci_contract.py extracts each named step's own YAML, so the gate-env assertion and the regression step's if: assertion can no longer be satisfied by the job-level if: or RELEASE_REQUIRED occurrences — the exact looseness raised in the review thread, and per the mutation checks described there, deleting either the step's if: or the build step's env now fails where the previous shape caught neither. This supersedes the count-based description in my earlier comment; the step-scoped shape is strictly stronger.

Also re-checked the value flow on this head: pre_push_ci_prediction.py's github_outputs() emits should_notification_release_regression as lowercase true/false, and run-swift-ci.sh enables the test-target build only on the exact string true, so no unexpected value can half-enable the path — anything non-true keeps the plain build and the old build-then-test behavior on both sides.

Unchanged from the earlier review: this alters release-lane CI machinery, and on notification-path PRs the release-compile check now verifies a testability-enabled release build rather than a plain one, so it should still get a human maintainer sign-off before merge rather than an automated one — leaving that with the workflow-review label.


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

Closing as superseded by #13555, which landed the same fix on main and goes further.

It arrived at the same diagnosis independently — the duplicate compile behind #13481 — and the same mechanism: build the app and tests once with -Xswiftc -enable-testing, then run the notification regression with --skip-build. Its measured numbers match what this PR found (703.57s build, 11 tests in 6.22s under --skip-build). It also compiles release tests for every target-changing PR and every scheduled/manual health run, which covers the #13123/#13467 class of release-only test breaks that this PR did not.

The shapes are not mergeable onto each other: main selects --release-test-compile in the workflow and has no OMI_SWIFT_RELEASE_BUILD_TESTS gate, so this branch's step-scoped assertions would pin a variable that no longer exists. Nothing here is worth carrying forward, so rather than resolve the conflict into an empty or failing diff, closing it. Main's version fails closed the same way — --skip-build with no test bundle goes red instead of rebuilding.

Thanks for the two verification passes; the step-scoping review is the part I would have wanted kept, and #13555's own tests already pin its wiring.

@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

docs-tooling Layer: Documentation, examples, dev tools 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