Repository navigation
ci(perf): unlock test parallelism, optimize hot dev crates, cache windows-cli, and record budgets #1953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(perf): unlock test parallelism, optimize hot dev crates, cache windows-cli, and record budgets #1953
Changes from all commits
7420e87
6103b4a
c3d519f
3a1696f
923aa33
edcd62c
d46eb4b
a70d398
1a81f00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Set up Windows native code layout toolchain | ||
| description: Install the pinned MSVC Rust host toolchain, configure MSVC build tools, and locate lld-link. | ||
| inputs: | ||
| target: | ||
| description: Native Rust target triple (x86_64-pc-windows-msvc or aarch64-pc-windows-msvc) | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Select native MSVC Rust toolchain | ||
| shell: powershell | ||
| env: | ||
| DIM_LAYOUT_TARGET: ${{ inputs.target }} | ||
| run: | | ||
| $channel = python -c "import tomllib; print(tomllib.load(open('rust-toolchain.toml', 'rb'))['toolchain']['channel'])" | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
| $toolchain = "$channel-$env:DIM_LAYOUT_TARGET" | ||
| rustup toolchain install $toolchain --profile minimal | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
| "RUSTUP_TOOLCHAIN=$toolchain" >> $env:GITHUB_ENV | ||
| - name: Configure Windows C/C++ toolchain | ||
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | ||
| with: | ||
| arch: ${{ runner.arch == 'ARM64' && 'arm64' || 'amd64' }} | ||
| - name: Locate lld-link | ||
| shell: powershell | ||
| run: | | ||
| $linker = Get-Command lld-link -ErrorAction SilentlyContinue | ||
| if (!$linker) { | ||
| $linker = Get-ChildItem -Recurse -Filter lld-link.exe -ErrorAction SilentlyContinue ` | ||
| -Path "$env:ProgramFiles\LLVM\bin", "$env:ProgramFiles\Microsoft Visual Studio\2022\*\VC\Tools\Llvm\*\bin" | | ||
| Select-Object -First 1 | ||
| } | ||
| if ($linker) { | ||
| $path = if ($linker -is [System.Management.Automation.ApplicationInfo]) { $linker.Source } else { $linker.FullName } | ||
| Split-Path $path >> $env:GITHUB_PATH | ||
| Write-Output "Using $path" | ||
| } else { | ||
| Write-Output 'lld-link is not on PATH; the build will use the Rust toolchain rust-lld' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,7 @@ jobs: | |
| timeout-minutes: 15 | ||
| env: | ||
| CARGO_INCREMENTAL: "0" | ||
| CARGO_TARGET_DIR: ${{ github.workspace }}/../.dim-windows-cli-target | ||
| RUSTC_WRAPPER: "" | ||
| steps: | ||
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | ||
|
|
@@ -111,6 +112,34 @@ jobs: | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | ||
| with: | ||
| arch: amd64 | ||
| - name: Reuse bounded Windows CLI target directory | ||
| shell: powershell | ||
| env: | ||
| CACHE_STAMP: ${{ hashFiles('rust-toolchain.toml') }}-${{ env.CARGO_PROFILE_DEV_DEBUG }} | ||
| run: | | ||
| $targetDir = [System.IO.Path]::GetFullPath($env:CARGO_TARGET_DIR) | ||
| $stampFile = Join-Path $targetDir '.cache-stamp' | ||
| $maxBytes = 6GB | ||
| $reset = $false | ||
| if (Test-Path $targetDir) { | ||
| $current = if (Test-Path $stampFile) { (Get-Content -Raw $stampFile).Trim() } else { '' } | ||
| if ($current -ne $env:CACHE_STAMP) { | ||
| Write-Output 'Resetting Windows CLI target cache (toolchain or profile stamp changed).' | ||
| $reset = $true | ||
| } else { | ||
| $bytes = (Get-ChildItem -LiteralPath $targetDir -Recurse -File -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum | ||
| if ($bytes -gt $maxBytes) { | ||
| Write-Output "Resetting Windows CLI target cache ($([math]::Round($bytes / 1GB, 2)) GiB exceeded 6 GiB budget)." | ||
| $reset = $true | ||
| } | ||
| } | ||
| } | ||
| if ($reset) { | ||
| Remove-Item -LiteralPath $targetDir -Recurse -Force | ||
| } | ||
| New-Item -ItemType Directory -Path $targetDir -Force | Out-Null | ||
| Set-Content -LiteralPath $stampFile -Value $env:CACHE_STAMP -NoNewline | ||
| "CARGO_TARGET_DIR=$targetDir" >> $env:GITHUB_ENV | ||
| - name: Verify native Windows CLI boundaries | ||
| run: cargo test --locked -p dim-cli --lib | ||
| web: | ||
|
|
@@ -198,8 +227,9 @@ jobs: | |
| run: | | ||
| echo "CPUs: $(nproc)" | ||
| grep -E 'MemTotal|MemAvailable' /proc/meminfo | ||
| # Without a working bubblewrap the confined process tests return without running. | ||
| bwrap --ro-bind / / true | ||
| # The confined tests create a user namespace and a private /proc, so | ||
| # check the sandbox they use instead of a plain read-only bind. | ||
| bwrap --unshare-user --unshare-pid --proc /proc --dev /dev --ro-bind / / true | ||
| - name: Build and lint the Rust workspace | ||
| if: needs.changes.outputs.rust == 'true' | ||
| shell: bash | ||
|
|
@@ -223,10 +253,38 @@ jobs: | |
| target/debug/xtask check | ||
| - name: Run compiled workspace tests | ||
| if: needs.changes.outputs.rust == 'true' | ||
| shell: bash | ||
| env: | ||
| DIM_TEST_TIMEOUT_MS: "900000" | ||
| run: | | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl --workspace --test-threads=3 | ||
| set -euo pipefail | ||
| if [[ "$RUNNER_OS" == Linux ]]; then | ||
| cpus=$(nproc) | ||
| # Runner hosts may share their physical cores between instances and | ||
| # report SMT siblings as CPUs; scale by the cores this job can use. | ||
| if command -v lscpu >/dev/null; then | ||
| cores=$(lscpu -p=Core,Socket | grep -v '^#' | sort -u | wc -l) | ||
| logical=$(lscpu -p=CPU | grep -vc '^#') | ||
| (( cores > 0 )) || cores=1 | ||
| smt=$(( logical / cores )) | ||
| (( smt < 1 )) && smt=1 | ||
| physical=$(( cpus / smt )) | ||
| else | ||
| physical=$cpus | ||
| fi | ||
| (( physical < 1 )) && physical=1 | ||
| test_jobs=$(( physical / 3 )) | ||
| (( test_jobs < 3 )) && test_jobs=3 | ||
| (( test_jobs > 8 )) && test_jobs=8 | ||
| test_threads=$(( physical / 4 )) | ||
| (( test_threads < 2 )) && test_threads=2 | ||
| (( test_threads > 6 )) && test_threads=6 | ||
| else | ||
| test_jobs=3 | ||
| test_threads=3 | ||
| fi | ||
| echo "Workspace tests: DIM_TEST_JOBS=$test_jobs --test-threads=$test_threads" | ||
| DIM_TEST_JOBS="$test_jobs" node scripts/run-rust-test.mjs target/test-artifacts.jsonl --workspace "--test-threads=$test_threads" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Problem: this line is the new 6-thread setting, and the only full verify run at the head commit (job 136319155891) failed in it: cli_flow exited 101 after 666244ms with four terminal wait timeouts. The goal, model reselection and subagent policy tests are the known #1957 transcript-order bug fixed by #1958; the paste rejection test is not covered by #1958 and passed in the 3-thread run cited by #1957. Failure: the required check is red and the new concurrency has no green verify run. Fix: land #1958 first and rerun green; if the paste timeout repeats at 6 threads, keep cli_flow at 3 threads or fix that flow.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partially fixed. The three transcript-order failures are gone: the branch now includes #1958, and goal, repicking and models-picker pass. The required check is still red at the new settings. At 3a1696f job 136671263956 failed on
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 1a81f00 and the required check is green. The workspace step now derives SMT width from lscpu and scales the job's CPU count: the 16 CPU dim-verify runner computed |
||
| cargo test --workspace --doc --locked ${{ needs.changes.outputs.eval == 'true' && '--features xtask/eval-tests' || '' }} | ||
| - name: Verify wall-clock background handoff | ||
| if: needs.changes.outputs.execution == 'true' | ||
|
|
@@ -253,6 +311,8 @@ jobs: | |
| # (docs/architecture/tui-e2e.md); the remaining TUI cases still run | ||
| # under the ordinary selection, so this step names the production | ||
| # and line-mode flows it keeps. | ||
| cli_threads=2 | ||
| if [[ "$RUNNER_OS" == Linux ]]; then cli_threads=4; fi | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl cli_flow \ | ||
| accounts::login_reaches_the_codex_account_of_the_production_daemon \ | ||
| acp::acp_stdio_temporary_mcp_calls_tools_and_settles_the_child_on_eof \ | ||
|
|
@@ -266,7 +326,7 @@ jobs: | |
| project_mcp_entries_start_disabled_and_the_user_enables_them \ | ||
| real_daemon_profile_conflicts_preserve_the_running_daemon_and_endpoint \ | ||
| workflow::workflow_commands_write_and_enable_against_the_real_owner \ | ||
| --ignored --test-threads=2 | ||
| --ignored --test-threads="$cli_threads" | ||
| - name: Verify public Node bindings | ||
| if: needs.changes.outputs.node == 'true' | ||
| shell: bash | ||
|
|
@@ -283,12 +343,14 @@ jobs: | |
| export DIM_TEST_NODE="$(command -v node)" | ||
| export DIM_TEST_JS_RUNTIME="$PWD/runtime/node_modules/@arcships/rutis-runtime" | ||
| export DIM_TEST_RUTIS_SDK="$PWD/runtime/node_modules/@arcships/rutis/src/index.mjs" | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl transport_flow node_ --ignored --test-threads=2 | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl app_server_flow mcp_http_flow::node_ --ignored --test-threads=2 | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl migration_flow node_ --ignored --test-threads=2 | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl hub_flow node_ --ignored --test-threads=2 | ||
| node_threads=2 | ||
| if [[ "$RUNNER_OS" == Linux ]]; then node_threads=4; fi | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl transport_flow node_ --ignored --test-threads="$node_threads" | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl app_server_flow mcp_http_flow::node_ --ignored --test-threads="$node_threads" | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl migration_flow node_ --ignored --test-threads="$node_threads" | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl hub_flow node_ --ignored --test-threads="$node_threads" | ||
| if [[ '${{ needs.changes.outputs.eval }}' == true ]]; then | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl xtask node_ --ignored --test-threads=2 | ||
| node scripts/run-rust-test.mjs target/test-artifacts.jsonl xtask node_ --ignored --test-threads="$node_threads" | ||
| fi | ||
| - name: Verify Python plugins | ||
| if: needs.changes.outputs.node == 'true' && vars.DIM_CI_PYTHON_PLUGINS == 'true' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem: this probe runs under
set -euo pipefail, which is also GitHub's default bash shell, so a present but failinglscpuaborts the step before any fallback.cores=$(lscpu -p=Core,Socket | grep -v '^#' | sort -u | wc -l)returns the pipeline status; whenlscpuexits nonzero or prints only comment lines,grepexits 1 andpipefailfails the assignment. Thelogical=assignment on the next line behaves the same, and the(( cores > 0 )) || cores=1guard is never reached in these cases.Failure scenario: on a runner image with util-linux installed but
/sys/devices/system/cpumasked or unreadable (a container or hardened image), the verify test step exits 1 immediately, prints noWorkspace tests:line, and runs no tests.Evidence: I ran the exact block from ci.yml:260-286 with fake
nprocandlscpubinaries.lscpuexiting 1 with valid rows, exiting 1 with no rows, and printing only headers all exit 1 at thecoresassignment. Withlscpuabsent the fallback runs. The normal 8-core/16-thread case givesDIM_TEST_JOBS=3 --test-threads=2, and head run 44876257722 echoed the same.Fix: guard the probe, for example
if ! cores=$(...); then physical=$cpus; else ... fi(and likewise forlogical), or append|| trueto both assignments and treat a zerocoresorlogicalas the fallback. Acommand -v lscpucheck is not enough because this failure is at runtime.