D-05 ONNX cross-compile — editor pilot (load-dynamic + bundled libonnxruntime.so) #8

Merged
mik-tf merged 3 commits from development_mik_d05_onnx_editor into development 2026-05-05 06:06:28 +00:00
Owner

Implements D-05 on hero_editor — first of three pilots (editor → voice → embedder).

Summary

  • Workspace-pin voice_activity_detector with default-features = false, features = ["load-dynamic"] so the transitive ort dep dlopen-loads libonnxruntime.so at runtime instead of linking at build time.
  • Add [features] default = [] to hero_editor_sdk so the workflow cargo --features default resolves (playbook item 9, mirrors hero_matrixchat_sdk from session 58).
  • Port .forgejo/workflows/build-linux.yaml to the post-home#212 canonical shape (target-triple asset naming, dual upload, race-tolerant Create Release). Mirrors hero_matrixchat.
  • Matrix swap x86_64-unknown-linux-muslx86_64-unknown-linux-gnu for ONNX services only. Microsoft does not ship a musl onnxruntime tarball; the 14 non-ONNX services keep static-musl untouched.
  • New Bundle ONNX Runtime step downloads onnxruntime-linux-{x64,aarch64}-${ONNXRUNTIME_VERSION}.tgz from Microsoft and copies libonnxruntime.so* next to the binaries; upload steps emit libonnxruntime.so.${ONNXRUNTIME_VERSION}-${target-triple} as a separate asset (8 assets per release: 3 bins + 1 .so × 2 archs, ~+8 MB per arch).
  • Pin ONNXRUNTIME_VERSION=1.25.1 in buildenv.sh as single source of truth.
  • Two preparatory commits also included: a codegen sync after the hero_rpc 0.5 migration that wasnt captured in 99e094f, and cargo fmt + a syntax-error fix in examples/basic_usage.rs (4 broken println! string literals — string closed mid-message).

Local verification

  • cargo tree -e features -p hero_editor_ui confirms voice_activity_detector is enabled with load-dynamic. ort defaults leak through VADs upstream ort declaration (which does not disable defaults), but on gnu the openssl-sys/ureq cascade compiles as host-side build-deps without issue. ort-sys/build.rs:676 shows the runtime download path is gated on pkg-config failure + env var, so its benign even when activated.
  • cargo build --workspace --release clean.
  • cargo check --workspace clean (warnings only — strict clippy debt tracked in hero_editor#7, deferred per hero_biz#22 / hero_foundry#28 precedent).

Test plan

  • Squash-merge after review.
  • Tag v0.1.0-rc4 (rc1/rc2/rc3 burned in earlier session 55 attempts, before D-05).
  • Verify 8 assets shipped (hero_editor*-{x86_64,aarch64}-unknown-linux-gnu × 3 bins + libonnxruntime.so.1.25.1-*-unknown-linux-gnu × 2).
  • Verify each tarball/bin has matching .so (playbook item 12).
  • Smoke-install on heroci via service_editor install --from-ci, confirm OpenRPC health returns ok (playbook item 13). Voice WS deferred to UX-validation gate.

Out of scope

  • hero_voice and hero_embedder implementation (sessions 61, 62 — same pattern).
  • Voice WS end-to-end smoke (UX-validation session).
  • The pre-existing strict-clippy debt outside the 5 mechanical fixes already included (filed as hero_editor#7).
Implements [D-05](https://forge.ourworld.tf/lhumina_code/hero_demo/src/branch/development/decisions/D-05-onnx-cross-compile.md) on `hero_editor` — first of three pilots (editor → voice → embedder). ## Summary - Workspace-pin `voice_activity_detector` with `default-features = false, features = ["load-dynamic"]` so the transitive ort dep dlopen-loads `libonnxruntime.so` at runtime instead of linking at build time. - Add `[features] default = []` to `hero_editor_sdk` so the workflow `cargo --features default` resolves (playbook item 9, mirrors `hero_matrixchat_sdk` from session 58). - Port `.forgejo/workflows/build-linux.yaml` to the post-home#212 canonical shape (target-triple asset naming, dual upload, race-tolerant Create Release). Mirrors `hero_matrixchat`. - **Matrix swap `x86_64-unknown-linux-musl` → `x86_64-unknown-linux-gnu`** for ONNX services only. Microsoft does not ship a musl onnxruntime tarball; the 14 non-ONNX services keep static-musl untouched. - New `Bundle ONNX Runtime` step downloads `onnxruntime-linux-{x64,aarch64}-${ONNXRUNTIME_VERSION}.tgz` from Microsoft and copies `libonnxruntime.so*` next to the binaries; upload steps emit `libonnxruntime.so.${ONNXRUNTIME_VERSION}-${target-triple}` as a separate asset (8 assets per release: 3 bins + 1 .so × 2 archs, ~+8 MB per arch). - Pin `ONNXRUNTIME_VERSION=1.25.1` in `buildenv.sh` as single source of truth. - Two preparatory commits also included: a codegen sync after the hero_rpc 0.5 migration that wasnt captured in `99e094f`, and `cargo fmt` + a syntax-error fix in `examples/basic_usage.rs` (4 broken `println!` string literals — string closed mid-message). ## Local verification - `cargo tree -e features -p hero_editor_ui` confirms `voice_activity_detector` is enabled with `load-dynamic`. ort defaults leak through VADs upstream ort declaration (which does not disable defaults), but on gnu the openssl-sys/ureq cascade compiles as **host-side build-deps** without issue. `ort-sys/build.rs:676` shows the runtime download path is gated on pkg-config failure + env var, so its benign even when activated. - `cargo build --workspace --release` clean. - `cargo check --workspace` clean (warnings only — strict clippy debt tracked in hero_editor#7, deferred per `hero_biz#22` / `hero_foundry#28` precedent). ## Test plan - [ ] Squash-merge after review. - [ ] Tag `v0.1.0-rc4` (rc1/rc2/rc3 burned in earlier session 55 attempts, before D-05). - [ ] Verify 8 assets shipped (`hero_editor*-{x86_64,aarch64}-unknown-linux-gnu` × 3 bins + `libonnxruntime.so.1.25.1-*-unknown-linux-gnu` × 2). - [ ] Verify each tarball/bin has matching `.so` (playbook item 12). - [ ] Smoke-install on heroci via `service_editor install --from-ci`, confirm OpenRPC `health` returns ok (playbook item 13). Voice WS deferred to UX-validation gate. ## Out of scope - hero_voice and hero_embedder implementation (sessions 61, 62 — same pattern). - Voice WS end-to-end smoke (UX-validation session). - The pre-existing strict-clippy debt outside the 5 mechanical fixes already included (filed as hero_editor#7).
Local cargo build regenerated this file to import from hero_rpc_openrpc
(matching commit 99e094f's hero_rpc 0.5 split) but the regenerated output
wasn't captured at the time. Bringing the checked-in file in line with
what build.rs emits today so the working tree is clean before applying
D-05 ONNX cross-compile changes.

Signed-off-by: mik-tf
Mechanical pre-merge gate cleanup before applying D-05.

- cargo fmt across the workspace (5 files reflowed by current rustfmt).
- crates/hero_editor_examples/examples/basic_usage.rs had unbalanced
  quotes in 4 println! lines that closed the string literal mid-message
  (`println!("...{{...}}" - Read file content");`). The intended message
  put `- Read file content` inside the string. Without this fix the
  example doesn't even tokenize, which blocked `cargo fmt --check`.
- crates/hero_editor_server/src/lib.rs picks up the clippy quick wins
  found while running the strict pre-merge gate: collapse a nested
  `if check_extension { if let Some(ext) = ...` into an `if let` chain,
  and drop four `.map_err(|e| internal_err(e))` redundant closures.

Remaining strict-clippy debt (broken examples/health.rs SDK call site,
dead structs/imports in hero_editor_ui) is tracked in hero_editor#7 and
deferred per the hero_biz#22 / hero_foundry#28 precedent.

Signed-off-by: mik-tf
ci: D-05 ONNX cross-compile — load-dynamic + bundled libonnxruntime.so
All checks were successful
Build and Test / build (pull_request) Successful in 4m20s
b353a5aa70
Apply the D-05 ONNX cross-compile pattern (decisions/D-05-onnx-cross-compile.md)
to hero_editor. First implementation pilot of the shared pattern that will
also unblock hero_voice (session 61) and hero_embedder (session 62).

Cargo:
  - Workspace-pin voice_activity_detector with default-features = false,
    features = ["load-dynamic"] so the transitive ort dep loads
    libonnxruntime.so via dlopen at runtime instead of link-time.
  - Switch hero_editor_ui to consume the workspace pin.
  - Add `[features] default = []` on hero_editor_sdk so the workflow's
    `cargo --features default` resolves (mirrors hero_matrixchat_sdk
    fix from session 58, playbook item 9).

Workflow (.forgejo/workflows/build-linux.yaml):
  - Port to the post-home#212 canonical shape (target-triple asset
    naming, dual upload to release assets + package registry, separate
    Create Release step with race-tolerant GET-or-POST). Mirrors
    hero_matrixchat's build-linux.yaml.
  - Swap matrix x86_64-unknown-linux-musl -> x86_64-unknown-linux-gnu.
    Microsoft does not ship a musl onnxruntime tarball, so ONNX
    services move to glibc; the 14 non-ONNX services keep static-musl.
  - New `Bundle ONNX Runtime` step between Build and Upload: download
    Microsoft's onnxruntime-linux-{x64,aarch64}-${ONNXRUNTIME_VERSION}.tgz
    and copy libonnxruntime.so* next to the built binaries so the
    upload steps pick them up (playbook item 12).
  - Upload libonnxruntime.so.${ONNXRUNTIME_VERSION}-${target-triple} as
    a separate asset alongside the binaries (8 assets total: 3 binaries
    + 1 .so per arch, ~+8 MB per arch).

buildenv.sh:
  - Pin ONNXRUNTIME_VERSION=1.25.1 as the single source of truth for
    the workflow's tarball download.

Local verification on x86_64-unknown-linux-gnu:
  - `cargo tree -e features -p hero_editor_ui` confirms voice_activity_detector
    is enabled with `load-dynamic`. ort defaults still leak through VAD's
    upstream ort declaration (which doesn't disable defaults), but on gnu
    the openssl-sys/ureq cascade compiles as host-side build-deps without
    issue, and ort-sys's `download-binaries` runtime path is gated and
    benign when load-dynamic is set (ort-sys/build.rs:676).
  - `cargo build --workspace --release` clean, `cargo check --workspace`
    clean (warnings only — strict clippy debt tracked in hero_editor#7).

Closes nothing yet — completes after the consumer-side
(hero_skills/service_editor.nu --from-ci) lands and v0.1.0-rc4 ships.

Signed-off-by: mik-tf
mik-tf merged commit 1aeab66785 into development 2026-05-05 06:06:28 +00:00
mik-tf deleted branch development_mik_d05_onnx_editor 2026-05-05 06:06:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_editor!8
No description provided.