Repository navigation
fix(desktop): unblock the release lane — KG ResolveOutcome is Sendable - #11373
Conversation
The release (whole-module) compile rejects returning the non-Sendable ResolveOutcome from nonisolated resolveDiscoveryText — debug builds do not, so this only surfaced in the Desktop Swift Release Compile gate, where it has blocked every beta candidate since #11369. ClientGraph carries only locally-built immutable String/[String] values inside [String: Any] JSON-shaped dictionaries, so it is @unchecked Sendable with that contract stated at the declaration. Verified: xcrun swift build -c release --package-path Desktop — Build complete (353s), zero errors. Failure-Class: none
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 5/5
- In
desktop/macos/Desktop/Sources/Services/KnowledgeGraphToolSupport.swift,ClientGraph’s documentedSendableguarantee can be bypassed via the internal memberwise initializer, so non-Sendablenode/edge payloads could slip in and create subtle concurrency hazards at runtime — make the memberwise init inaccessible (or add an explicit validated initializer) to enforce the contract.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/macos/Desktop/Sources/Services/KnowledgeGraphToolSupport.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/Services/KnowledgeGraphToolSupport.swift:9">
P3: `ClientGraph`'s Sendable guarantee is documented but not enforced: the implicit memberwise `ClientGraph(nodes:edges:)` initializer is internal, so any module code can construct it with non-Sendable values (e.g. a `Date`, `URL`, or a mutable reference) and silently invalidate the `@unchecked Sendable` promise once the value crosses the async seam. Consider making the initializer `private` (from the type's own closure the only construction site is in this file) or funneling construction through a file-private factory that builds the `[String: Any]` from the known immutable `String`/`[String]` fields, so the documented contract is enforced by the type rather than by convention.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| /// built locally in `resolveDiscoveryText` — nothing shared or mutable crosses the boundary. | ||
| /// `@unchecked` because `Any` erases what the initializer guarantees; the release | ||
| /// (whole-module) compile otherwise rejects returning this across the async seam. | ||
| struct ClientGraph: @unchecked Sendable { |
There was a problem hiding this comment.
P3: ClientGraph's Sendable guarantee is documented but not enforced: the implicit memberwise ClientGraph(nodes:edges:) initializer is internal, so any module code can construct it with non-Sendable values (e.g. a Date, URL, or a mutable reference) and silently invalidate the @unchecked Sendable promise once the value crosses the async seam. Consider making the initializer private (from the type's own closure the only construction site is in this file) or funneling construction through a file-private factory that builds the [String: Any] from the known immutable String/[String] fields, so the documented contract is enforced by the type rather than by convention.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/Services/KnowledgeGraphToolSupport.swift, line 9:
<comment>`ClientGraph`'s Sendable guarantee is documented but not enforced: the implicit memberwise `ClientGraph(nodes:edges:)` initializer is internal, so any module code can construct it with non-Sendable values (e.g. a `Date`, `URL`, or a mutable reference) and silently invalidate the `@unchecked Sendable` promise once the value crosses the async seam. Consider making the initializer `private` (from the type's own closure the only construction site is in this file) or funneling construction through a file-private factory that builds the `[String: Any]` from the known immutable `String`/`[String]` fields, so the documented contract is enforced by the type rather than by convention.</comment>
<file context>
@@ -1,12 +1,17 @@
+ /// built locally in `resolveDiscoveryText` — nothing shared or mutable crosses the boundary.
+ /// `@unchecked` because `Any` erases what the initializer guarantees; the release
+ /// (whole-module) compile otherwise rejects returning this across the async seam.
+ struct ClientGraph: @unchecked Sendable {
let nodes: [[String: Any]]
let edges: [[String: Any]]
</file context>
…ate unblock) (#11375) Release Eligibility re-runs the desktop-changelog-entry check on the main push lane where #11373's no-changelog-needed label is invisible, so the release gate stayed red and no candidate can cut while the served beta (v0.12.154) is broken (#11374). The fragment satisfies the check in every lane. No code change.
…se gate) (#11376) The release planner binds to the newest releasable desktop SHA — currently #11373's, which carries an immutable Release Eligibility failure (its changelog exemption label is invisible to the main push lane; fragment landed later in #11375). This Swift-path commit makes the newest releasable SHA one whose tree contains the fragment, so eligibility passes and the candidate for the broken served beta (#11374) can cut. Comment-only change.
Release Eligibility runs the changelog manifest check on the main push lane, where the no-changelog-needed PR label from BasedHardware#11373 does not exist — so the release gate stayed red. The fragment is the lane-independent satisfier.
… push) (#11377) Release Eligibility applies desktop-changelog-entry per push on the main lane, where PR labels are invisible — #11373 and #11376 both failed it, leaving the newest releasable SHA permanently ineligible while the served beta is broken (#11374). This pairs a comment-only Swift touch with its own unreleased fragment so the next releasable SHA passes and the candidate cuts. No code change.
Puts the newest releasable desktop SHA after the changelog fragment (BasedHardware#11375) so Release Eligibility can pass and the candidate can cut; the prior releasable SHA (BasedHardware#11373) carries an immutable eligibility failure. See BasedHardware#11374.
… one push Release Eligibility evaluates the changelog contract per push on main, where PR labels are invisible: a desktop Swift diff must carry its own unreleased fragment. BasedHardware#11373 and BasedHardware#11376 each failed that check, keeping the newest releasable SHA ineligible while the served beta is broken (BasedHardware#11374). This commit pairs a comment-only Swift touch with a fragment so the newest releasable SHA passes eligibility and the candidate can cut.
…aster builds (#11381) ## Summary The three pipeline changes Nik requested after incident #11374 (broken served beta + wedged release lane): auto-updates to beta at most hourly, a guaranteed works-at-launch floor, and a faster pipeline. **1. Hourly release train, un-wedgeable** - `desktop_auto_release.yml` gains an hourly `schedule` (`7 * * * *`); the planner's new `--min-tag-interval-seconds` (3300, schedule runs only) makes the train cut at most one candidate per hour, coalescing all merges since the last tag. Manual dispatch stays immediate (the emergency lane #11374 used). - Release Eligibility's changelog gate accepts fragments already present in the tree (`DESKTOP_CHANGELOG_ACCEPT_TREE_FRAGMENTS=1` on the release lane only) — the per-push PR-label blindness that wedged the gate three times today (#11373/#11375/#11377) cannot recur. Per-PR enforcement unchanged. - The planner falls back to the newest *green* releasable SHA (bounded scan) when the newest one carries a failed required check, instead of stalling the train entirely; no-fallback still blocks loudly. **2. Works-at-launch floor** - The signed-artifact smoke's sustained-liveness launch probe now ALWAYS runs (it was silently short-circuited whenever `--notification-callback-canary` was passed — which is every CI release build — because the canary app deliberately exits after writing its marker). Every candidate now proves "launches via LaunchServices and stays alive" for both identities before publication. **3. Faster wall-clock + release-only breaks die in PRs** - Codemagic caches `Desktop/.build` (the two cold release compiles were the single largest cost). - `desktop-swift-release-compile` now runs on PRs for any releasable desktop change, not only pushes/Package changes — the exact class that shipped the KG Sendable break through a green-debug PR. Follow-up (filed separately): launch-smoke promotion tier + async T2 with auto-rollback, and parallel notarization. ## Product invariants affected - INV-AUTH-1 - INV-BETA-1 ## Verification - `test_plan_desktop_release.py` 23/23 (new: hourly-train defer, manual-dispatch bypass, green-SHA fallback, no-fallback block; trigger-contract tests updated to the train design per Nik's directive). - `test_desktop_changelog.py` 7/7 (new: tree-fragment acceptance, empty-dir rejection, invalid-fragment failure). - `test_pre_push_ci_prediction.py` 14/14 (asymmetry test replaced with PR+push parity, non-desktop negative case). - `bash -n` on the smoke script; `py_compile` on all touched Python. - UNVERIFIED until live: the hourly cron firing, Codemagic cache hit rate, and the smoke launch-probe pass on a real builder — will be validated on the first scheduled train run after merge (this PR itself is a releasable-path change, so the next train cut exercises the whole loop). Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11381?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
…aster builds 1. desktop_auto_release runs hourly (schedule + planner --min-tag-interval- seconds 3300 on schedule runs only): at most one candidate per hour, coalescing merges; manual dispatch stays immediate. The planner also falls back to the newest green releasable SHA when the newest one carries a failed required check, so a red tip no longer stalls the train. 2. Release Eligibility accepts changelog fragments already in the tree (release lane only) — the per-push PR-label blindness that wedged the gate three times in BasedHardware#11374 cannot recur. 3. The signed-artifact smoke launch probe always asserts sustained liveness; it was silently short-circuited by canary mode on every CI release build. 4. Codemagic caches Desktop/.build; desktop-swift-release-compile runs on PRs for releasable desktop changes so release-only strict-concurrency breaks (BasedHardware#11373) die before merge. Verified: test_plan_desktop_release 23/23, test_desktop_changelog 7/7, test_pre_push_ci_prediction 14/14, bash -n smoke script, py_compile all.
## Summary Closes SCA-343. The `no-changelog-needed` PR label greened the desktop changelog gate and then reddened main's Release Eligibility run, because push has no PR context. That is a trap: a green PR can poison a main SHA and block `gcp_backend.yml` deploys. Live instance: #11778. Same class as #11373 and #11039. ### Approach taken: (2) + (3) **In-repo `{"kind": "none"}` fragment** as the durable internal exemption, **and reject the label as an exemption for production desktop paths**. - A new unreleased fragment of `{"kind": "none"}` satisfies both the PR-run and the post-merge push-run. It lives in the diff, so both lanes see the same evidence. - `--skip` / `no-changelog-needed` no longer passes when the diff touches production desktop paths. The PR-run and push-run therefore agree on the #11778 shape (both fail without a fragment; both pass with `kind: none`). - Leftover `kind: none` fragments do **not** satisfy release-lane `--accept-tree-fragments`. That lane still requires real user-facing notes for the next release. - Release consolidation ignores `kind: none` so it never becomes a user-facing changelog line. ### Why the others were rejected 1. **Resolve the PR from the merge commit and read labels via the API.** Closest to the old UI intent, but it adds a network dependency to a gate that is otherwise hermetic, and it must fail-closed on direct pushes and back-merges. A label would still be invisible to local `make preflight` / pre-push. 3. **Reject the label alone** (no in-repo marker). Smallest diff, but it forces a dishonest user-facing note for genuinely internal production edits such as dead-code deletion. Combined with (2), authors have an honest, durable escape. The invariant: a PR that is green on this gate cannot redden `main` on the same gate. ## Product invariants affected none ## Failure class (fixes) Failure-Class: new Registers `FC-changelog-exemption-lost-at-merge` with a reusable guard: `evaluate_changelog_requirement()` plus the #11778 regression in `.github/scripts/test_desktop_changelog.py`. Evidence PRs: #11039, #11373, #11778. ## Authors Internal-only production desktop edits (for example dead-code deletion under `Desktop/Sources/`) now need: ```json {"kind": "none"} ``` under `desktop/macos/changelog/unreleased/`. The `no-changelog-needed` label is not an exemption. Documented in `desktop/macos/AGENTS.md`. ## Test plan - [x] `python3 .github/scripts/test_desktop_changelog.py` — 16 tests, including the #11778 PR-vs-push agreement cases - [x] `python3 .github/scripts/desktop-changelog.py validate` - [x] `python3 scripts/test_failure_class.py` - [x] `scripts/pr-preflight --pr-body-file pr-body.md` - [ ] Confirm CI `desktop-changelog-io-tests` and `desktop-changelog-entry` on this PR - [ ] Confirm a follow-up internal Sources edit without a fragment fails both the PR lane and a simulated push lane (`--accept-tree-fragments`) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11797?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
… flake removed (#12247) * ci(desktop-windows): cache electron & electron-builder downloads The Linux package job failed on main (EAI_AGAIN github.com) and on PRs (read ECONNRESET) because electron-builder re-downloads its packaging tools on every run. Cache the tool and Electron archives so steady-state builds never depend on those endpoints, on both the Linux and Windows packaging jobs. Co-Authored-By: Claude Fable 5 <[email protected]> * ci(hermetic-e2e): stop minting red checks from cancelled runs; harden sync stack readiness The merge gate ran under always() and failed hard on 'cancelled' upstream results whenever cancel-in-progress superseded a run — 3 of the last 4 re-run-to-green cycles on this workflow were exactly that. Gate now goes neutral on cancellation and defers to the superseding run. The sync Cloud Tasks stack's one genuine flake: scenarios run back-to-back, a dying child of the previous stack can still answer a TCP probe, and the authoritative health check had the tightest budget (20s) while the weak port probe had the generous one. close() now drains the stack's ports and health gets 60s. Co-Authored-By: Claude Fable 5 <[email protected]> * ci(desktop-swift): collapse macOS-runner demand that was queueing every run Desktop Swift CI's tail (p90 150 min, max 218 min) was queue time: the repo's only macos-15 consumers demanded ~4.9 concurrent runners against a cap of ~5. Cut the demand instead of the deadline: - Run the release-mode UserNotifications regression inside the Release Compile job, next to the release build it consumes, instead of paying a second from-scratch release build (~31 min) on the verify runner. The planner still requires the Release Compile check by exact name, and the Build & Tests aggregate now hard-fails on the release job's result, so release tagging and PR merges both still gate on it (#11373/#11374 protection preserved). - Cache SwiftPM dependencies and the release Desktop/.build in the Release Compile job, saved from main pushes so every ref can restore it, and drop the forced rm -rf that guaranteed a ~20-min cold build. - Run launcher script tests 3-way parallel with per-test logs (9.3 min serial p50), and widen the build-lock recovery budgets that saturated runners pushed past 4s. - blob:none the verify checkout; full history stays for diffing. Co-Authored-By: Claude Fable 5 <[email protected]> * ci(mobile,web,parakeet): kill checkout/cache tails and 45-min unschedulable burns Mobile and Web Checks' p90-to-max tail was almost entirely actions/checkout pulling all blobs of a ~1.25GB repo with fetch-depth: 0 (a 53-minute checkout-only Web run happened); history-needing jobs now use blob:none and worktree-only jobs go shallow, with timeout caps so no job can idle unbounded again. The Android compile smoke paid a ~700s cold Gradle build every run because the default cache policy never wrote from main; main now seeds the cache PRs read, and the build_runner cache keys drop the run_id suffix that guaranteed a miss on every single run. Parakeet GPU tests have failed nightly since 08-03 burning exactly 45 min each with zero logs: the pod is unschedulable (L4 pool at capacity) and the workflow neither noticed nor captured pod events. Gate on PodScheduled within 5 minutes with the real cause in the error, stream pod logs live so deadline kills keep evidence, and include pod events in diagnostics. The capacity fix itself (NLLB squatting the parakeet pool's second GPU) is a cluster change tracked separately. Co-Authored-By: Claude Fable 5 <[email protected]> * ci(repo-checks): make the line-count ratchet invariant under base drift; pin uv 13 of the last 17 Repo Checks failures were the line-count ratchet, and the nondeterministic ones shared one cause: the check demanded byte-exact absolute counts against a synthetic merge with origin/main, which moves under every open PR (~90 pushes/hr). A correct declaration went stale with no author action, in both directions (drifted endpoints, and previously- mandatory exceptions turning fatally 'unused' when main absorbed an edit). The declaration now approves a growth *allowance* — the delta is a property of the PR alone — and an exception the diff no longer needs warns instead of failing. Growth beyond the allowance, duplicates, malformed lines, and unsupported paths still fail. Also pin setup-uv's resolved version (matching backend/Dockerfile's UV_VERSION) so it stops fetching the astral-sh 'latest' manifest, which hard-failed a run. Co-Authored-By: Claude Fable 5 <[email protected]> * ci: pin setup-uv's resolved version everywhere it was fetching 'latest' Every unpinned astral-sh/setup-uv call resolves 'latest' by fetching the astral-sh/versions manifest from raw.githubusercontent.com at job start — one observed Repo Checks failure was exactly that fetch dying. Pin the same 0.11.13 the backend Dockerfiles already use, which the action resolves locally with no network call. repo-checks.yml was pinned in the previous commit; this covers the remaining call sites and the release-eligibility action (with its byte-exact contract fixture). Co-Authored-By: Claude Fable 5 <[email protected]> * ci(desktop-swift): batch SwiftPM test invocations with per-suite fallback The debug suite spawned one 'xcrun swift test' process per discovered suite — 674 SwiftPM startups at ~5.1s each, ~28.7 min of the verify job's wall clock, dwarfing actual test execution. Workers now run suites in batches of 25 through one SwiftPM process (repeated --filter flags), with batching kept strictly optimistic: a batch that exits non-zero or times out is discarded and every member re-runs through the untouched per-suite path, so isolation semantics, per-suite budgets, and failure attribution are unchanged for anything red. The serial shared-auth cluster is never batched, and OMI_SWIFT_TEST_SUITE_BATCH_SIZE=1 restores the old behavior bit-for-bit. Also fixes a pre-existing bash-3.2 set -u break (empty build_args expansion) that made OMI_SWIFT_TEST_PREBUILD=0 kill every suite, and restores the case-pattern skip list in the workflow's launcher step that check-launcher-test-skips.py parses. Co-Authored-By: Claude Fable 5 <[email protected]> * ci(backend-unit): fail-open module stubs, checkout tail, and honest runner verdicts The suite's recurring 'flake' was one deterministic trap: a module-scope sys.modules['utils'] stub with __path__ = [] turned every new import in routers/conversations.py into a ModuleNotFoundError for whoever ran CI next — main broke twice on 2026-08-25 and four unrelated PRs inherited the red. The stub package now carries the real package __path__, so unlisted submodules resolve to the real module instead of raising (explicit stubs still stub; verified by reproducing the incident against both versions). Checkout p90 was 267s and max 786s from full-blob clones; blob:none keeps the merge-base history scripts/changed-files needs. timeout 45→30 so a hang stops burning a concurrency slot for 25 minutes past the p90. Also two standing runner bugs found while measuring: pytest's exit 5 on total worker death was read as 'no tests selected' and reported green, and the fast-unit duration guard's verdict was silently discarded under xdist (workers now hand offenders to the controller). A single-session xdist partition of the suite was implemented, measured, and disproved on this tree (upb descriptor segfaults, OOM at 815 files, per-worker collection); it ships opt-in via BACKEND_PYTEST_PARALLEL_SESSION=1 with the measurements in the comments, default behavior unchanged. Co-Authored-By: Claude Fable 5 <[email protected]> * chore(desktop): changelog fragment for internal CI runner changes Co-Authored-By: Claude Fable 5 <[email protected]> * ci(desktop-swift): keep measure-block suites out of batches; three workers The first PR run of the batched suite exposed one pathology: the batch carrying MemoryAtlasPerformanceHarnessTests (245s of XCTest measure blocks, slower still under contention) blew its 17-minute budget and paid the 25-suite isolated fallback on top — 15 of the step's 40 minutes. Measure suites are now derived from the source (like the serial cluster, so a new one cannot silently join the batch pool) and run in their own SwiftPM process with a doubled per-suite budget. With per-invocation SwiftPM startup gone — the reason two workers were the measured ceiling — workers now match the runner's three cores. This PR's CI runs are the macOS-runner evidence; drop back to two if the performance harness starts timing out. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
…e) (#18466) ## Summary - Add durable mobile release-note fragments and mergeable marketing-version collections, deriving bounded iOS and Android text only when needed. - Require a deterministic, app-scoped fragment or `none` exemption on PRs and main pushes; exact internal release-control paths remain exempt. This gate is mobile-specific rather than sharing the desktop guard because the mobile authoring root and release behavior differ; the PR-label/post-merge mismatch seen in desktop PRs #11373 and #11778 is covered with offline fixtures. - Add a manual-only Codemagic lane for promoting exact existing, processed iOS and alpha Android builds with roll-forward public-version checks; do not modify current build lanes. Failure-Class: none ## Product invariants affected - INV-AUTH-1 - INV-DATA-1 - INV-BETA-1 #### Test plan - [x] `python3 .github/scripts/test_mobile_changelog.py` (33 offline tests) - [x] `python3 app/scripts/mobile_store_promote_test.py` (9 offline tests) - [x] `python3 .github/scripts/check-release-process-guards.py` - [x] `make preflight` (28 selected checks passed) - [ ] Codemagic live store promotion deliberately not invoked (manual operator confirmation is required) Generated with [Devin](https://devin.ai) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/18466?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Desktop Swift Release Compilehas been red onmainsince #11369 (strict-concurrency error only visible under the release lane's whole-module optimization), which fails the auto-release gate closed — no beta candidate has cut, so #11372 (and everything since the last tag) is not reaching users.KnowledgeGraphToolSupport.ResolveOutcomewas non-Sendable (itsClientGraphcarries[String: Any]JSON-shaped dictionaries) and is returned from a nonisolated async function. The dictionaries hold only locally-built immutableString/[String]values, soClientGraphis now@unchecked Sendablewith that contract documented at the declaration, andResolveOutcomeisSendable.Verification
xcrun swift build -c release --package-path Desktoplocally: Build complete (353.8s), zero errors — the exact lane that fails in CI.Failure-Class: none