Description
Context
bosn.toml currently forces CARGO_BUILD_JOBS = 1 for every managed Linux task. That was a safe stopgap for the heavyweight Wasmtime/Cranelift graph introduced by #25, but it serializes ordinary work even when the managed runner can safely sustain more concurrency.
Soldr 0.9.10 documents that CARGO_BUILD_JOBS controls Cargo's fan-out, while soldr --jobs / SOLDR_JOBS only caps the daemon and cannot cap Cargo. Soldr's current amalgamation admission code already recognizes published Rust amalgamations including kernal_api and gates them exclusively within the daemon, but the detector is pub(crate) and the released CLI exposes no stable machine-readable admission/probe command. In particular, an unreadable source currently means “not an amalgamation,” which is appropriate on its compile failure path but is not a safe signal for this repository to turn into a raised Cargo fan-out.
There is no matching kernal-api issue. Soldr #2781 owns compiler-time exclusive admission and Soldr #2878 owns the earlier Cargo-orchestration resource-control gap; this issue is deliberately narrower: replace this repository's permanent Bosn-wide CARGO_BUILD_JOBS=1 workaround only when Soldr can provide evidence-backed pre-build admission.
Proposal
Add a Bosn-facing adaptive Cargo-job policy for the managed Linux stack, driven solely by a documented, machine-readable Soldr amalgamation/admission result:
- Before a Bosn build/lint/test task begins its Cargo command, obtain Soldr's pre-build admission verdict for this workspace and its managed resource context.
- Choose
CARGO_BUILD_JOBS=4only for an explicit high-headroom/admitted verdict; choose2only for an explicit constrained-but-safe verdict; otherwise choose1. - Keep the daemon limit explicitly coherent with the selected Cargo limit (or document why it is intentionally distinct); do not assume
soldr --jobslimits Cargo. - Make the selected tier and detector verdict visible in task output so a CI/Bosn failure is diagnosable.
The detection contract must distinguish at least:
- admitted at the 4-job tier;
- admitted only at the 2-job tier;
- explicit exclusive/oversized-amalgamation admission;
- no applicable signal / degenerate input;
- unavailable detector, malformed/unknown schema, timeout, or ambiguous result.
Only the first two may raise Cargo concurrency. Every other state is fail-safe at CARGO_BUILD_JOBS=1; an unavailable or ambiguous detector must never be treated as “no amalgamation.” Do not add a handwritten host-RAM/cgroup heuristic in kernal-api: Soldr owns resource detection and admission semantics.
Because the current released detector is crate-private, first define or consume a versioned Soldr CLI/API contract with a bounded schema and exit semantics. The Bosn integration must pin/verify the compatible Soldr version rather than parsing human diagnostics or daemon internals.
Acceptance criteria
- RED: a deterministic policy test demonstrates that the present fixed environment always selects one Cargo job, including on an admitted fixture.
- GREEN: mocked/recorded Soldr verdicts select 4, 2, and 1 exactly as specified;
exclusive, no-signal, malformed, unavailable, timeout, and ambiguous verdicts all select 1. - GREEN: prove the command actually receives
CARGO_BUILD_JOBSat the selected tier; prove daemon configuration is not mistaken for Cargo's cap. - GREEN: no bespoke host-memory/cgroup calculation is added to this repository; the implementation consumes a versioned Soldr result only.
- GREEN: Bosn
fmt,lint, andtestretain their existing commands and work with warm managed caches, while reporting the chosen tier without leaking or restarting an unrelated active Bosn session. - GREEN: run the Wasmtime/Cranelift graph under each deterministic fixture tier and record maximum Cargo/compiler child count plus outcome. The 4- and 2-job tiers must not oversubscribe or OOM when Soldr admitted them; conservative paths remain green at 1.
- GREEN: CI remains independent of an ambient Bosn/Soldr daemon state; an absent or incompatible Soldr detector fails safely to one job rather than failing open.
Decisions
- Scope: kernal-api Bosn integration, with a Soldr-contract dependency. This repository owns
bosn.tomland the fixed workaround; Soldr owns the detector and must expose a stable pre-build result before the workaround can be relaxed. - Adaptive tiers: 4, then 2, then 1. Higher tiers require an explicit Soldr admission;
1is the conservative fallback. - No local memory heuristic. Reimplementing host/cgroup interpretation here would diverge from Soldr's resource scheduler and create conflicting policies.
- Priority: P1. feat(wasm): add engine policy and strict module admission validation #25 makes this compilation graph common, and permanent serialization trades substantial validation latency for safety even on eligible runners.
Related
- feat(wasm): add engine policy and strict module admission validation #25 — introduces the private Wasmtime/Cranelift sketch-host graph that makes the fixed cap costly.
- soldr#2781 — compiler-time amalgamation exclusivity.
- soldr#2878 — Cargo-front-door resource admission; the required detector contract should align with it.
- Soldr v0.9.10 CLI and current amalgamation implementation — evidence for the current Cargo/daemon distinction and private detector boundary.
Activity
zackees commentedon Aug 27, 2026
OOM audit addendum — release boundary and required admission point
This records the read-only postmortem for the first cold Wasmtime/Cranelift Bosn run and refines, rather than replaces, this issue's proposal.
Observed failure boundary
.wslconfigto 8 GiB / 4 processors; Docker reports 7.756 GiB available to containers.kernal-apiBosn container had no per-container memory limit (memory.max=max; DockerMemory=0). Its effective budget was therefore the shared Docker-VM ceiling, not host RAM.docker statsshowed about 3.5 GiB and 0.9 GiB respectively; these measurements establish shared contention, not the exact historical peak.NUM_JOBS=4. Soldr journals record compiler failures with exit-1:cranelift_codegenandaxumduring lint, thenwasmparserduring test, followed by anotheraxumretry. The terminal failure was an external/SIGKILL-style termination, not a Rust allocation panic.CARGO_BUILD_JOBS=1made the managed all-feature lint and test green. This is a safe mitigation, not root-cause proof.The failed container was replaced before this audit, so its cgroup-v2
memory.peakandmemory.eventsare unavailable. The replacement container's zero OOM counters cannot prove or disprove the prior kill. Thus the supported conclusion is concurrency-sensitive shared-VM resource exhaustion/termination is most likely; a kernel/cgroup OOM kill remains unproven until a controlled reproduction records peak/events/PIDs/child counts.Soldr version and detector boundary
The image pins and installed command use Soldr v0.9.10. That release's Rust-amalgamation allowlist recognizes
zccache, notkernal_api. Current Soldrmainaddskernal_api, but is ahead of v0.9.10 and is not evidence that the released image had that behavior.soldr cargodoes invoke the embedded compile service through its compiler wrapper. This is not asoldr build-only facility. However, the gate runs only after Cargo has selected and dispatched a compiler request. It cannot reduce Cargo's initial fan-out, fingerprint/directory work, or already-concurrent compiler children. The detector is also crate-private and has no stable machine-readable pre-build verdict. Detector-only wrapper admission is therefore insufficient for this issue.Consequence for #29
Keep
CARGO_BUILD_JOBS=1until Soldr supplies a versioned, pinned detector-capable release with a machine-readable pre-Cargo admission contract (or an equivalent front-door resource admission policy). The integration must select 4, 2, or 1 before launching Cargo; only explicit, validated 4/2 verdicts may raise the cap. Unknown, unavailable, malformed, timed-out, exclusive/oversized, or ambiguous verdicts must select 1. Emit the selected tier, Soldr version/verdict, cgroup/host telemetry, and maximum Cargo/compiler child counts for each validation run.Strong dependencies:
zackees commentedon Aug 27, 2026
Follow-up evidence — detector is real on Soldr main, but too late to choose Cargo fan-out
This is a source/release verification of the earlier audit, not a second proposal.
soldrtoC:\tools\python13\Scripts\soldr.exe;soldr --versionreports 0.9.10. The Bosn image independently pinssoldr==0.9.10. The latest GitHub release is likewise v0.9.10, published 2026-08-25.v0.9.10'scrates/soldr-daemon/src/amalgamation.rshasKNOWN_RUST_AMALGAMATIONS = [zccache]. It cannot recognize thekernal_apicrate name.main(observed atfa7a55f8…) changes that table to[kernal_api, zccache]andrequires_exclusive_access(args, cwd)selects an exclusive TokioRwLockpermit. This is genuine compiler-service admission for arustc --crate-name kernal_apirequest, after the request reaches the daemon.CARGO_BUILD_JOBSbefore Cargo starts: the predicate is crate-private and takes an already-dispatched compiler argv. ItsCompileResourceGate::acquireruns immediately before the embedded backend compile dispatch. It cannot limit Cargo fingerprint/directory scanning, Cargo's initial job scheduling, or compiler children already in flight.--jobs/SOLDR_JOBSgoverns the daemon; Cargo parallelism must be selected by Cargo-j,-- --jobs, or inheritedCARGO_BUILD_JOBS.host_pressureonly reads/reportsCARGO_BUILD_JOBS; it does not derive and export a safe value.Conclusion / action
Updating the container/setup from 0.9.10 to a future release containing
kernal_apiwould improve post-dispatch exclusivity, but it would not make adaptive Cargo fan-out effective and must not justify removing this repo's earlybosn.tomlCARGO_BUILD_JOBS=1mitigation. Configuration can set a static cap before Cargo today; it cannot ask the released/main detector for a pre-Cargo verdict.Keep the cap until soldr#2878 supplies a versioned Cargo-front-door contract that emits a machine-readable selected tier before invoking Cargo. The safe fallback remains 1 for unknown/ambiguous/unavailable verdicts; only measured, explicit 2/4-tier approval should raise it. Validate any future setup update with the original cold Wasmtime/Cranelift path and record effective Cargo jobs, Soldr jobs/version/verdict, peak/events, and max Cargo/compiler children.
Merge pull request #350 from zackees/ci/29-bosn-drop-job-cap