Skip to content

workers: resolve the worker binary beside the module when no explicit path is set - #12

Merged
ualtinok merged 4 commits into
cortexkit:masterfrom
Qiiks:feat/worker-bin-default-resolution
Sep 16, 2026
Merged

ualtinok merged 4 commits into
cortexkit:masterfrom
Qiiks:feat/worker-bin-default-resolution

Conversation

@Qiiks

@Qiiks Qiiks commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

A worker-engine model refuses to load unless the catalog entry or the engine env var (SYNAPSE_<ENGINE>_WORKER_BIN) supplies a worker path:

<llama|owned-cuda|...> model '<id>' requires worker_bin or SYNAPSE_<ENGINE>_WORKER_BIN

But the release archives already unpack every binary at the archive root, so an installed ck-synapse sits next to ck-synapse-worker-llama / ck-synapse-worker-cuda / etc. Nothing looks there, so every fresh install needs hand-set env vars (or per-model worker_bin entries) before a single worker-engine model can load — and the CUDA worker isn't even in the release matrix yet, which is exactly the kind of install where operators hit this first.

Change

Resolution chain in load_worker_backend_blocking gains a final fallback:

  1. spec.worker_bin (unchanged)
  2. engine env var (unchanged)
  3. ck-synapse-worker-<engine> beside the running module binary (new)

The name table lives in worker_engine_names.rs next to the HELLO identity constants, so the file-name contract sits with the identity contract. current_exe() + parent + .exe on Windows, matching the ANE launcher's existing sibling-resolution pattern.

When no sibling exists the refusal keeps its shape and now names all three sources:

owned-cuda model '<id>' requires worker_bin, SYNAPSE_OWNED_CUDA_WORKER_BIN, or a sibling worker binary

Notes

  • No behavior change when an explicit path or env var is present; sibling resolution runs last.
  • The owned-metal-decode lane keeps its own resolution path (its refusal is a typed Refused(Unavailable), deliberately distinct) — I left it alone rather than widen this change; can follow up if wanted.
  • Verified locally: cargo test -p synapse-module --lib 424 passed / 0 failed (new worker_binary_sibling_names_cover_every_worker_engine test pins the table), cargo test -p synapse-core --lib 52 passed, cargo clippy and cargo fmt --check clean.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Adds a fallback for worker binary resolution and a Qwen3 embedding probe fixture, so worker-engine models load from a standard install and owned-cuda models can certify.

Worker binary resolution

  • Looks for ck-synapse-worker-<engine> beside the running module binary after checking worker_bin and SYNAPSE_<ENGINE>_WORKER_BIN, with the sibling name table reusing the shared worker-engine constants where available.
  • No behavior change when an explicit path or env var is set.

Probe fixture

  • Adds a Qwen3-Embedding reference set (64 items, f32 CPU-generated vectors) for the owned-cuda and owned-metal lanes.
  • This closes the reference_fixture_missing dead-end that blocked owned-cuda certification.

Written for commit d90c9a7. Summary will update on new commits.

Review in cubic

…n certify

Owned-CUDA has no declared or inherited certification path: a measured
probe row must exist before serving, and the probe resolves reference
fixtures by (family, reference_model). The shipped embed fixtures only
cover minilm and gte-modernbert, so a qwen3-0.6b/owned-cuda model
dead-ends at reference_fixture_missing with no supported way to
certify.

Add the missing set: 64 items, the same corpus texts as the shipped
fixtures, reference vectors generated on CPU with candle-transformers
0.10.2 f32 (last-token pool + L2), independent of the CUDA kernels
under test. Wire it into probe_fixtures() and resolve the
qwen3-embedding model-id family/reference names so the fixture matches
without an engine build flag, mirroring the minilm/modernbert fallbacks.

Verified locally: the fixture scores mean cosine 0.99999771 / worst
decile 1.0 against the owned-CUDA lane (thresholds 0.999 / 0.9), and
the new registry test pins family/reference/dims for all three sets.
… path is set

A worker-engine model refuses to load unless the catalog entry or the
engine env var (SYNAPSE_<ENGINE>_WORKER_BIN) supplies a worker path. The
release archives already unpack every binary at the archive root, so an
installed ck-synapse sits next to ck-synapse-worker-*, yet nothing looks
there and every fresh install needs hand-set env or per-model worker_bin
entries before a single worker-engine model can load.

Add sibling resolution as the last fallback in the resolution chain:
spec worker_bin -> engine env var -> ck-synapse-worker-<engine> beside
the running module binary (name table in worker_engine_names, so the
contract lives next to the HELLO identity constants). When no sibling
exists the refusal keeps its shape and now names all three sources.

No behavior change when an explicit path or env var is present; the
owned-decode lane keeps its own resolution for now.
Copilot AI lite review requested due to automatic review settings September 16, 2026 03:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Not reviewed (too large): crates/synapse-module/src/fixtures/probe_corpus_qwen3_embedding_fp32.json (~65,932 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread crates/synapse-core/src/worker_engine_names.rs Outdated
The Windows-only set_extension call made `candidate` needlessly mutable
on every other target, and CI runs clippy with -D warnings on linux.
Rebind under cfg(windows) instead; no behavior change on either target.
The sibling-resolution table hardcoded "owned-cuda" and
"owned-metal-decode" while the same file already exports
CUDA_WORKER_ENGINE and DECODE_WORKER_ENGINE with exactly those values.
The file's own doc comment says every producer and consumer must use the
shared constant so a catalog rename cannot silently break the contract;
the literals defeat that for the new fallback. Match on the constants
instead.

LLAMA_ENGINE covers llama; mlx/ane have no catalog-name constant (the
MLX_WORKER_ENGINE/ANE_WORKER_ENGINE constants are HELLO identities, a
different string), so those two stay literal.
@Qiiks

Qiiks commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the cubic P3 in d90c9a7.

worker_binary_file_name now matches on CUDA_WORKER_ENGINE / DECODE_WORKER_ENGINE instead of the "owned-cuda" / "owned-metal-decode" literals, so the engine-name contract in this file has one source of truth.

LLAMA_ENGINE already covered llama. The "mlx" / "ane" literals stay: those are catalog engine names, and the file's MLX_WORKER_ENGINE / ANE_WORKER_ENGINE constants are HELLO identities (mlx-worker / ane-coreml-worker) — different strings, so there is no catalog-name constant to reuse for them.

Verified: cargo test -p synapse-module --lib worker_binary_sibling_names passes (1 passed, 425 filtered), cargo fmt --check -p synapse-core clean, cargo clippy -p synapse-core --all-targets clean.

@ualtinok
ualtinok merged commit 8964b3a into cortexkit:master Sep 16, 2026
9 checks passed
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.

3 participants