Skip to content

ci(perf): unlock test parallelism, optimize hot dev crates, cache windows-cli, and record budgets - #1953

Merged
eric8810 merged 9 commits into
mainfrom
eric/1935-ci-throughput-and-budgets
Nov 21, 2026
Merged

eric8810 merged 9 commits into
mainfrom
eric/1935-ci-throughput-and-budgets

Conversation

@eric8810

@eric8810 eric8810 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Unlocks CI test concurrency on Linux runners, optimizes hot third-party crates in dev builds and eliminates byte-by-byte gzip catalog decoding, caches windows-cli builds safely outside checkout cleanup, eliminates retry-backoff stalls in the two slowest Step 9 CLI flows, switches release.yml to a SHA-256-verified prebuilt cargo-about binary, deduplicates Windows setup in code-layout.yml, and records active-gate budgets per ADR 026 D4.

Fixes #1935

Summary of changes

  1. Scale test concurrency with runner CPU capacity (scripts/run-rust-test.mjs, .github/workflows/ci.yml, scripts/development.test.mjs):
    • Added DIM_TEST_JOBS to scripts/run-rust-test.mjs (defaulting to clamp(availableParallelism / 3, 3, 8)) and expanded priority-first longTargets (cli_flow*, transport_flow, app_server_flow, storage_flow, xtask, model_catalog_flow, modality_flow, capabilities_flow, integration_flow).
    • Updated verify in .github/workflows/ci.yml to compute DIM_TEST_JOBS = clamp(nproc / 3, 4, 8) and --test-threads = clamp(nproc / 4, 4, 6) on Linux (with --test-threads=4 for Linux Step 9 and Node-backed suites), while keeping macOS unchanged (3 workers / 3 workspace threads / 2 Step 9 & Node threads).
    • Updated scripts/development.test.mjs to pass DIM_TEST_JOBS=3 explicitly for the 3-slot queue scheduling test and cover DIM_TEST_JOBS overrides and invalid-value rejection.
  2. Optimize hot third-party crates in dev and fix unbuffered gzip catalog reads (Cargo.toml, crates/dim-app-server/src/model_catalog.rs):
    • Added [profile.dev.package] opt-level = 2 for targeted CPU-heavy third-party dependencies (adler2, aho-corasick, crc32fast, fdeflate, flate2, image, image-webp, memchr, miniz_oxide, png, regex, regex-automata, regex-syntax, serde_json, sha2, simd-adler32, zune-jpeg) while keeping workspace crates unoptimized for incremental builds.
    • Updated bundled_record in crates/dim-app-server/src/model_catalog.rs to decompress via GzDecoder::read_to_end and parse with serde_json::from_slice instead of unbuffered byte-by-byte serde_json::from_reader.
    • Measured on Apple Silicon (--test-threads=3): model_catalog_flow (60 tests) dropped from 53.18s → 6.89s (7.7× faster, -87%).
  3. Cache windows-cli builds safely outside actions/checkout cleanup (.github/workflows/ci.yml):
    • Pointed windows-cli CARGO_TARGET_DIR to a per-runner directory outside the Git checkout (<workspace>/../.dim-windows-cli-target, normalized into GITHUB_ENV), resetting it automatically whenever rust-toolchain.toml or CARGO_PROFILE_DEV_DEBUG changes or its size exceeds 6 GiB.
  4. Eliminate retry-backoff stalls in the two slowest Step 9 CLI flows (crates/dimcode/tests/cli_flow.rs, crates/dimcode/tests/cli_flow/hooks.rs):
    • Both hooks::project_hooks_start_disabled_and_the_user_enables_them (~102s) and export_writes_the_timeline_without_starting_a_daemon (~86s) ran dimcode exec against offline.json (127.0.0.1:1), triggering ECONNREFUSED exponential retry backoff in RecoveryState.
    • Replaced offline.json in those two tests with a shared rejecting_model_config loopback HTTP listener returning non-retryable HTTP 400 Bad Request, preserving the exact failed-turn semantics with zero retry sleep.
  5. Workflow efficiency cleanups (.github/workflows/release.yml, .github/workflows/code-layout.yml, .github/actions/setup-windows-code-layout/action.yml, scripts/release.test.mjs):
    • Replaced cargo install cargo-about --version 0.9.3 --features cli --locked in release.yml preflight with the SHA-256-verified prebuilt cargo-about-0.9.3-x86_64-unknown-linux-musl.tar.gz release archive.
    • Extracted the duplicated Windows MSVC/lld-link setup in code-layout.yml into .github/actions/setup-windows-code-layout/action.yml and extended scripts/release.test.mjs (workflow actions use immutable commits) to validate external Action commit SHAs in .github/actions/*/action.yml as well.
  6. Record active-gate budgets (ADR 026 D4) (docs/architecture/build.md, docs/release/README.md):
    • Added the ### Active-gate budgets table and regression/cost-disclosure policy to docs/architecture/build.md, and updated CI/release documentation for concurrency, [profile.dev.package], windows-cli target caching, prebuilt cargo-about and composite Action SHA pinning.

Verification

  • cargo fmt --all -- --check --config error_on_line_overflow=true — passed
  • cargo clippy --locked -p dim-app-server -p dimcode --all-targets -- -D warnings — passed
  • cargo test --locked -p dim-app-server --test model_catalog_flow -- --test-threads=3 — 60/60 passed in 6.89s (down from 53.18s)
  • DIM_TEST_APP_SERVER=... cargo test --locked -p dimcode --test cli_flow -- export_writes_the_timeline_without_starting_a_daemon hooks::project_hooks_start_disabled_and_the_user_enables_them --ignored --test-threads=2 — 2/2 passed in 13.68s combined (down from ~102s + ~86s)
  • node --test scripts/development.test.mjs scripts/tui-tmux.test.mjs scripts/release.test.mjs scripts/ci-changes.test.mjs scripts/adr-check.test.mjs — all passed
  • node scripts/adr-check.mjs --base origin/main — passed

Ablation review

  • Removed libsqlite3-sys from [profile.dev.package]: benchmarking storage_flow before/after showed it is fsync/I/O-bound (98.04s baseline vs no speedup with -O2), so optimizing sqlite3.c added C compile cost without helping test runtime and was removed.
  • Used a single 1-function helper rejecting_model_config in cli_flow.rs (no extra wrapper struct or production test hook) so production retry/model code remains completely untouched.
  • Used a per-runner local CARGO_TARGET_DIR for windows-cli instead of remote actions/cache, avoiding multi-gigabyte WAN upload/download latency and GitHub's 10 GiB repo cache eviction budget while isolating runner slots and bounding disk usage to 6 GiB.

…dows-cli, and record budgets

Improve CI test throughput and record active-gate budgets per ADR 026 D4:

- Add `DIM_TEST_JOBS` to `scripts/run-rust-test.mjs` (defaulting to
  `clamp(availableParallelism / 3, 3, 8)`), expand long-target priority
  scheduling, and scale Linux `verify` concurrency in `.github/workflows/ci.yml`
  (`DIM_TEST_JOBS = clamp(nproc / 3, 4, 8)`, `--test-threads = clamp(nproc / 4, 4, 6)`,
  and `--test-threads=4` for Linux CLI profile and Node-backed suites) while
  keeping macOS at `3`/`3`/`2`.
- Optimize targeted CPU-heavy third-party dependencies (`flate2`, `miniz_oxide`,
  `crc32fast`, `adler2`, `simd-adler32`, `fdeflate`, `serde_json`, `regex`,
  `regex-automata`, `regex-syntax`, `aho-corasick`, `memchr`, `image`, `png`,
  `zune-jpeg`, `image-webp`, `sha2`) at `opt-level = 2` in `[profile.dev.package]`
  and buffer gzip catalog decompression into `serde_json::from_slice` in
  `crates/dim-app-server/src/model_catalog.rs`.
- Reuse a bounded per-runner `CARGO_TARGET_DIR` outside the Git checkout in
  `windows-cli` (`<workspace>/../.dim-windows-cli-target`, reset on
  `rust-toolchain.toml` or `CARGO_PROFILE_DEV_DEBUG` change or > 6 GiB).
- Replace `offline.json` (`127.0.0.1:1`, which slept through transport retry
  backoff) with a local HTTP 400 loopback fixture in
  `hooks::project_hooks_start_disabled_and_the_user_enables_them` and
  `export_writes_the_timeline_without_starting_a_daemon`.
- Switch `release.yml` preflight `cargo-about` 0.9.3 installation from source
  compilation to the SHA-256-verified prebuilt `x86_64-unknown-linux-musl`
  release archive, and deduplicate Windows code-layout toolchain setup into
  `.github/actions/setup-windows-code-layout/action.yml` (covered by the
  immutable commit-SHA test in `scripts/release.test.mjs`).
- Record active-gate wall-clock and resource budgets in
  `docs/architecture/build.md` and update `docs/release/README.md`.

Fixes #1935
@eric8810
eric8810 force-pushed the eric/1935-ci-throughput-and-budgets branch from a8bb7e3 to 7420e87 Compare November 20, 2026 13:33
@eric8810
eric8810 marked this pull request as ready for review November 20, 2026 13:33

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

This PR targets CI wall clock: it scales test workers and threads with runner CPUs, optimizes 17 third-party crates in the dev profile, reads the bundled gzip catalog into a buffer, keeps the windows-cli target directory outside the checkout, replaces the port-1 offline fixture in two CLI flows with a 400 endpoint, downloads a checksummed cargo-about binary, extracts the Windows code-layout setup, and records active-gate budgets.

The code changes are focused and the targeted checks pass. The required verify (linux) check is red at the head commit and the new Linux thread scaling has no green verify run. Four cli_flow TUI tests hit the 300 second terminal wait guard. The goal, model reselection and subagent policy waits are the known transcript-order bug tracked by #1957 and fixed by open #1958. The paste rejection test passed in the 3-thread run cited by #1957 and is not covered by #1958.

Findings

P1: verify (linux) is red at the head commit

Problem: verify (linux) job 136319155891 at 7420e87 failed in "Run compiled workspace tests" after 11m07s. The cli_flow target exited 101 after 666244ms with 696 passed, 4 failed and 30 ignored. The failing tests are goal::tui_goal_shows_the_state_and_marks_the_status_area, interactive_paste_encoding_rejection_keeps_confirmed_items_editable, repicking_the_current_model_keeps_the_effort and tui_models_picker_edits_only_the_subagent_model_policy. All four panic in Terminal::wait_for (crates/dimcode/tests/cli_flow.rs:3942) after the 300 second HANG_GUARD (crates/dimcode/tests/cli_flow.rs:198).

The goal, model reselection and subagent policy waits are the transcript-order bug in #1957: each waits for text the harness already consumed. #1958 reorders exactly those waits in cli_flow/goal.rs and cli_flow.rs. The same three tests failed at --test-threads=3 in job 136278729067, the log linked from #1957, so this PR does not introduce them. The paste test is different: its transcript ends after two "Saving text attachment..." lines with no rejection, and it passed in that 3-thread run. The head commit is the only run with the new Linux settings (DIM_TEST_JOBS from nproc and --test-threads=6 at .github/workflows/ci.yml:249). The earlier branch head a8bb7e3 still used --test-threads=3 and its verify job was skipped (run 44712487931), so the new concurrency has no green verify run.

Failure scenario: ci-ok fails, the PR cannot merge, and reruns repeat the three known timeouts until #1958 lands. If the paste timeout repeats at 6 threads, the headline parallelism change is not safe as written.

Evidence: verify (linux) job 136319155891 (workflow run 44745306871), cli_flow exit=101 at 666244ms with the four failures; crates/dimcode/tests/cli_flow.rs:189-198 and :3942; job 136278729067; #1957 and #1958; .github/workflows/ci.yml:249.

Fix: land #1958 first and rebase, or include its test-order hunks, then rerun verify to green at the new settings. If the paste flow still times out at 6 threads, keep cli_flow at 3 threads or fix the paste save and rejection wait before scaling it. Do not merge with a red required check.

P2: the verify (linux) p90 budget is not supported by a measurement

Problem: docs/architecture/build.md:337 records a 15 minute steady-state p90 for the full verify (linux) gate.

Failure scenario: the completed full runs on the same dim-verify pool are 18m17s (44724315336), 21m18s (44722644428), 23m42s (44719273152), 21m29s (44718768375), 30m49s (44717853591) and 25m38s (44716244403). The head run spent 4m09s on build and lint, failed the workspace test step after 11m07s, skipped the later CLI, stamped and Node steps, and ended at 15m57s. The 15 minute value is also the per-executable test timeout used by this workflow (DIM_TEST_TIMEOUT_MS: "900000" at .github/workflows/ci.yml:233), not a measured gate p90. Under the policy at build.md:339, approaching or exceeding the budget is a regression; the table gives no green run at the new settings that supports the number.

Evidence: docs/architecture/build.md:337 and :339; the run ids above; verify (linux) job 136319155891; .github/workflows/ci.yml:233.

Fix: record the measured p90 with the run ids or the tracking issue, or mark 15 minutes as a target and keep the measured value in the table. Do not raise the 75 minute timeout.

P3: longTargets names six targets that do not exist on main

Problem: scripts/run-rust-test.mjs:20-33 lists cli_tui_flow, cli_daemon_flow, cli_session_flow, app_server_flow, capabilities_flow and integration_flow. None is a test target on main; no file under crates/*/tests or tests/ has those names. Open PR #1951 creates all six. docs/architecture/build.md:322 also names app_server_flow, capabilities_flow and integration_flow as prioritized suites.

Failure scenario: until #1951 lands the entries never match and the documentation describes suites that do not exist. If #1951 stalls, the stale names and the priority claim remain.

Evidence: scripts/run-rust-test.mjs:20-33; docs/architecture/build.md:322; the workspace test target list; PR #1951 adds crates/dimcode/tests/cli_tui_flow.rs, cli_daemon_flow.rs, cli_session_flow.rs, crates/dim-app-server/tests/app_server_flow.rs, crates/dim-agent-capabilities/tests/capabilities_flow.rs and tests/integration/tests/integration_flow.rs.

Fix: land #1951 first and rebase the list on its target names, or keep only current names and reword the doc. A test that every longTargets name exists in the workspace would prevent drift.

P3: the new DIM_TEST_JOBS override test does not prove the override

Problem: scripts/development.test.mjs:76-82 runs the workspace script with DIM_TEST_JOBS=4 and --eval '', so each child exits immediately. The START order is the same with three workers, and the case passes on origin/main's script; only the DIM_TEST_JOBS=0 assertion at line 88 fails there.

Failure scenario: a regression that ignores DIM_TEST_JOBS and always uses the default worker count passes this case, so the main new behavior is untested.

Evidence: scripts/development.test.mjs:76-82; running the new test against origin/main's scripts/run-rust-test.mjs fails only at line 87.

Fix: use the existing barrier fixture with a fourth target and assert that all four started files exist before any child exits, or assert that four children are alive at once.

P3: the active-gate table omits code-layout and will be stale with #1952

Problem: the table is introduced as the synchronous pull-request active gates, but .github/workflows/code-layout.yml is also a path-filtered PR gate with 10, 30 and 240 minute timeouts and is absent. If #1952 lands first, its new scripts job and scheduled sweep also need a row and a new verify measurement.

Failure scenario: a maintainer uses the table to judge gate cost and misses a gate, so the D4 property that every synchronous gate has a recorded budget is not met.

Evidence: docs/architecture/build.md:326-337; .github/workflows/code-layout.yml:5-11, 25, 57 and 117; PR #1952 adds the scripts job and schedule to .github/workflows/ci.yml.

Fix: add rows for code-layout and the future scripts gate, or scope the preamble to the ci.yml jobs the table covers.

Optional: the windows-cli warm path walks the whole target directory

Problem: .github/workflows/ci.yml:106 measures the cache with Get-ChildItem -Recurse on every warm run. At the 6 GiB bound this is a fixed scan before cargo starts.

Failure scenario: on a slow Windows runner the scan can consume a noticeable part of the one minute warm budget, and the budget table does not account for it.

Evidence: .github/workflows/ci.yml:106-110.

Fix: store the measured size in the stamp file and rescan only when the stamp changes or on a schedule, or state the scan cost as part of the warm budget.

Cross-PR

git merge-tree reports conflicts with #1949 (.github/workflows/ci.yml), #1951 (.github/workflows/ci.yml, crates/dimcode/tests/cli_flow.rs, docs/architecture/build.md, scripts/run-rust-test.mjs) and #1952 (.github/workflows/ci.yml). #1958 merges cleanly but must land first, because it fixes the three transcript-order tests that fail verify here. #1951 creates the six target names above and moves the export and hooks tests to new binaries, so the rejecting_model_config helper and its two call sites must move with them on rebase. #1952 adds a scripts gate and a scheduled sweep, so the budget table needs a row and the verify row needs a new measurement. #1907, #1910 and #1913 do not touch these files.

Verification

Run in the review worktree with isolated HOME, TMPDIR, XDG paths and CARGO_TARGET_DIR:

  • node --test scripts/development.test.mjs: 8 passed.
  • node --test scripts/release.test.mjs: 42 passed.
  • node --test scripts/tui-tmux.test.mjs: 6 passed.
  • node --test scripts/ci-changes.test.mjs scripts/adr-check.test.mjs: 17 passed.
  • cargo fmt --all -- --check --config error_on_line_overflow=true: passed.
  • node scripts/adr-check.mjs --base origin/main: passed.
  • cargo check -p dim-app-server --lib --locked and cargo check -p dimcode --tests --locked: passed with no warnings.
  • cargo test -p dim-app-server --test model_catalog_flow --locked -- --test-threads=3: 60 passed in 7.86s, matching the PR's 6.89s claim.
  • A local probe confirmed cargo test inherits the [profile.dev.package] opt-level 2 override and keeps debug assertions on.

The cargo-about asset cargo-about-0.9.3-x86_64-unknown-linux-musl.tar.gz exists, its SHA-256 is 3ad1e94ea1e63d69d1961f4fb15ccbbe9575d906111f96d2cb4dce6df48f71b4 as recorded, and the archive contains cargo-about-0.9.3-x86_64-unknown-linux-musl/cargo-about. I did not execute the Linux binary on macOS.

CI at head 7420e87: changes, macos-native, web, windows-cli and dependencies succeeded; acp-registry was skipped; verify (linux) failed and ci-ok failed. The separate Native code layout workflow (run 44745307047) succeeded. The verify failure is the P1 above: cli_flow exit 101, 696 passed, 4 failed, 30 ignored in 666.22s. The three transcript-order failures also occur at 3 threads (#1957), and the paste timeout was not reproduced locally.

I did not run the TUI flows locally; they need a pty and the built CLI. The targeted suite I ran was model_catalog_flow.

Not verified: the cause of the paste timeout at 6 threads; the other budget rows were not measured in this review; the cargo-about Linux binary was not executed on macOS.

Comment thread .github/workflows/ci.yml
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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 startup::a_first_prompt_is_submitted_once_and_the_interface_stays: the fake daemon's Wire::hold replies after the CLI closed and panics (cli_flow.rs:350-372 and :496-519). The run used 5 jobs and 4 threads on a 16 CPU runner, not 6 threads. The head run 44849116801 is still in progress. Still open until verify is green at these settings or cli_flow stays at 3 threads.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 Workspace tests: DIM_TEST_JOBS=3 --test-threads=2 (previously 5 by 4), a dedicated 16-core host keeps 5 by 4, and macOS stays at 3 by 3. Head run 44876257722 passed verify (linux) in 18m43s (job 136761584454): the workspace step passed in 6m29s including cli_flow and integration_flow/prompt_lifecycle, the CLI profile step passed including hooks::project_hooks_start_disabled_and_the_user_enables_them, the Node bindings passed, and ci-ok job 136766073868 passed. For comparison, the four verify attempts at 923aa33 all failed (jobs 136676107409, 136687140864, 136702807647 and 136706510187) with the prompt_lifecycle timeout, several unrelated flow failures, and the hooks assertion. This thread can be resolved.

Comment thread docs/architecture/build.md Outdated
| `web` (stage + test + lint + build) | L1 / L2 | Self-hosted Windows x64 | ≤ 5 min | 15 min | Isolated npm workspace check |
| `windows-cli` (`dim-cli --lib`) | L3 | Self-hosted Windows x64 | ≤ 1 min warm (≤ 4 min cold) | 15 min | Per-runner target dir capped at 6 GiB |
| `macos-native` (macOS Rust + packaging) | L3 | Self-hosted macOS ARM64 | ≤ 6 min | 30 min | `CARGO_BUILD_JOBS=4`, checkout `target/` |
| `verify (linux)` (build + clippy + tests) | L1 / L2 / L3 | Self-hosted Linux x64 (`dim-verify`) | ≤ 15 min | 75 min | `CARGO_BUILD_JOBS=8`, `CARGO_PROFILE_DEV_DEBUG=0`, CPU-scaled `DIM_TEST_JOBS` / `--test-threads`, 15 min target cap |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: the recorded 15 minute p90 is not supported by a measurement at the new settings. Completed runs on the same dim-verify pool are 18m17s (44724315336), 21m18s (44722644428), 23m42s (44719273152), 21m29s (44718768375), 30m49s (44717853591) and 25m38s (44716244403). The head run spent 4m09s on build and lint, failed after 11m07s in the workspace test step, skipped the later steps and ended at 15m57s. The 15 minute value also equals the per-executable test timeout at .github/workflows/ci.yml:233. Failure: under the policy on line 339, normal runs look like regressions, or the budget is ignored. Fix: record the measured p90 with run ids or mark 15 minutes as a target and keep the measured value.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 923aa33. The six ids resolve to the recorded green verify jobs and 15 minutes is marked a target, not a p90.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A first measurement now exists at these settings: run 44876257722 (1a81f00) passed verify (linux) in 18m43s, above the 15 minute target at docs/architecture/build.md:337 but inside the 18m17s to 30m49s range of the six pre-change runs. The row says the steady state is not yet measured at these settings, so record this run and decide whether the target or the pipeline changes under the policy at build.md:342.

Comment thread scripts/run-rust-test.mjs
'cli_daemon_flow',
'cli_session_flow',
'transport_flow',
'app_server_flow',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: cli_tui_flow, cli_daemon_flow, cli_session_flow, app_server_flow, capabilities_flow and integration_flow are not test targets on main; open PR #1951 creates all six. Until it lands these entries never match, and docs/architecture/build.md:322 describes suites that do not exist. Failure: the priority list silently no-ops for those names and the documentation is false. Fix: land #1951 first and rebase on its target names, or keep only current names here and reword the doc. A test that every longTargets name exists in the workspace would catch drift.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still open. #1951 is still open, and scripts/run-rust-test.mjs:20-33 still names six targets that do not exist on main; build.md:322 names three of them as prioritized suites. Keep #1951 ahead of this PR or list only current targets.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still open, with different names after the main merge. #1951 landed, so cli_tui_flow, cli_daemon_flow, cli_session_flow, app_server_flow, capabilities_flow and integration_flow now exist. origin/main's 76059f7 then consolidated test binaries: storage_flow and model_catalog_flow are modules of app_server_flow (crates/dim-app-server/tests/app_server_flow.rs:16 and :31), and modality_flow is a module of modality_suite (crates/dim-modality/tests/modality_suite.rs:3). cargo metadata at 1a81f00 lists no test target named storage_flow, model_catalog_flow or modality_flow, so scripts/run-rust-test.mjs:27, :29 and :30 still never match and docs/architecture/build.md:322 still names them; modality_suite, which now owns the modality flow, is not in the list. Fix: remove storage_flow and model_catalog_flow (app_server_flow is already listed), replace modality_flow with modality_suite, and add an assertion or derive the list from the artifact records so the next consolidation is caught.

Comment thread scripts/development.test.mjs Outdated
timeout: 10_000,
});
assert.equal(parallel.status, 0, parallel.stderr);
assert.deepEqual(Array.from(parallel.stderr.matchAll(/^\[test\] START (\S+)/gm), match => match[1]), [...initial, 'queued']);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: with --eval '' every child exits immediately, so the START order is the same with three or four workers; this case passes on origin/main's script, where only the DIM_TEST_JOBS=0 assertion fails. Failure: a regression that ignores DIM_TEST_JOBS and always uses three workers passes this test. Fix: use the barrier fixture with a fourth target and assert all four started files exist before any child exits, or assert that four children are alive at once.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 923aa33. The new barrier case fails against origin/main's script at the DIM_TEST_JOBS=4 assertion (exit 9) and passes here, and the invalid value case is covered.

Run four targets behind a barrier so a worker count that ignores
DIM_TEST_JOBS fails, record the measured verify (linux) runs and mark the
fifteen-minute figure as a target, and add the code-layout gate row.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Merged main (includes #1958, so the three transcript-order TUI failures are fixed) and addressed the review:

node --test scripts/development.test.mjs passes 8/8. CI is running; the 6-thread verify (linux) result will follow. Re-review requested.

@eric8810
eric8810 requested a review from yyhhyyyyyy November 21, 2026 00:43
Probe bubblewrap with a user namespace and a private /proc so a host that
only supports a plain read-only bind fails at the check instead of inside
the confined suites.

@yyhhyyyyyy yyhhyyyyyy left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

This PR targets CI wall clock: it scales test workers and threads with runner CPUs, optimizes 17 third-party crates in the dev profile, reads the bundled gzip catalog into a buffer, keeps the windows-cli target directory outside the checkout with a 6 GiB cap, replaces the port-1 offline fixture in two CLI flows with a loopback 400 endpoint, downloads a checksummed cargo-about binary, extracts the Windows code-layout setup into a composite action, replaces the bwrap probe with one that matches the confined sandbox, and records active-gate budgets.

Round 1 is mostly addressed. The branch merged #1958, so the goal, model reselection and subagent policy waits are fixed, and the paste rejection test passed at the next head. The six recorded verify runs match their ids and durations, 15 minutes is now marked a target, the DIM_TEST_JOBS test fails against origin/main's script, and the new sandbox probe is correct for the failure it targets and passed on the runner at the head run.

The required check is not green at the new settings. All three completed verify (linux) runs at 5 jobs and 4 threads are red with different failures: four TUI wait timeouts at 7420e87, a Wire::hold fixture race at 3a1696f, and a 15 minute timeout on prompt_lifecycle at the head 923aa33. The six runs at 3 jobs and 3 threads recorded in build.md were green. The new code-layout budget row also misstates the native-layout trigger and records no budget.

Findings

P1: verify (linux) is still red at the new settings

Problem: all three completed verify (linux) runs at 5 jobs and 4 threads are red. At 3a1696f (job 136671263956, run 44845805987) the workspace step failed after 188s: cli_flow exited 101 with 699 passed, 1 failed and 30 ignored. The failure is startup::a_first_prompt_is_submitted_once_and_the_interface_stays: the fake daemon's Wire::hold reads a request, empty_state builds a reply, and the CLI has already closed after /exit, so Wire::send calls Wire::closed and panics (crates/dimcode/tests/cli_flow.rs:350-372 and :496-519). The test then unwraps the daemon join at crates/dimcode/tests/cli_flow/startup.rs:1736.

At the head 923aa33 (job 136676107409, run 44849116801) the workspace step ran 16m34s and failed when prompt_lifecycle (tests/integration) hit the 15 minute per-target cap after 900029ms (exit 124, SIGKILL). The hung test is prepared_model_call_keeps_its_configuration_while_later_turn_uses_refresh (tests/integration/tests/prompt_lifecycle.rs:534), which had been running for over 60s at 01:23:24; every other target ended by 01:24:04. The same test passed at 3a1696f at the same settings (the whole binary took 3129ms), so the hang is intermittent.

All three runs used DIM_TEST_JOBS=5 and --test-threads=4 on the 16 CPU runner (ci.yml:237-250), not the 6 threads the PR text assumes; the 8 job and 6 thread ceiling needs a runner with at least 24 CPUs.

The three #1957 transcript-order tests now pass, and cli_flow passed at the head in 173s with the paste rejection test green. #1958 is merged into the branch and reorders exactly the goal, repicking and models-picker waits (crates/dimcode/tests/cli_flow/goal.rs:485-486; crates/dimcode/tests/cli_flow.rs:5942-5943 and :12174). The remaining blocker is the integration hang at the head, plus the intermittent Wire::hold race seen at 3a1696f.

Failure scenario: ci-ok is red and the PR cannot merge. All three completed runs at 5 jobs and 4 threads are red with different load-sensitive failures (7420e87: four TUI wait timeouts; 3a1696f: the startup fixture race; 923aa33: the prompt_lifecycle hang), while the six recorded runs at 3 jobs and 3 threads were green. Reruns are a lottery, the 15 minute target cannot be measured until a run completes green, and the later CLI, Node and script steps have been skipped in every run at the new settings.

Evidence: jobs 136319155891 (run 44745306871), 136671263956 (run 44845805987) and 136676107409 (run 44849116801); crates/dimcode/tests/cli_flow.rs:189, :198, :350-372, :3942 and :496-519; crates/dimcode/tests/cli_flow/startup.rs:1736; tests/integration/tests/prompt_lifecycle.rs:534; .github/workflows/ci.yml:234 and :237-250.

Fix: diagnose the prompt_lifecycle hang and the Wire::hold race, or keep the workspace suite at 3 jobs and 3 threads (the values with six green runs) until the load-sensitive failures are fixed; the CLI and Node suites can still take their own thread counts. Do not merge with a red required check.

P3: the code-layout budget row misstates the gate

Problem: the new row lists "10 / 30 / 240 min per job" and says "native-layout runs on layout changes". native-layout is guarded by github.event_name == 'workflow_dispatch' (.github/workflows/code-layout.yml:93-94), so it never runs on a layout path change. The PR-triggered jobs are linux-artifact (10 min) and platform-artifact (30 min). The row also has no steady-state budget under a preamble that says synchronous gates operate under recorded budgets.

Failure scenario: a maintainer judging the cost of a layout-path PR reads a 240 minute synchronous job and a gate with no recorded p90, so the D4 budget claim in the table is not met and the cost picture is wrong. The note also contradicts docs/release/README.md:150-156, which says the five-target measurement runs on manual dispatch.

Evidence: docs/architecture/build.md:328 and :338; .github/workflows/code-layout.yml:24-25, :56-57, :93-94 and :116-117; docs/release/README.md:150.

Fix: scope the row to linux-artifact and platform-artifact with their 10 and 30 minute timeouts and a recorded p90 or a tracking issue, and describe native-layout as dispatch-only Retained.

P3: longTargets still names six targets that only #1951 creates

Problem: scripts/run-rust-test.mjs:20-33 still lists cli_tui_flow, cli_daemon_flow, cli_session_flow, app_server_flow, capabilities_flow and integration_flow. None is a test target on main or at this head, and #1951 is still open. docs/architecture/build.md:322 names app_server_flow, capabilities_flow and integration_flow as prioritized suites.

Failure scenario: if this PR merges before #1951, the priority list silently ignores six names and the doc describes suites that do not exist.

Evidence: scripts/run-rust-test.mjs:20-33; docs/architecture/build.md:322; PR #1951 remains open and conflicts with this PR in scripts/run-rust-test.mjs and docs/architecture/build.md.

Fix: keep #1951 ahead of this PR, or list only current targets and reword build.md. A test that every longTargets name exists in the workspace test-artifacts list would catch drift.

Cross-PR

merge-tree is clean against origin/main. It conflicts with #1949 (.github/workflows/ci.yml), #1951 (.github/workflows/ci.yml, crates/dimcode/tests/cli_flow.rs, docs/architecture/build.md, scripts/run-rust-test.mjs) and #1952 (.github/workflows/ci.yml; build.md and docs/release/README.md auto-merge). #1950 merges cleanly.

The #1949 and #1952 verify failures were not bubblewrap failures. #1949 run 44845424404 job 136669193122 passed the old bwrap probe and failed on staged_update::tui_update::update_now_cancels_cleanly_on_sigint_while_stopping_daemon (cli_flow.rs:3942, 708 passed, 1 failed). #1952 run 44746166383 job 136322490185 passed the probe and failed on the three tests #1958 now fixes. Both branches include #1958, so rebasing onto this PR's probe would pass it; the probe does not change their outcomes. #1951 changes cli_flow.rs and creates the six new targets, so the two branches need a rebase; the export and hooks tests and rejecting_model_config stay in the cli_flow binary on both sides.

Verification

Run in the review worktree with isolated HOME, TMPDIR, XDG paths and CARGO_TARGET_DIR:

  • node --test scripts/development.test.mjs: 8 passed.
  • The new barrier case against origin/main's scripts/run-rust-test.mjs fails at the DIM_TEST_JOBS=4 assertion with exit 9, so it now proves the override.
  • node --test scripts/release.test.mjs: 42 passed.
  • node --test scripts/ci-changes.test.mjs scripts/adr-check.test.mjs: 17 passed.
  • cargo fmt --all -- --check --config error_on_line_overflow=true: passed.
  • node scripts/adr-check.mjs --base origin/main: passed.
  • The six recorded run ids resolve to green verify (linux) jobs of 18m17s, 21m18s, 23m42s, 21m29s, 30m49s and 25m38s, matching build.md:340.
  • The head run 44849116801 passed changes, dependencies, windows-cli (33s warm), web, macos-native and the sandbox probe; acp-registry was skipped. verify (linux) failed in the workspace step (prompt_lifecycle exit 124 after 900029ms) and ci-ok failed; the later CLI, Node and script steps were skipped. At the previous head 3a1696f windows-cli took 3m26s, inside the recorded cold budget.

Not verified: the cause of the interactive paste timeout at 7420e87, which did not reproduce at 3a1696f; the cause of the prompt_lifecycle hang at the head; the ignored CLI profile and Node-backed suites have not run at four threads because the workspace step failed first in all three completed runs; I did not run the TUI flows locally.

Previous findings

  • P1 verify red: partially fixed. #1958 removes the three transcript-order failures, but all three completed runs at the new settings are red on different load-sensitive failures, including the prompt_lifecycle hang at the head. Still open.
  • P2 15 minute p90: fixed. The value is a target, the six measured runs and ids are recorded, and I verified each duration.
  • P3 longTargets: still open until #1951 lands.
  • P3 DIM_TEST_JOBS test: fixed. The test fails on origin/main's script and passes here.
  • P3 active-gate table: the code-layout row was added, but it has the trigger and budget errors above. #1952 will also need a row for its scripts job if it lands first.
  • Optional windows-cli scan: withdrawn. The warm run took 33s including the scan, so the scan is not a real cost at the 6 GiB bound.

| `windows-cli` (`dim-cli --lib`) | L3 | Self-hosted Windows x64 | ≤ 1 min warm (≤ 4 min cold) | 15 min | Per-runner target dir capped at 6 GiB |
| `macos-native` (macOS Rust + packaging) | L3 | Self-hosted macOS ARM64 | ≤ 6 min | 30 min | `CARGO_BUILD_JOBS=4`, checkout `target/` |
| `verify (linux)` (build + clippy + tests) | L1 / L2 / L3 | Self-hosted Linux x64 (`dim-verify`) | ≤ 15 min target (steady state not yet measured at these settings) | 75 min | `CARGO_BUILD_JOBS=8`, `CARGO_PROFILE_DEV_DEBUG=0`, CPU-scaled `DIM_TEST_JOBS` / `--test-threads`, 15 min target cap |
| `code-layout` (native layout matrix) | L3 | Hosted Linux, macOS, Windows | Not yet recorded | 10 / 30 / 240 min per job | Hosted runners; `native-layout` runs on layout changes |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: this row lists native-layout as part of the synchronous gate and says it runs on layout changes, but native-layout is guarded by github.event_name == 'workflow_dispatch' (code-layout.yml:95). The PR-triggered jobs are linux-artifact (10 min) and platform-artifact (30 min); the 240 minute measurement never runs on a layout-path PR. The row also has no steady-state budget while the preamble says these gates operate under recorded budgets.

Failure scenario: a maintainer judging a layout-path PR reads a 240 minute synchronous job and a gate with no p90, so the D4 claim in the table is not met and the cost picture is wrong.

Evidence: docs/architecture/build.md:328 and :338; .github/workflows/code-layout.yml:24-25, :56-57, :95 and :116-117; docs/release/README.md:150.

Fix: scope the row to linux-artifact and platform-artifact with their 10 and 30 minute timeouts and a recorded p90 or a tracking issue, and describe native-layout as dispatch-only Retained.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unchanged at 1a81f00. docs/architecture/build.md:338 still says native-layout runs on layout changes and records no p90, but .github/workflows/code-layout.yml:94 gates native-layout on github.event_name == 'workflow_dispatch'. A layout-path pull request runs only linux-artifact (10 min, code-layout.yml:25) and platform-artifact (30 min, :57), and docs/release/README.md:151 and :156 already describe the five-target measurement as manual dispatch. Scope the row to the two PR jobs with their budgets, or mark native-layout as dispatch-only Retained.

…ut-and-budgets

# Conflicts:
#	.github/workflows/ci.yml
#	crates/dimcode/tests/cli_flow.rs
#	docs/architecture/build.md
#	scripts/run-rust-test.mjs
…ut-and-budgets

# Conflicts:
#	.github/workflows/ci.yml
@eric8810
eric8810 requested a review from yyhhyyyyyy November 21, 2026 06:03
@eric8810

Copy link
Copy Markdown
Collaborator Author

Merged main (includes #1949 and #1950) and resolved the overlapping edits:

Verified locally: cargo fmt --all -- --check, cargo check -p dimcode --tests, cargo run -p xtask -- check, node --test scripts/development.test.mjs and scripts/release.test.mjs. CI is running at this head; re-review requested.

The Linux verify step derived DIM_TEST_JOBS and --test-threads from nproc.
arcships-runner-1/2 report 16 CPUs on 8 physical cores shared by two runner
instances, so five workers by four threads oversubscribed the host and
timing-sensitive tests failed. Derive threads per core from lscpu and divide
the job's CPU count instead: a shared 8-core host runs three workers by two
threads, and a dedicated 16-core host keeps five by four.
@eric8810

Copy link
Copy Markdown
Collaborator Author

The first run at 6 threads was red on arcships-runner-2, which reports 16 CPUs on 8 physical cores shared by two runner instances: transport_flow (2), dim_app_server (1), cli_flow's update test (1) and app_server_flow (3) all failed timing assertions at five workers × four threads. That is host oversubscription, not a test regression.

Fixed by deriving the usable physical cores from lscpu (threads per core from the host's CPU/core counts, divided into the job's nproc) instead of scaling with SMT siblings:

  • shared 8-core host: DIM_TEST_JOBS=3, --test-threads=2 (6 concurrent tests);
  • dedicated 16-core host: DIM_TEST_JOBS=5, --test-threads=4 (20 concurrent tests).

docs/architecture/build.md states the formula. The old runners keep the measured speedup; the shared Mint hosts no longer get more workers than the cores they own. CI is running at the new head.

@eric8810

Copy link
Copy Markdown
Collaborator Author

verify (linux) is green at 1a81f00e5a on arcships-runner-1 (16 CPUs / 8 shared physical cores) in 18m43s: run 44876257722. It ran DIM_TEST_JOBS=3 and --test-threads=2; the 6-thread attempt on the same shared host failed seven timing-sensitive tests across four targets.

The green shared-host run is slower than the 15-minute target, which is the cost of not oversubscribing cores it shares with another runner. A dedicated 16-core host takes the 5×4 branch. If you would rather keep three test threads on shared hosts, say so and I will set the thread floor to 3 and re-measure.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

This PR targets CI wall clock and stability: it scales test workers and threads with usable cores, optimizes 17 third-party crates in the dev profile, reads the bundled gzip catalog into a buffer, keeps the windows-cli target directory outside the checkout with a 6 GiB cap, replaces the port-1 offline fixture in two CLI flows with a loopback 400 endpoint, downloads a checksummed cargo-about binary, extracts the Windows code-layout setup into a composite action, replaces the bwrap probe with one that matches the confined sandbox, and records active-gate budgets.

Verdict: APPROVE. The round 2 P1 is resolved. The new commit 1a81f00 derives SMT width from lscpu and scales the job's CPU count, and the head run is green end to end, including verify (linux) and ci-ok. The remaining findings are P3 and optional: an lscpu failure path that aborts the step, three stale long-flow target names after main consolidated its test binaries, and the unchanged code-layout budget row.

Findings

P3: a present but failing lscpu aborts the verify test step (.github/workflows/ci.yml:266-267)

Problem: the probe runs under set -euo pipefail, which is also GitHub's default bash shell, so a present but failing lscpu aborts the step before any fallback. cores=$(lscpu -p=Core,Socket | grep -v '^#' | sort -u | wc -l) returns the pipeline status; when lscpu exits nonzero or prints only comment lines, grep exits 1 and pipefail fails the assignment. The logical= assignment on the next line behaves the same. The (( cores > 0 )) || cores=1 guard is never reached in these cases.

Failure scenario: on a runner image with util-linux installed but /sys/devices/system/cpu masked or unreadable (a container or hardened image), the verify test step exits 1 immediately, prints no Workspace tests: line, and runs no tests.

Evidence: I ran the exact block from .github/workflows/ci.yml:260-286 with fake nproc and lscpu binaries. lscpu exiting 1 with valid rows, exiting 1 with no rows, and printing only headers all exit 1 at the cores assignment. With lscpu absent the fallback runs. The normal 8-core/16-thread case gives DIM_TEST_JOBS=3 --test-threads=2, and the head run echoed the same.

Fix: guard the probe, for example if ! cores=$(...); then physical=$cpus; else ... fi (and likewise for logical), or append || true to both assignments and treat a zero cores or logical as the fallback. A command -v lscpu check is not enough because this failure is at runtime.

P3: three long-flow target names are stale after main's test consolidation (scripts/run-rust-test.mjs:27-30, docs/architecture/build.md:322)

Problem: storage_flow, model_catalog_flow and modality_flow are no longer test targets. origin/main's 76059f7 made them modules of larger binaries: storage_flow and model_catalog_flow are modules of app_server_flow (crates/dim-app-server/tests/app_server_flow.rs:16 and :31), and modality_flow is a module of modality_suite (crates/dim-modality/tests/modality_suite.rs:3). #1951 has landed, so the other six names in the list now exist.

Failure scenario: the priority list silently never matches those three entries, so the modality suite, which now owns the modality flow and is not listed under its real name, is not prioritized; the documentation names suites that do not exist, and the next consolidation will drift the same way unnoticed. The head workspace log has no [test] START storage_flow, model_catalog_flow or modality_flow, and modality_suite started after the long targets.

Evidence: cargo metadata --locked --no-deps at 1a81f00 lists test targets cli_flow, cli_tui_flow, cli_daemon_flow, cli_session_flow, transport_flow, app_server_flow, xtask, capabilities_flow, integration_flow and modality_suite, but none of the three stale names; .github/workflows/ci.yml job 136761584454 workspace log.

Fix: remove storage_flow and model_catalog_flow (app_server_flow is already listed), replace modality_flow with modality_suite, and add an assertion that every long target exists in the artifact records, or derive the list from those records.

P3: the code-layout budget row still misstates the native-layout trigger (docs/architecture/build.md:338)

Problem: the row says native-layout runs on layout changes and records no p90, but .github/workflows/code-layout.yml:94 gates native-layout on github.event_name == 'workflow_dispatch'. A layout-path pull request runs only linux-artifact (10 min, code-layout.yml:25) and platform-artifact (30 min, code-layout.yml:57). docs/release/README.md:151 and :156 already describe the five-target measurement as manual dispatch.

Failure scenario: a maintainer judging the cost of a layout-path PR reads a 240 minute synchronous job and a gate without a recorded budget, so the D4 budget claim in the table is not met and the cost picture is wrong.

Fix: scope the row to linux-artifact and platform-artifact with their timeouts and a recorded p90 or a tracking issue, and describe native-layout as dispatch-only Retained.

Notes on the new concurrency formula

The numeric claims in docs/architecture/build.md:322 match the workflow: workspace jobs are clamp(physical / 3, 3, 8), workspace threads are clamp(physical / 4, 2, 6), the CLI and Node-backed suites use 4 threads on Linux and 2 on macOS, and scripts/run-rust-test.mjs:13 still defaults to clamp(availableParallelism / 3, 3, 8). The head runner echoed DIM_TEST_JOBS=3 --test-threads=2.

Two imprecisions, neither a failure: the comment at ci.yml:263-264 and the doc phrase "usable physical cores" describe a per-job share, but when nproc is not affinity-limited the code computes the host's physical core count (on the shared 8-core host, physical=8 while each of two instances has about half). The resulting 3 workers by 2 threads gives 12 test threads across two instances on 16 hardware threads, so the outcome is conservative. The worst case physical=1 gives 3 workers by 2 threads, and a runner without lscpu falls back to the old 5 by 4 on a 16 CPU host; neither applies to the current dim-verify pool.

The first green run at these settings took 18m43s, above the 15 minute target recorded at build.md:337. The row already says the steady state is not yet measured at these settings; record this run and decide whether the target or the pipeline changes under the policy at build.md:342.

Previous findings

  • P1 verify red: fixed. At the prior head 3a1696f job 136671263956 failed on startup::a_first_prompt_is_submitted_once_and_the_interface_stays; at 923aa33 all four verify attempts failed (jobs 136676107409, 136687140864, 136702807647 and 136706510187) with the prompt_lifecycle timeout (exit 124 after 900029ms), several unrelated flow failures, and the hooks assertion. At 1a81f00 run 44876257722 job 136761584454 passed verify (linux) in 18m43s, the workspace step passed in 6m29s at 3 by 2, the CLI profile step passed including the hooks test, and ci-ok job 136766073868 passed.
  • P2 15 minute p90: remains fixed in wording, but the first green run at these settings is 18m43s; see the note above.
  • P3 longTargets: still open, with different names after the main merge.
  • P3 barrier test: fixed earlier; node --test scripts/*.test.mjs passes at this head.
  • P3 active-gate table: the code-layout row is unchanged and still inaccurate.

Cross-PR

merge-tree is clean against origin/main (26ab50e is an ancestor of HEAD). Of the open PRs sharing files, #1952 (.github/workflows/ci.yml, docs/architecture/build.md, docs/release/README.md) merges cleanly; #1900 conflicts only in crates/dim-app-server/tests/mcp_session_flow.rs, which this PR does not touch; #1963 and #1881 conflict in crates/dimcode/tests/cli_flow.rs because their bases predate main's cli_flow split, not because of duplicated work; #1306 conflicts in Cargo.toml, Cargo.lock and the generated architecture files from an old base. No duplication of this PR's changes was found.

Verification

Run in the review worktree with isolated HOME, TMPDIR, XDG paths and CARGO_TARGET_DIR:

  • git diff --check origin/main...HEAD: clean.
  • Ruby YAML parse of ci.yml, code-layout.yml, release.yml and .github/actions/setup-windows-code-layout/action.yml: ok.
  • bash -n on the extracted new block: ok.
  • Fake nproc/lscpu harness: shared 16 CPU/8 core host gives 3 jobs and 2 threads; dedicated 16 physical core host gives 5 and 4; nproc 1, 2 and 64 without lscpu give 3/2, 3/2 and 8/6; cores > logical and a CPU-restricted cpuset give 3/2; an ARM-like single core id gives 3/2; the macOS branch gives 3/3. lscpu exiting 1 or printing only headers exits 1 (the P3 above).
  • node --test scripts/*.test.mjs: 159 tests, 155 passed, 4 skipped, 0 failed.
  • node scripts/adr-check.mjs --base origin/main: ADR freeze passed, 14 changed files.
  • cargo fmt --all -- --check --config error_on_line_overflow=true on a clean git archive HEAD copy: passed.
  • cargo run --locked -p xtask -- check: passed (module and crate boundaries, plugin documents, service declarations, plugin locks, comment links, literal main, service catalog).
  • cargo run --locked -p xtask-check: passed.
  • cargo metadata --locked --no-deps: used for the target-name check above.
  • cargo-about 0.9.3 asset: downloaded, SHA-256 matched 3ad1e94ea1e63d69d1961f4fb15ccbbe9575d906111f96d2cb4dce6df48f71b4, and the tarball contains cargo-about-0.9.3-x86_64-unknown-linux-musl/cargo-about as extracted by release.yml:113.
  • CI at 1a81f00, run 44876257722: changes, dependencies, static-checks, windows-cli, web, macos-native, verify (linux) and ci-ok passed; acp-registry skipped. Run 44876257588 (native code layout): linux-artifact and all four platform-artifact jobs passed; native-layout skipped.

Unverified

  • The runner's exact lscpu topology beyond the echoed 3 by 2; the topology was not inspected directly.
  • The Python plugin step was skipped at the head because DIM_CI_PYTHON_PLUGINS is unset, so its 2 thread configuration was not exercised; the macOS Python path is unchanged.
  • The Windows PowerShell cache step was not executed locally (no PowerShell available); windows-cli job 136761584485 passed at the head, including the cache step, and the windows-arm64 platform-artifact job passed the composite action.
  • Concurrent load from a second runner instance was not observed directly; the commit message and the echoed 3 by 2 are the evidence for the shared-host case.

Comment thread .github/workflows/ci.yml
# 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)

Copy link
Copy Markdown
Collaborator

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 failing lscpu aborts the step before any fallback. cores=$(lscpu -p=Core,Socket | grep -v '^#' | sort -u | wc -l) returns the pipeline status; when lscpu exits nonzero or prints only comment lines, grep exits 1 and pipefail fails the assignment. The logical= assignment on the next line behaves the same, and the (( cores > 0 )) || cores=1 guard is never reached in these cases.

Failure scenario: on a runner image with util-linux installed but /sys/devices/system/cpu masked or unreadable (a container or hardened image), the verify test step exits 1 immediately, prints no Workspace tests: line, and runs no tests.

Evidence: I ran the exact block from ci.yml:260-286 with fake nproc and lscpu binaries. lscpu exiting 1 with valid rows, exiting 1 with no rows, and printing only headers all exit 1 at the cores assignment. With lscpu absent the fallback runs. The normal 8-core/16-thread case gives DIM_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 for logical), or append || true to both assignments and treat a zero cores or logical as the fallback. A command -v lscpu check is not enough because this failure is at runtime.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved at 1a81f00e5a314867f9c6a32b7daa0a1d955551bc against main at 26ab50e23a6bb6db0193a0f5681fac10a57cb3da. The author’s conflict resolution preserves the consolidated test targets, debug-only update recovery coverage, and the independent static gate. The new Linux workspace budget ran at 3 workers × 2 threads on the current runner, and the exact checked merge d7afd799d1372200ba14684db31c83527b7382c7 passed workspace tests, the wall-clock handoff, actual CLI profiles, public Node bindings, and ci-ok. The platform layout run passed too. The earlier 5×4 failures do not establish a single cause; the lower budget removes the practical blocker on this revision without relaxing the test assertions. Keep watching repeatability and runner contention. The peer review already captures useful follow-ups for a failing lscpu probe, stale priority names, and the manual-only layout budget.

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.

ci/perf: unlock test parallelism, optimize hot dev third-party crates, cache windows-cli, and trim slow tail tests

3 participants