Skip to content

perf(ci): remove shadow planning from the PR critical path - #37699

Merged
nwparker merged 7 commits into
mainfrom
nwparker/CI-speed-audit
Nov 3, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/CI-speed-audit

Conversation

@nwparker

@nwparker nwparker commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Start all PR tests without spending a minute deciding to run all of them. Full planning fell from 64s to 7-17s in hosted validation. Preserve the same tests and isolation, and stop writing disposable compile caches on cache misses.

What Changed

  • Emit the full shard matrix from a dependency-free sparse checkout. Rebuild advisory selection after tests, outside the required gate.
  • Preserve full test discovery, isolation, selected-draft planning, provenance checks, and fail-closed fallback. Download selection artifacts only when selection was actually planned.
  • Reuse selected drafts' existing plans rather than paying for a second install and dependency-graph build in the advisory job.
  • Disable unpublished persistent transform writes on warm-consumer misses; retain cold-producer writes and explicit miss diagnostics.
  • Do not automate cache production. Review removed all changes to both cache-producing workflows. They are identical to main; this PR introduces no new cache generations, upload cadence, retention policy, or Actions write permissions.

Why

Audited every job in #37692. Its required gate took 573s: unit planning spent 64s on checkout/dependencies/shadow analysis before the 12 full shards could start. Packaging finished around 6m35s; static analysis took 214s. Module imports/transforms dominate unit cost. Shadow selection still selected 11,653/13,126 files for a small renderer change, with no valid current ownership records. Removing tests or sharing worker state was not justified.

The controlled cache comparison demonstrated a 10.1% lower median whole-shard time on the same source, but also exposed the storage and producer costs: 1,529,043,588 compressed bytes per generation and 86.9 producer runner-minutes, amortizing after about 12 warm full-PR runs. The repository currently stores about 9.44 GB / 8.79 GiB of Actions caches. Daily refresh is not a storage bound: immutable generations accumulate and can evict useful dependency caches. Therefore automatic production is not included, and the benchmark's warm-hit savings are not claimed as a shipped improvement.

The retained planning optimization removes serial setup and artifact work without adding a periodic full-suite producer. The cache-miss fix only removes consumer-local writes that were never uploaded.

The complete original per-job audit includes the static-check breakdown, test-value review, upstream source findings, cache sizes and per-shard measurements. This description supersedes its earlier proposed cache rollout.

Linked Issue

If you do not have one and are an outside contributor, your PR will be ignored. Refs is not sufficient. Link an actual issue

None linked; requested CI audit using #37692 as the reference.

Visual Proof

N/A - CI orchestration only; no application UI changes.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • ORCA_BACKGROUND_LAUNCH=1 pnpm test config/scripts/ci-unit-module-cache.test.mjs config/scripts/ci-unit-module-cache-contents.test.mjs config/scripts/ci-unit-plan.test.mjs config/scripts/ci-unit-selection-review.test.mjs config/scripts/ci-unit-sequencer.test.mjs config/scripts/pr-workflow-parallelism.test.mjs --maxWorkers=2 - passed: 83 tests in 6 files, including five draft/mode routing cases, warm/cold misses, provenance fallback and credential/error propagation.

  • ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 - passed all 14 checks after the final code edits and integration of current main, immediately before pushing 658ea5275c2.

  • actionlint -shellcheck= -ignore 'unexpected key "background"' -ignore 'step must run script with "run" section or run action with "uses" section' .github/workflows/unit-plan.yml .github/workflows/unit-tests.yml .github/workflows/unit-selection-evidence.yml .github/workflows/pr.yml - passed; ignores accommodate the repository's existing background/wait steps.

  • git diff origin/main -- .github/workflows/unit-module-cache.yml .github/workflows/unit-module-cache-benchmark.yml - empty: neither producer nor benchmark behavior changes.

  • Final full CI on 658ea5275c2 - passed: all 12 full unit shards, Linux/Windows packaging, static/type checks, mobile/layout, dependency isolation, Git versions, shell, Codex, xterm, Node 18 and wire compatibility, plus the required aggregate gate. Planner: 8s, versus 64s in the reference; advisory evidence: 52s outside the gate. Headless routing and LoC also passed.

  • Same-source experiment - passed all 36 shards with identical discovery/assignment/results/runtime/source checks and 12 valid warm hits. All 12 temporary comparison caches were individually identified and deleted. This validates the experiment, not an automatic production rollout.

  • Local platform: macOS ARM. Hosted checks cover Linux ARM/x64 and Windows. No application/UI behavior changed. Standalone local full lint/typecheck/test/build were not repeated; scoped local checks and full hosted gates cover the relevant changes.

Risk

Level: Medium

CI-only. Wrong matrix routing could omit tests; independent full discovery and provenance checks retain fail-closed fallback. Selected drafts retain their blocking plan. Advisory comparison remains outside the required aggregate gate. Cache identity, manifest validation, corrupt-cache fallback, save conditions and isolation are unchanged. Cache-producing workflows are unchanged, so there is no new cache growth or periodic producer cost to roll back. A plain revert restores prior orchestration. No application, SSH, mobile, workspace or persisted user-data behavior changes.

AI Disclosure

Review

Review found and resolved two issues: unbudgeted automatic cache generation, and duplicate dependency installation/graph work on selected draft PRs. No unresolved correctness finding remains in the retained diff. Final full hosted validation passed on the exact reviewed head 658ea5275c2.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Cloned and inspected pinned Vitest v5.0.5 at 7a825db43e2beca0b219d2eadaec334cb81af0c7, including isolated worker lifecycle, persistent-cache invalidation and transform-service behavior. Review traced planning callers, per-shard discovery, fallback plans, advisory completeness, warm/cold writes, publishing conditions and producer lifetime. Runtime/UI performance is not affected.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Audit every job in PR #37692; defer shadow planning off the required path and align transform-cache producers with hosted ARM consumers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nwparker

nwparker commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

PR CI speed audit

Delivered: #37699, CI-only and fully green on 0f5dc989403846ecd22065f9ef337a42b172b32d. Full planning fell from 64s to 7–17s across validation runs; the same-source warm-cache comparison reduced median whole-shard time 10.1%. No meaningful tests, assertions, platform gates, or isolation were removed.

Evidence and success criterion

Reference: PR #37692, head ac6d2ec6ec257a688980d09412db2e0014e60415, tested merge 566202ca3757ea75e43cfc394c3fe6e7182a9edb.

Success: reduce the required PR critical path without reducing meaningful assertions, runtime isolation, platform coverage, or fail-closed routing. Validate matrix/selection/cache regressions, the changed gate, a fresh PR run, and a same-source cold/producer/warm comparison. A later PR is not a controlled benchmark of total latency: changed paths, source, queueing, and caches can differ.

Where time goes

The required gate completed at 05:58:02Z, 573 seconds after workflow creation at 05:48:29Z. The advisory selection report finished later and did not block merging.

The main chain was detection (14s), unit planning (64s), shard scheduling/setup, the slowest shard (475s including 43s checkout), and the aggregate gate (5s). Linux and Windows packaging finished earlier, at 05:55:27Z and 05:55:24Z. Static analysis finished at 05:52:26Z.

Unit files: 13,126; 12 independent 4-vCPU ARM runners. Each file has an isolated worker. Worker startup summed to 1,138 seconds, NOT wall time. Module phase sums: collection/import 11,231s; test bodies 4,618s; setup 364s; environment 263s; preparation 33s. Vitest's separate summary attributes roughly 40-44% to imports and 25-30% to transforms, with bodies roughly 25-30%. These measurements overlap and must not be added to wall time.

All 12 transform-cache restores missed. No unit-module-v2-* archives existed in GitHub's cache store at audit time. The only producer was dispatch-only and used Blacksmith x64; PR consumers use GitHub-hosted ARM. Both the architecture and cache backend differ. Repository cache usage was already approximately 10.2 GB across 94 entries, so warm-cache speed AND archive size need measurement before treating caching as free.

Dynamic selection is not an immediate solution: the shadow graph selected 11,653/13,126 files (88.8%) for this six-file settings change. Every ownership record was invalid for the current context (checkedInputOwners: []). Unknown/indirect filesystem/subprocess consumers intentionally remain included. Enabling selected mode for ready PRs would weaken an explicitly staged rollout while saving little.

Every reference job

Durations below are runner job elapsed times, not sum of steps. Background steps overlap.

Workflow/job Seconds What it does, measured cost, and disposition
PR / detect changes and check repository guards 14 Sparse checkout 4s; Bun setup 2s; root-entry, README-link and required-context checks plus job routing. Already light and fail-closed; retain.
PR / static analysis and typecheck 214 Full checkout 23s, dependencies 19s, overlapping static checks then compilers. Detailed breakdown below. Not the reference critical path.
PR / unit_plan / plan 64 Full checkout 23s, install/build packages 21s, shadow import graph/planning 13s, artifact 2s. Every PR runs the full inventory anyway; move advisory graph work after the gate and emit a dependency-free full matrix.
PR / test / tests node 24 1/12 443 Checkout 5s, deps 23s, Electron 3s, test step 398s; Vitest 391.20s. Cache miss.
PR / test / tests node 24 2/12 386 Checkout 6s, deps 19s, Electron 3s, test step 348s; Vitest 341.68s. Cache miss.
PR / test / tests node 24 3/12 413 Checkout 6s, deps 23s, Electron 2s, test step 369s; Vitest 362.00s. Cache miss.
PR / test / tests node 24 4/12 422 Checkout 22s, deps 19s, Electron 3s, test step 366s; Vitest 359.96s. Cache miss.
PR / test / tests node 24 5/12 403 Checkout 22s, deps 19s, Electron 2s, test step 351s; Vitest 344.15s. Cache miss.
PR / test / tests node 24 6/12 409 Checkout 5s, deps 23s, Electron 2s, test step 364s; Vitest 357.47s. Cache miss.
PR / test / tests node 24 7/12 475 Checkout 43s, deps 22s, Electron 2s, test step 393s; Vitest 386.00s. Last shard to finish; checkout variation is material. Cache miss.
PR / test / tests node 24 8/12 407 Checkout 5s, deps 20s, Electron 2s, test step 368s; Vitest 361.57s. Cache miss.
PR / test / tests node 24 9/12 414 Checkout 22s, deps 18s, Electron 2s, test step 362s; Vitest 355.95s. Cache miss.
PR / test / tests node 24 10/12 463 Checkout 18s, deps 21s, Electron 3s, test step 407s; Vitest 399.70s (slowest test step). Cache miss.
PR / test / tests node 24 11/12 407 Checkout 5s, deps 20s, Electron 2s, test step 367s; Vitest 360.79s. Cache miss.
PR / test / tests node 24 12/12 413 Checkout 5s, deps 21s, Electron 3s, test step 372s; Vitest 365.63s. Cache miss.
PR / test / relay integration skipped Renderer-only diff excludes relay contracts. Isolates cloud workspace installation from all 12 shards; retain routing.
PR / package 398 Checkout 22s; root install 35s; mobile install 9s; descendant cleanup 34s; real Electron lifecycle 111s; builds 20s + mobile 12s; packaging 57s; real signal shutdown 56s; CLI contract 12s; CLI smoke 6s. Details below.
PR / package (windows) 395 Checkout 36s; root install 38s; mobile 22s; 83 boundary files 147s; loaded tree-kill 12s; build 54s; package 34s; CLI smoke 16s. Details below.
PR / mobile web app bundle skipped No mobile page inputs changed. Dedicated WebKit/Chrome render/census lane avoids putting browser/mobile installs in every unit shard.
PR / layout oracle skipped No layout-authority inputs changed. If selected, builds actual application and splits window scenarios; retain fail-closed routes.
PR / real IME skipped No IME inputs. Native IBus session is advisory and independently routed; no reference duration to claim.
PR / real WSL terminal skipped No WSL inputs. Real Windows/WSL lane cannot be replaced by Linux mocks; no reference duration to claim.
PR / dependency isolation under the global virtual store skipped No dependency-layout inputs. Empty HOME/store plus real resolution/typecheck proves undeclared dependencies; retain.
PR / Git compatibility skipped No Git inputs. Uses real 2.25.5/2.38.1/2.49.1 binaries/containers on independent lanes to avoid contention.
PR / Codex index-heal contract skipped No Codex contract inputs. Pinned real binaries plus latest hook compatibility exercise upstream behavior; mocks are not substitutes.
PR / xterm patch sync skipped No xterm inputs. Rebuilds pristine and patched pinned upstream artifacts for byte comparison; toolchain cached, results rebuilt.
PR / shell contracts skipped No shell inputs. Installs bounded pinned fish plus zsh, requires live shells, runs PTY/query/startup contracts. Do not remove platform contracts based on mocked units.
PR / cross-version wire compatibility skipped No wire/persistence compatibility inputs. Real newest-release skew and protocol/launcher guards need historical contents, unlike shallow unit checkouts.
PR / managed hooks on Node 18 skipped No managed-hook inputs. Tiny gate reuses preflight's actual Node 18 smoke instead of installing/building twice.
PR / unit_selection_evidence / selection_evidence 14 Checkout 3s, artifact download 2s, comparison/report. Advisory sibling, deliberately not in verify.needs. Deferred graph work now belongs here.
PR / PR checks passed 5 Verifies each selected required job succeeded and each excluded job was skipped. Retain strict selection/verdict checks.
Headless / changes 35 Checkout 22s, Node 5s, isolated compiler 2s, import graph 3s. Correctly concludes renderer-only changes do not affect headless runtime.
Headless / mobile_web_bundle skipped No affected headless qualification; shared mobile page artifact is not rebuilt unnecessarily.
Headless / desktop_template skipped No affected qualification/template inputs.
Headless / persistence skipped No affected headless graph inputs; six-platform qualification matrix not instantiated.
Headless / linux_glibc_floor skipped No affected native compatibility inputs; glibc-floor build is not replaced by a modern-runner build.
Headless / linux_glibc217_compat skipped No affected compatibility inputs; no reference duration to claim.
Headless / linux_musl skipped No affected compatibility inputs; Alpine/musl cannot be inferred from glibc success.
LoC / test vs non-test LoC 7 API-only trusted-default-branch script, no checkout; counts step 3s. Not a bottleneck. Retain write-token trust boundary.
CodeRabbit neutral External service, outside repository Actions implementation and required compute path.

Static analysis, step by step

Checkout (23s) and root dependencies (19s) are serial overhead. Bun setup is tiny. Early checks deliberately overlap; their elapsed times cannot be summed:

  • Process-host/compat import boundaries 50s: full source inventory and shared per-file parsed-specifier map. Enforces public exports, dependencies, subprocess ownership and compatibility fences. Keep full coverage.
  • Main-process sync-launch ratchet 22s: already a separate background step and excluded from generic ratchet runner.
  • Native Oxlint 24s, JS-plugin lint 40s, anti-slop 44s: AST/plugin work and Node/Bun bridges contend on four cores. Native/plugin separation already exists. Globally disabling plugins or linting only changed source would change gates, not merely accelerate them.
  • ast-grep 42s: rule fixtures plus one combined scan feeding both lint and flaky-test ratchet. The generic ratchet runner already excludes this ratchet: there is no duplicate scan to remove.
  • Formatting 5s: whole tree, cheap; local pre-commit can be skipped, so retain.
  • Focused quality plugins 7s and type-aware baseline 34s: waits constrain memory use; do not simply overlap every memory-heavy checker.
  • Changed-code quality 15s and changed-line React Doctor 7s: already scoped to actual changed code. Audit-tool verification 6s ensures lock-pinned executables.
  • Typecheck 67s: pinned Bun, two compiler processes/two threads, after type-aware lint releases memory.
  • Localization extraction 45s: overlaps compiler; sound source-input scope already avoids it when unchanged.
  • Generic ratchets 41s: discovered by filename, bounded workers. Guards architectural/performance hazards with grandfathered baselines.
  • Zustand budget and reliability manifest: individually below 2s.
  • CSS :has() restyle budget 5s and dead design-system classes 14s: real compilation/semantic scan, not screenshot proxies.
  • VM rollback guard: below 2s when inputs unchanged; actual cross-version repro when affected.
  • Node pin 2s; shared-mobile dependency lock guard 3s.
  • Every-test-has-a-runner 34s: audits file registration/import graph. Prevents tests silently disappearing; particularly important when changing CI selection.
  • Orcad smoke scope 8s: skips actual runtime build/smoke for unrelated renderer changes, correctly.
  • RPC catalog 6s; generated ACP, bundled guide and skill manifest checks below 2s each.
  • Localization catalogs 26s, coverage 13s, mobile strings 8s, mobile coverage 3s. Catalog check/extraction overlap other work.
  • Declaration-placement, feature-wall asset and macOS entitlements guards individually below 2s.
  • Explicit waits propagate background failures. Mobile-CI special test lane and managed Node18 smoke were not selected.

The source already contains substantial static-check optimization. Its 214s does not set this PR's 573s required path. Do not trade type safety or platform gates for optimizing a noncritical lane.

Test value and opportunities

The highest total module cost is often import cost, not assertion count. Examples: runtime RPC mobile streaming (~44.5s collection), restored-consumer journeys (~43.1s), orchestration federation output (~40.4s), settings browser-profile cookie clearing (~40.2s).

Slow bodies include structured-chat mail scaling (~50.5s), Claude helper recovery (~33.7s), CLI account subprocess (~33.6s), remote runtime download (~31.3s), Codex interrupt/settings (~30s). These drive real state machines, persistence, process cleanup and compatibility. Mail scaling tests intentionally observe absence of repeated work across backlogs; shortening observation windows without understanding timers would weaken them.

No tests deleted on the basis of names, duration, or mock count alone. Existing repository anti-pattern guidance rejects source-string inventories and self-fulfilling mocks, but this audit found the critical path is primarily isolated import/transform overhead, not proof that the slow behavioral tests are valueless.

Vitest's packages/vitest/src/node/pools/pool.ts reuses a runner only for nonisolated tasks; isolated tasks terminate it. Global --no-isolate would share module/global/mocking state across thousands of unrelated files. Preserve isolation. Persistent transforms reuse compilation, not test verdicts; preserve runtime/config/lock/platform validation and malformed-cache rejection.

Increasing shard count is not the first fix: 12 is already balanced at 1,093-1,094 files each; more shards consume more slots, replicate installs, and multiply caches. A balanced timing baseline should come from representative complete runs, not one noisy run.

Packaging assessment

Linux is not just a build. It checks daemon descendants, dual-Electron lifecycle, three real distro formats, root-package markers, AppImage-pinned Node, hostile launch environments and signal cleanup. Removing that coverage because a PR changes renderer code would hide packaging regressions in code that still ships. The 15 lifecycle files are intentionally serialized because parallel probes have exceeded deadlines on four cores. Docker image loading, native helper work and JS/web builds already overlap safely.

Windows' largest block is 83 platform-boundary files plus an isolated loaded tree-kill probe. It exercises real ACLs, native jobs, PTY, Unicode launcher/hooks, registry and process inheritance. It installs/extracts Electron once to prevent concurrent EBUSY/crashes and shares Rust binaries. Building starts after tests because Node/Electron native ABIs mutate the same outputs. Do not overlap those phases blindly.

Both packaging jobs can become the next critical path once unit latency drops enough. Optimize only with platform-native evidence; this macOS workstation cannot honestly reproduce their native timing.

Implemented scope

  • Dependency-free, sparse full-matrix planning for PRs; no full checkout/install/shadow graph before full unit shards.
  • Full inventory still discovered and balanced independently in each shard; invalid/missing selected evidence still falls back to full.
  • Reconstruct the shadow plan in advisory evidence against the same tested merge; source/discovery/completeness checks remain enforced.
  • Applied draft selection retains its original blocking plan and artifact path.
  • Skip downloads for a plan intentionally deferred.
  • On a warm-consumer cache miss, disable persistent transform writes: consumers never publish that cold output. Cold producers keep writes enabled.
  • Repair trusted-main transform-cache production to GitHub-hosted ARM with runtime/config-triggered refresh and a daily refresh.
  • Update existing same-source cold/producer/warm experiment to the actual PR matrix and Node major.

Validation checkpoints

PR: #37699

  • Initial targeted planning/selection/cache regressions: 97 tests passed in six files.

  • The first fresh PR run proved full planning fell from 64s to 14s (50s / 78% less). Dependency installation and plan artifact upload were skipped. The manual comparison's equivalent planner took 9s.

  • Deferred evidence completed in 51s, outside the gate, and reconstructed a complete 13,135-file reference against the exact tested merge. This newer main contains more files than Make settings theme pickers searchable #37692; do not compare whole-run times as if source and routing were identical.

  • That full run caught one coupled workflow-contract regression: the existing credential-removal test executes the github-script as plain JavaScript, and an embedded Actions expression was not executable there. Moved the boolean through the step environment and extended the behavioral test to deferred true/false/unset, preserving token removal and error propagation. No failed test was deleted or bypassed.

  • After that repair: 103 tests in seven targeted files passed, and all 14 pnpm check:changed --maxWorkers=2 checks passed.

  • The first cache experiment stopped after its baseline failed the same contract test; no producer or warm comparison ran, so it is not cache speed evidence. Restarted a same-source comparison on repaired commit 8c0c6d11b14: https://github.com/stablyai/orca/actions/runs/41588931783 .

  • Additional source inspection found a second avoidable cost: identity setup enabled fsModuleCache even on a failed warm restore, so every consumer wrote transforms that it would never publish. A warm miss now explicitly clears the cache path; cold producers retain writes. Focused CLI tests exercise both modes.

  • Warm-miss regression cases and the coupled workflow contract: ORCA_BACKGROUND_LAUNCH=1 pnpm test config/scripts/ci-unit-module-cache.test.mjs config/scripts/ci-unit-module-cache-contents.test.mjs config/scripts/ci-unit-plan.test.mjs config/scripts/ci-unit-selection-review.test.mjs config/scripts/ci-unit-sequencer.test.mjs config/scripts/pr-workflow-parallelism.test.mjs --maxWorkers=2 — 78 tests in six files passed. All 14 changed gates passed again; the pre-push command reused that unchanged successful result.

  • Full PR validation of 7c4743214d9: https://github.com/stablyai/orca/actions/runs/41589394417 — success. All 12 full shards, Linux/Windows packaging, static/type gates, mobile, rendered layout contracts, Git versions, shell contracts, Codex contracts, xterm, dependency isolation and wire compatibility passed. Headless routing and LoC workflows also passed. The previous repaired run was cancelled by this newer push, not a successful full run.

  • This successful run's planner took 9s, versus 64s in Make settings theme pickers searchable #37692: 55s / 86% less planning latency. Its shadow report completed in 47s outside the gate and validated a complete 13,137-file full run against tested merge f74d5caa91aa1246dae8f38bb1e39fb5a7abea8c.

  • Do not claim a whole-PR speedup from that cross-source run: workflow creation to gate was 666s, including roughly two minutes before planning and a broader routed job set. The latest source, queueing, runner variation, and test inventory differ from Make settings theme pickers searchable #37692.

  • The controlled producer successfully sealed/published all 12 archives. One generation occupies 1,529,043,588 compressed bytes (~1.42 GiB). At eight generations/day, a three-hour schedule would add ~11.4 GiB/day to a cache store already near quota. Narrowed periodic production to daily; configuration/toolchain pushes still refresh immediately. Per-module source hashing preserves correctness between refreshes.

Controlled cache result

Comparison run 41588931783 succeeded on the same source 8c0c6d11b14f0580b1889a83e4073af159d2b801, with baseline → cold producer → warm lanes, each using 12 fresh GitHub-hosted ARM runners and four workers per runner.

Validated every downloaded shard artifact, not just the workflow verdict: all 36 shards passed, all lanes covered the identical 13,127-file discovery inventory exactly once, assignment/results matched, source hashes and Node 24.22.2 / Bun 1.4.4 / Vitest 5.0.5 matched, and there were no unhandled errors or omitted diagnostic files. All 12 warm archives restored and passed validation, and their identities and producer source hashes matched. This source is the branch head rather than the later PR merge, hence the different inventory count.

Lane Median test step Maximum test step Median whole shard job Maximum whole shard job
Off / baseline 379.5s 422s 431.5s 477s
Cold producer 375s 402s 438.5s 460s
Warm consumer 331.5s 373s 388s 435s

Warm versus baseline: 48s / 12.6% lower median test time, 43.5s / 10.1% lower median whole-job time, and 42s / 8.8% lower maximum whole-job time. The slowest test step fell 49s / 11.6%. Ten shards' test steps improved, one tied, and one regressed 3s. This is one controlled source/run, not a confidence interval or a guarantee for every future PR.

Shard Baseline test Warm test Baseline whole job Warm whole job
1 390s 337s 441s 394s
2 357s 357s 408s 421s
3 380s 309s 434s 364s
4 380s 323s 435s 378s
5 367s 329s 420s 376s
6 393s 324s 443s 382s
7 422s 373s 477s 435s
8 362s 334s 415s 402s
9 379s 320s 429s 377s
10 359s 362s 408s 421s
11 357s 326s 415s 379s
12 407s 342s 461s 402s

Warm overhead was bounded: restore 2–4s, validation 3–4s, identity 0–1s per shard. Producer sealing took 3–4s and saving 3–5s. Summed collection/import worker time fell from 11,403.7s to 9,638.8s (15.5%); these are worker totals, not wall time. Assertions still ran in isolated workers.

One generation: 5,835,108,923 raw bytes, 1,529,043,588 compressed bytes across 12 archives, each approximately 20–26k entries. All 12 experiment cache IDs were individually matched to their producer identities, branch ref and run suffix before deletion; no shared/main/dependency caches were selected. Artifacts and the measurement summary remain available for review.

Compute is not free: producer jobs summed to 86.9 runner-minutes, versus 86.4 baseline and 78.9 warm. At the observed 7.6 runner-minutes saved per full warm PR, one daily producer amortizes after roughly 12 warm full-PR runs, excluding configuration-triggered refreshes and queue effects. This is another reason to use daily rather than three-hourly production.

The comparison predates only the warm-miss optimization and daily schedule: warm-hit/cache validation behavior is unchanged. The final production workflow has not run on main before merge. Daily refresh limits duplicate generations; the remaining ~5–8 minute unit work is still substantial. Further large gains require reducing expensive runtime import graphs or trustworthy ownership/selection evidence, not deleting meaningful assertions or globally sharing worker state.

Final integration checkpoint

The schedule-only follow-up, run 41591659826, exposed an unrelated new main regression in src/main/linear/issue-context/query-selections.test.ts: CHILDREN_QUERY became a depth-taking function in #37667 after #37663 added a fixture passing it directly as GraphQL source. It fails both typecheck (TS2322, line 82) and the existing GraphQL execution test. No CI optimization files are implicated; 11 other unit shards, both packages, mobile and rendered contracts passed.

The existing focused upstream repair, #37711, supplies CHILDREN_QUERY(1) and its required page size while retaining the independent GraphQL assertions. Its full required workflow and aggregate gate passed, and it merged as a1c02cf3fd9ac61baec6cfaa36048722756fabc9. Integrated repaired main rather than adding an unrelated application/test patch to this CI PR. The PR diff remains CI-only, all 14 changed gates passed again against repaired main, and merged workflow syntax checks passed.

Final post-integration validation of 0f5dc989403846ecd22065f9ef337a42b172b32d: https://github.com/stablyai/orca/actions/runs/41593384671 — success. The aggregate gate and every selected required job passed; Headless, LoC and external review checks are also green. PR merge state is clean.

The final planner took 7s; advisory rebuilding/comparison took 47s outside the gate and independently confirmed the complete 13,142-file merge inventory against ee86daa8dab4702806e11842326d1ca722d35b22. The final creation-to-gate elapsed time was 544s (9m04s) versus the reference's 573s, but differing source, routing, queues and runner variation mean this is not a controlled whole-PR speedup measurement.

All 14 ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 gates passed against repaired main immediately before the last push. Merged workflow actionlint, formatting and diff checks passed; the worktree is clean. All 12 temporary comparison caches were deleted and branch cache inventory is empty. Measurement artifacts and the pinned upstream source are retained in the session audit folder; no background helpers remain necessary.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The changes add a shared shard-matrix script and use its output in unit planning and module-cache workflows. Workflow inputs control deferred shadow planning, selection-plan downloads, and rebuilding plans for selection evidence. The evidence review script can use a fallback plan when shard-local plans are unavailable. Tests cover matrix generation, fallback-plan review, and warm and cold module-cache behavior.

Merge Risk: Low · up to 2e06a

Some cache-affecting changes may temporarily slow CI warm consumers, but the impact is bounded to cache performance.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is detailed and includes all required sections, testing evidence, risk, rollback, and checklist information. However, it does not provide the required linked issue; it states that no i… Add an actual linked issue, or confirm that the author is a maintainer and attach an applicable pre-existing issue. Reconcile the description with the workflow changes by accurately describing whether cache-production workflows changed.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "perf(ci): remove shadow planning from the PR critical path" matches the main change. The PR moves shadow-selection planning out of the required PR gate and into an advisory report that runs…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "perf(ci): remove shadow planning from the PR critical path" matches the main change. The PR moves shadow-selection planning out of the required PR gate and into an advisory report that runs after tests. The title names the performance goal and the affected area (CI), so a teammate scanning history can identify the primary change. The title is one short sentence and has no file lists, emojis, or vague terms.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 9 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Description check

Explanation

The description is detailed and includes all required sections, testing evidence, risk, rollback, and checklist information. However, it does not provide the required linked issue; it states that no issue is linked and references #37692 only as background. It also conflicts with the file summary, which shows changes to cache workflow files despite the description stating that cache-producing workflows are unchanged.

Resolution

Add an actual linked issue, or confirm that the author is a maintainer and attach an applicable pre-existing issue. Reconcile the description with the workflow changes by accurately describing whether cache-production workflows changed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed6b5a83-4a21-491d-9865-390724707505
Commits

Reviewing files that changed from the base of the PR and between 7c47432 and 2e06aaf.

Files selected for processing: 1
  • .github/workflows/unit-module-cache.yml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

nwparker and others added 3 commits November 2, 2026 22:17
…terpolation

Pass the workflow boolean through the step environment so the credential-removal and failure-propagation contract can execute both comparison paths directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The measured 12-shard generation occupies 1.42 GiB compressed. Keep immediate configuration refreshes without churning the cache quota eight times daily.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .github/workflows/unit-module-cache.yml Outdated
on:
workflow_dispatch:
schedule:
- cron: '23 3 * * *'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Performance & Scalability · Quick win

Keep push-trigger coverage aligned with cache policy inputs.

The daily schedule changes cache refreshes from every three hours to once per day. However, moduleCachePolicyHash() also hashes workspace package.json files, nested tsconfig*.json files, and config/dark-build-switches.cjs, while on.push.paths does not include all of these inputs. A change to an omitted file changes the cache identity without starting a producer, so warm PR jobs can miss the cache for almost 24 hours. Add the complete policy-input paths to on.push.paths. (github.com)

nwparker and others added 3 commits November 2, 2026 22:57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep producer and benchmark storage behavior unchanged from main. Do not add a daily 1.42 GiB cache generation to a near-quota cache store without retention and eviction evidence. Reuse existing draft selection artifacts instead of rebuilding the graph twice.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nwparker

nwparker commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Review: useful speedup retained; unbudgeted caching removed

Reviewed the entire retained diff, reusable workflow callers, full/selected matrix routing, shard discovery and provenance fallback, advisory completeness, cache identity/validation, consumer writes, producer saves and cleanup.

Severity Finding and evidence Resolution
High The earlier .github/workflows/unit-module-cache.yml:7-26 enabled immutable 1.42 GiB generations without a retained-byte bound. Existing caches use approximately 8.79 GiB. Daily scheduling still risks eviction of useful dependency caches, with an 86.9 runner-minute producer cost each time. Removed all producer and benchmark workflow changes. Both files are byte-identical to main; no new generation cadence, storage growth, producer compute or write permission is introduced.
Medium The earlier .github/workflows/pr.yml:909 always rebuilt the advisory graph, including selected drafts that already had a blocking graph/plan and per-shard plan artifacts. Rebuild only when planning was deferred. Five mode/draft cases exercise the actual workflow expressions and keep selected-draft artifact downloads aligned.

No unresolved correctness finding remains in the retained changes. Existing dispatch-only cache experiments are not a budgeted production rollout and are not enabled automatically.

Resource/performance coverage

Question Disposition
Work before skip gates Full matrix needs no install/discovery/graph; selected drafts retain their necessary blocking plan. Advisory work runs once and is not required by the aggregate gate.
Multiplied ownership/work Full shards still independently discover/balance the complete inventory. Duplicate selected-draft install/graph work was removed. No additional producer jobs are scheduled.
Execution/storage layer Hosted Linux ARM unit runners and Linux/Windows packaging validated; no application runtime path changes. Warm misses disable local persistent writes. Producer/save workflows and conditions are unchanged.
Growth/progress New automatic immutable generations removed. No new cache storage/retention policy or uploads; zero unit-module-v2-* entries after validation. Existing repository caches were not deleted.
Host assumptions Sparse matrix uses Node built-ins; full tests still run on the existing hosts. Cache runtime/config/lock/platform identity is unchanged. No SSH/mobile/application behavior changed.
Obsolete work/cleanup Missing/corrupt caches retain cold fallback. Invalid selection provenance retains full discovery. Advisory failures remain non-blocking. Temporary experiment caches were already individually deleted.

Final evidence

  • Reviewed/pushed head: 658ea5275c2952bb0294f9edaeb476a53093ab30.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm test config/scripts/ci-unit-module-cache.test.mjs config/scripts/ci-unit-module-cache-contents.test.mjs config/scripts/ci-unit-plan.test.mjs config/scripts/ci-unit-selection-review.test.mjs config/scripts/ci-unit-sequencer.test.mjs config/scripts/pr-workflow-parallelism.test.mjs --maxWorkers=2 - passed, 83 tests in 6 files.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 - passed all 14 checks after final edits/current-main integration and immediately before push.
  • Changed workflow actionlint, formatting and diff checks - passed.
  • Full PR validation - passed all selected required jobs and the aggregate gate, including 12 complete unit shards, static/type, Linux/Windows packaging and routed contract lanes. Headless and LoC passed.
  • Full planning: 8s versus 64s in the reference. Advisory evidence: 52s outside the gate. The source/routing differ, so no controlled whole-PR percentage is claimed.
  • The previous 10.1% warm-cache result is a controlled experiment only, not a benefit claimed for the narrowed production change.

@nwparker
nwparker merged commit ac91ff6 into main Nov 3, 2026
50 of 51 checks passed
nwparker added a commit that referenced this pull request Nov 3, 2026
Follow-up to #37699: pr.yml computes defer_shadow once, unit-plan.yml
uses only that input and exposes selection_planned, and the test and
evidence jobs read that output instead of repeating the condition.
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