Skip to content

fix(deploy): a deploy compiles the library once — every bin on ONE cargo line, one feature set (card 9174fc83) - #4276

Merged
joelteply merged 1 commit into
canaryfrom
fix/one-cargo-call-per-deploy
Sep 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/one-cargo-call-per-deploy

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The measurement

IntelMac deploy, 2026-09-20: tools/scripts/start-server.sh ran four separate cargo build invocations, one per bin (continuum-mcp, continuum, forge-custodian, continuum-core-server), and Compiling continuum-core appeared four times per deploy — 18m16s + 5m41s + 5m14s + 7m46s = 37 minutes. 25 minutes on the M5. Under the stop-first reboot path (the CLI's memory bar, warm_build_allowed) the serving core is dark for all of it.

The cause

Each invocation resolves features, reruns the build scripts and fingerprints the library for itself. The CLI carried its own feature variable, CONTINUUM_CLI_FEATURES, which on the Linux/Windows arm was --no-default-features unconditionally — a different fingerprint from the other three bins, so the whole library recompiled for it. (#4249 had already aligned the two Mac arms; the per-bin invocations themselves, and the Linux/Windows divergence, remained.)

The fix — a deploy compiles the library once

  • One invocation. build_core_bins() is the single place the crate's bins are built: cargo build --manifest-path "$CORE_MANIFEST" --bin continuum-core-server --bin continuum-mcp --bin forge-custodian --bin continuum $PROFILE_FLAG $CONTINUUM_FEATURES. The lib compiles once; the four links run in parallel. The deploy build, the Fix 35GB memory leak + persona meter reliability #296 swept-cache restore, the Implement GAN-style Adversarial Training Loop #194 forced rebuild and the GPU-free CLI arm all call the function — the script's six literal cargo build lines became one.
  • One feature set by default. The CLI shares the core's set everywhere the set links no GPU runtime. The one real reason for a separation stays, at its smallest shape: a set carrying cuda/rocm/vulkan links a runtime the loader must find before main(), and on Windows that made the socket-client CLI unlaunchable (load-time cublas64_13.dll import, exit 127 with zero bytes, Build(deps): Bump actions/setup-node from 3 to 4 #6 — the comment in the script carries the whole measurement). On such a box only, the CLI is one extra line, --bin continuum alone, with --no-default-features: one extra lib compile, documented, and the only case in which a deploy compiles the library twice. A CPU-only or DirectML-only Linux/Windows box no longer pays it for a CLI whose only difference was dropping livekit-webrtc.
  • Every behaviour around the builds is preserved: the core's failure is FATAL and a sidecar's is a warning (on a combined failure the core is rebuilt alone — warm, so a link or the same error again — and ITS exit code decides); the self-build guard; the loud GPU-free→featured CLI fallback; the CLI install onto PATH; the Fix 35GB memory leak + persona meter reliability #296 restores (now for continuum-mcp too); the Implement GAN-style Adversarial Training Loop #194 freshness guard; the build-only receipt; the Windows toolchain import. The prebuilt-core cargo() shim — which would have skipped the whole combined invocation, sidecars included (the hole Cormac's review of fix(deploy): a verified prebuilt core launches THROUGH start-server.sh in prebuilt mode — the bare direct launch (#4090) started the M5 with no desktop and no power assertion #4107 closed) — is replaced by leaving continuum-core-server out of the bin list.
  • The memory bar is untouched, on purpose. With one invocation there is no "cheap bins before the big link" ordering to exploit: the lib compile IS the memory cost and every bin needs it. Splitting the small bins into a build beside the serving core would be a second invocation and the exact pressure the bar guards against. Stop-first now holds the core for one build instead of four.

The check (self-running, already in both CI jobs)

tools/scripts/tests/start-server-build-only.test.sh (runs in cargo test -p continuum-core --lib on ubuntu and in cargo check windows-msvc on windows):

  • static: the script text carries exactly ONE non-comment cargo build --manifest-path "$CORE_MANIFEST" line — canary's has 6, so the check bites on the defect;
  • behavioural: a fixture run traces one cargo line naming all four bins with one feature set; a cuda set separates only the CLI, on exactly one extra line; the existing build-only scenarios now also assert the first line is the combined one and the core is built at most twice (failure diagnosis);
  • the fixture cargo understands a multi---bin command line like real cargo.

Follow-up worth a card: moving the continuum CLI into its own crate (a socket client needs none of continuum-core's GPU deps) would retire the last separation and give CUDA boxes one lib compile too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…rgo line, one feature set (card 9174fc83)

Measured on the IntelMac deploy of 2026-09-20: start-server.sh ran FOUR
separate `cargo build` invocations, one per bin (continuum-mcp, continuum,
forge-custodian, continuum-core-server), and "Compiling continuum-core"
appeared four times per deploy — 18m16s + 5m41s + 5m14s + 7m46s = 37 minutes.
25 minutes on the M5. Under the stop-first reboot path (the CLI's memory bar)
the serving core is dark for all of it.

Cause: each invocation resolves features, reruns the build scripts and
fingerprints the library for itself. The CLI carried its own feature variable
(CONTINUUM_CLI_FEATURES) on the Linux/Windows arm — `--no-default-features`,
unconditionally — so its fingerprint differed from the other three bins' and
the whole library recompiled for it; per-bin invocations then paid the
build-script re-run and the per-invocation resolution on every bin.

THE LAW: a deploy compiles the library once.

- build_core_bins() is the single place the crate's bins are built: ONE
  `cargo build --manifest-path "$CORE_MANIFEST" --bin … --bin … --bin … --bin …`
  so the lib compiles once and the four links run in parallel. The deploy
  build, the #296 swept-cache restore, the #194 forced rebuild and the
  GPU-free CLI arm all call it; the six literal invocations become one.
- One feature set by default. The CLI shares the core's set everywhere the
  set links no GPU runtime. The only sanctioned separation is the measured
  one — a set carrying cuda/rocm/vulkan makes a socket-client CLI unlaunchable
  on Windows (load-time cublas import, exit 127 with zero bytes, #6) — and
  there the CLI is one extra line, `--bin continuum` alone, with its own set.
  A CPU-only or DirectML-only Linux/Windows box no longer pays a second lib
  compile for a CLI that merely dropped `livekit-webrtc`.
- Every existing behaviour around the builds is kept: the core's failure is
  FATAL and a sidecar's is a warning (on a combined failure the core is built
  alone, warm, and ITS exit code decides), the self-build guard, the loud
  GPU-free→featured CLI fallback, the CLI install, the #296 restores (now for
  continuum-mcp too), the #194 freshness guard, the build-only receipt. The
  prebuilt-core `cargo()` shim — which would have skipped the whole combined
  invocation, sidecars included (the hole Cormac's review of #4107 closed) —
  is replaced by leaving continuum-core-server out of the bin list.
- The memory bar (warm_build_allowed in the CLI) is untouched: with one
  invocation there is no cheap-bins-before-the-big-link ordering to exploit;
  the lib compile IS the memory cost and every bin needs it. Stop-first now
  holds the core for one build instead of four.

Self-running check (tools/scripts/tests/start-server-build-only.test.sh,
already in both CI jobs): the script text carries exactly ONE literal
`cargo build --manifest-path "$CORE_MANIFEST"` (canary had 6); a fixture run
traces one cargo line naming all four bins with one feature set; a cuda set
separates only the CLI, on exactly one extra line; the fixture cargo now
understands a multi-`--bin` command line like real cargo.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE — reviewed at exact head 7072383 (pipefail + labeler green; the two cargo jobs running at read time).

This is the fix for the measurement I posted (four Compiling continuum-core per deploy on the IntelMac, 18m16 + 5m41 + 5m14 + 7m46 ≈ 37 min): build_core_bins is the ONE cargo line, all four bins on it, one feature set, so the library fingerprints once and the four links run in parallel; the only separation that survives is the one with a measured reason (a cuda/rocm/vulkan set that links a load-time runtime the socket-client CLI cannot carry on Windows, #6), and it is one extra --bin continuum line on exactly those boxes. The prebuilt-core shim that would have skipped the combined line (the #4107 hole) is gone — the bin is simply left off the list. Failure semantics are preserved the right way round: on a combined failure the core is rebuilt alone and ITS exit code decides, sidecars stay warnings, and the memory bar is untouched because there is no cheap-bins-first order left to exploit. The check is self-running and bites on canary (six literal lines → one) and pins both shapes on the fixture cargo.

On this box the receipt will be one "Compiling continuum-core" per deploy log; I will post the number after the next restart.

@joelteply
joelteply enabled auto-merge (squash) September 20, 2026 21:28
@joelteply
joelteply merged commit 9c77f0b into canary Sep 20, 2026
7 checks passed
@joelteply
joelteply deleted the fix/one-cargo-call-per-deploy branch September 20, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant