Skip to content

fix: embed host compaction baml#607

Open
neithanmo wants to merge 1 commit into
mainfrom
fix/baml_compaction
Open

fix: embed host compaction baml#607
neithanmo wants to merge 1 commit into
mainfrom
fix/baml_compaction

Conversation

@neithanmo

Copy link
Copy Markdown
Contributor

Summary

Embeds host compaction BAML into agentium, fixing release/runtime boot failures when baml_src/host is not present on disk.

Issue: host compaction previously loaded BAML from loose files (BAML_HOST_SCHEMA_DIR, /opt/agentium, or repo fallback). Release tar users do not get those files, and binaries can resolve to build-machine paths. This made users download/copy extra BAML sidecars or required us to add BAML files to release artifacts.

This PR opts for embedded BAML via include_str! + in-memory BAML runtime loading. Result: agentium binary is self-contained for host compaction, release tar layout stays binaries-only, and users do not need extra BAML files. BAML_HOST_SCHEMA_DIR still works as override for dev/operator custom BAML.

What's in the diff

  • crates/baml-rt-quickjs/src/baml_execution.rs

    • Adds BamlExecutor::load_il_from_content, using BamlRuntime::from_file_content.
    • Shares default executor setup through from_runtime.
  • crates/baml-rt-quickjs/src/baml/schema_invoke.rs

    • Adds BamlRuntimeManager::load_schema_from_files.
    • Extracts shared schema wiring into finish_schema_load.
    • In-memory path skips disk-only tool/schema manifest sidecars and explicitly clears those manifest slots.
  • crates/baml-rt-a2a/src/host_compaction/mod.rs

    • Replaces raw schema dir config with HostCompactionSource::{Embedded, Dir}.
    • Boots embedded source through load_schema_from_files.
    • Keeps directory source for override compatibility.
  • crates/baml-rt-a2a/src/lib.rs

    • Re-exports HostCompactionSource.
  • crates/baml-agent-runner/src/host_compaction.rs

    • Embeds baml_src/host/clients.baml and baml_src/host/context_compaction.baml.
    • Defaults to embedded BAML.
    • Keeps BAML_HOST_SCHEMA_DIR override.
    • Removes /opt/agentium probe and repo fallback.
  • Dockerfile

    • Removes COPY baml_src/host /opt/agentium/baml_src/host.
    • Removes ENV BAML_HOST_SCHEMA_DIR=/opt/agentium.
  • Tests

    • Adds in-memory loader tests in crates/baml-rt-quickjs/tests/load_schema_from_files_test.rs.
    • Updates host compaction tests to boot embedded source.
    • Keeps directory override boot coverage.

Test plan

  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo fmt --check clean (cargo fmt --all run)
  • cargo test / cargo nextest run pass for the affected crates
    • cargo test -p baml-rt-quickjs load_schema_from_files --no-default-features
    • cargo test -p baml-rt-a2a host_compaction --no-default-features

Checklist

  • Commit subjects and the PR title follow Conventional Commits
  • Documentation updated where behavior changed
  • No secrets, credentials, or partner-specific names in the diff

@neithanmo neithanmo requested a review from ryan-s-roberts July 6, 2026 17:08
@neithanmo neithanmo force-pushed the fix/baml_compaction branch from 53e9ed5 to 4c79545 Compare July 7, 2026 03:24
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