Skip to content

Fix atomic GGUF runtime CLI publication - #630

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby-fix-gguf-runtime-cli
Aug 25, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby-fix-gguf-runtime-cli

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • route GGUF runtime CLI preflight and package publication through canonical open_gguf_model() shard discovery and validation
  • bind runtime evidence to the complete stable shard set while preserving exact source, tokenizer, import-route, graph, runtime-version, and ORT GenAI 0.15.2 gates
  • emit Saved output only after atomic runtime package publication succeeds, with failure cleanup that leaves no durable partial package
  • preserve ModelPackage cycle, collision, sidecar, and path invariants from Enforce ModelPackage persistence invariants #629

Addresses audited Copilot comments 3855249765, 3855249840, and 3855343131.

Tests

  • python -m pytest tests/cli_test.py tests/gguf_test.py src/mobius/_model_package_test.py src/mobius/integrations/gguf/ -q --tb=short (3131 passed)
  • python -m pytest tests/gguf_test.py src/mobius/integrations/gguf/_builder_test.py src/mobius/integrations/gguf/_runtime_package_test.py src/mobius/integrations/gguf/_runtime_evidence_test.py src/mobius/integrations/gguf/_shard_set_test.py src/mobius/_model_package_test.py -q --tb=short (578 passed, post-rebase)
  • python -m pytest tests/build_graph_test.py tests/cli_test.py src/ -q -k "not phi4mm and not apply_weights_unknown" --tb=short -n auto (7822 passed, 56 skipped, 1 subtest passed)
  • lintrunner f --output oneline --all-files

Review

  • GPT-5.6 Sol, medium reasoning; selected-shard canonical filename finding fixed; final re-review clean

Route runtime preflight and publication through canonical GGUF shard discovery, bind evidence to the full stable source set, and delay success output until atomic package publication completes. Add regressions for incomplete and invalid shards, publication failures, cleanup, identity, and output ordering.

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 25, 2026 21:09
@justinchuby
justinchuby merged commit 6ff5f78 into main Aug 25, 2026
15 of 24 checks passed
@justinchuby
justinchuby deleted the justinchuby-fix-gguf-runtime-cli branch August 25, 2026 21:10
@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing b2f4334 → 8c946d7

Model Sub-model Changes Status

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing b2f4334 → 8c946d7

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 265 265 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 127 127 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 429 429 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens GGUF runtime CLI publication by routing preflight and publication through canonical GGUF shard discovery (open_gguf_model()), binding runtime evidence to the full shard set (when split), and ensuring “Saved …” CLI output is only emitted after successful atomic runtime package publication (with cleanup on failure).

Changes:

  • Switch runtime preflight + packaging reads from direct GGUFModel(...) construction to canonical open_gguf_model() (supports shard sets consistently).
  • Extend runtime evidence hashing to cover the complete shard set (names + sizes + per-shard sha256) and to use a shared reader_tensors() surface.
  • Adjust CLI output flow so “Saved …” is printed only after runtime package publication succeeds; add tests covering preflight failures and publication failures.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/gguf_test.py Updates/extends CLI tests to assert canonical open + no “Saved” output on preflight/publication failure.
src/mobius/integrations/gguf/_shard_set.py Adds source_matches_path() on GgufShardSet and exposes canonical open_gguf_model() entry point.
src/mobius/integrations/gguf/_runtime_package.py Uses open_gguf_model() for source opening and refuses publication if source changes during open/evidence matching.
src/mobius/integrations/gguf/_runtime_package_test.py Updates mocks to patch open_gguf_model() and adds staging cleanup test coverage.
src/mobius/integrations/gguf/_runtime_evidence.py Computes artifact identity over full shard sets and switches to reader_tensors() instead of private _reader.tensors.
src/mobius/integrations/gguf/_runtime_evidence_test.py Adds sharded-identity coverage and updates model stubs to match reader_tensors() usage.
src/mobius/integrations/gguf/_builder.py Canonicalizes pkg.gguf_source_path / filename for shard sets and adds source-stability gates around identity binding.
src/mobius/main.py Routes runtime preflight through open_gguf_model() and prints “Saved …” only after atomic runtime publication.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

justinchuby added a commit that referenced this pull request Aug 25, 2026
## Summary

- promote Gemma 3, Qwen2-VL, and Qwen2.5-VL text + mmproj graph import
- preserve canonical `decoder`, `vision_encoder`, and `embedding`
package roles and #625-#630 package/runtime invariants
- add exact pinned llama.cpp tensor closures, projector override
resolution, Qwen QKV/temporal patch transforms, Gemma projector mapping,
and supported quantization paths
- bind real pinned Hugging Face processor contracts to float32 graph
boundaries, independent image/video streams, batch-major media ordering,
and empty-media behavior
- keep all downstream multimodal runtime verdicts deferred rather than
inferring runtime support from graph construction

## Evidence

- real Gemma 3, Qwen2-VL, and Qwen2.5-VL mmproj artifact revisions,
sizes, SHA-256 values, qtype inventories, and paired text targets are
recorded in the registry and docs
- value-based tensor/projector mapping tests cover Gemma 3 and both Qwen
variants
- synthetic execution covers two-row mixed image/video ordering,
text-only and empty-media embedding, Qwen vision execution, decoder
prefill, and cached decode
- Gemma 3 tests cover the processor-native 256 `<image_soft_token>`
placeholders, safe out-of-vocabulary lookup handling, flattened batch
offsets, and projector parity
- generated generic decoder metadata remains graph-derived

## Runtime waivers

Graph import is supported; downstream runtime support remains deferred.
Gemma 3 parent processor assets are gated and no ORT GenAI media
orchestrator was proven. Qwen runtime still needs proven video
alias/timing plumbing and 3D M-RoPE position construction. No
audio/codec bundle was promoted without a complete expressible
processor/state/runtime contract.

## Residual multimodal blockers

- Qwen3-VL: DeepStack decoder-layer injection
- Gemma3n: complete MobileNetV5 vision and Conformer audio bundle
- Gemma4 audio: remaining `a.pre_encode.*` and Conformer parity
- generated-audio sidecars: stateful codec/generation contracts

## Validation

- focused GGUF/mmproj/multimodal/package/runtime: `3215 passed`
- broad non-integration: `7849 passed, 56 skipped, 1 subtest passed`
- initialized repository lint: clean
- GPT-5.6 Sol medium architecture review: fixed Gemma 3
boundary-vs-soft-token blocker; no remaining high-confidence findings
- GPT-5.6 Sol medium regression review: fixed Qwen evidence references,
added vision/prefill/decode execution, and closed the docs artifact
census

Base: `6ff5f78dafb90609372de023a5ab9d27098dca6d`
Head: `ed370d8cecf7adc985d5b372ee050b661f069607`

---------

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
justinchuby added a commit that referenced this pull request Aug 25, 2026
## Summary

- clean up still-valid typing, documentation, test robustness,
error-message,
  maintainability, and performance findings left by the GGUF PR stack
- preserve the behavioral fixes merged in #625-#632
- hash reused multi-GB GGUF sources once, at the final pre-publication
integrity
  gate, while retaining cheap identity checks around staging

Exact base: `2db9d33debdc254d879a51b14434c9a81c230f4f`

Exact head: `4541ed2bc9d2ab4227484510b4a85b2d9113eb25`

## Reconstructed original 17-item low-priority tranche

The persisted audit retained only the totals, so this list was
reconstructed
from the live threads and current source. All but the already-fixed #596
comment are addressed in this PR.

| PR | Comment | Disposition |
|---|---:|---|
| #550 | 3837144656 | Implemented: correct tuple return annotation |
| #552 | 3837389183 | Implemented: multichannel waveform shape docs |
| #559 | 3837716261 | Implemented: name-based cache assertions |
| #573 | 3854308350 | Implemented: one final GGUF hash, with integrity
regression coverage |
| #574 | 3854345521 | Implemented: `TensorRole \| None` typing |
| #574 | 3854345597 | Implemented: removed obsolete verdict filtering |
| #577 | 3854472859 | Implemented: documented SSM sequence length |
| #578 | 3843112613 | Implemented: documented F64 passthrough |
| #579 | 3854518332 | Implemented: generalized fused-projection error |
| #580 | 3854576300 | Implemented: removed brittle node counts |
| #583 | 3854681386 | Implemented: documented conditional draft outputs
|
| #587 | 3854816872 | Implemented: corrected MTP output contract docs |
| #596 | 3846110059 | Already fixed on base: unambiguous GQA bias
comment |
| #600 | 3855174281 | Implemented: metadata-count-only MTP error |
| #607 | 3855776048 | Implemented: stable route-field assertions |
| #607 | 3855776086 | Implemented: public tensor iterator |
| #609 | 3856486136 | Implemented: fail-closed LM-head comment |

## Current unresolved-thread disposition

This covers all 48 Copilot threads returned by the reproducible
#600-#630
query. The one human #623 thread is excluded.

| PR | Comment | Current-main disposition and evidence |
|---|---:|---|
| #600 | 3855174177 | Already fixed by #629: package cycle and
reserved-sidecar validation |
| #600 | 3855174238 | Already fixed by #629: explicit MTP sidecar
naming/loading |
| #600 | 3855174281 | Implemented here: error no longer invents an
observed block count |
| #602 | 3848155961 | Outside exact stack; already fixed: top-level
`expert_dtype` is classified before early return |
| #602 | 3848155983 | Outside exact stack; still-valid behavioral
block-quant validation, unchanged |
| #602 | 3848156000 | Outside exact stack; still-valid truncated-read
behavioral finding, unchanged |
| #602 | 3848156022 | Outside exact stack; still-valid descriptor
byte/dtype validation, unchanged |
| #602 | 3848156040 | Outside exact stack; still-valid expert-bank
payload validation, unchanged |
| #603 | 3855249765 | Already fixed by #630: runtime preflight preserves
shard sets |
| #603 | 3855249840 | Already fixed by #630: success output follows
durable runtime publication |
| #604 | 3855343082 | Implemented here: graph-only MTP persistence
distinguished from runtime rejection |
| #604 | 3855343131 | Already fixed by #630: runtime success messages
are atomic |
| #607 | 3855776001 | Implemented here: missing generation golden skips
before provenance read |
| #607 | 3855776048 | Implemented here: only stable route fields are
asserted |
| #607 | 3855776086 | Implemented here: tensor count uses
`tensor_items_raw()` |
| #608 | 3856079371 | Still-valid behavioral cache-symlink containment
finding; unchanged |
| #608 | 3856079415 | Still-valid behavioral lowercase-digest validation
finding; unchanged |
| #609 | 3856486136 | Implemented here: comment matches value-preserving
policy |
| #610 | 3855541683 | Already fixed by #628: Falcon bias precedence is
explicit |
| #610 | 3855541761 | Already fixed by #628: CTRL tiny config exercises
projection biases |
| #611 | 3856595840 | Implemented here: runtime test resolves the
distribution providing the module |
| #612 | 3855677383 | Already fixed by #625: supported-version
endianness detection |
| #612 | 3855677427 | Implemented here: shared `INT64_MAX` sentinel |
| #612 | 3855677460 | Implemented here: shared PLaMo2 width inference |
| #612 | 3855677486 | Implemented here: accepted PLaMo2 activation
spellings are explicit |
| #613 | 3855845678 | Implemented here: canonical issue URL |
| #613 | 3855845757 | Implemented here: Mamba-1 function-registration
docs |
| #613 | 3855845806 | Implemented here: test expects the canonical issue
URL |
| #614 | 3855988545 | Implemented here: removed stale Nemotron-H
divergence comments |
| #614 | 3855988597 | Already fixed by #628: zero-head geometry raises
actionable `ValueError` |
| #615 | 3856082290 | Already fixed by #626: dense GraniteHybrid bias
closure |
| #618 | 3856729330 | Implemented here: required routes filter ORT GenAI
evidence |
| #618 | 3856729409 | Implemented here: env-selected runtime version is
authoritative |
| #618 | 3856729490 | Stale/N/A: PR-description-only matrix claim;
repository workflow claims one pinned version |
| #618 | 3856729563 | Implemented here: schema tail restored to normal
indentation |
| #619 | 3856342484 | Already fixed on base: Kimi Linear uses
`/issues/605` |
| #619 | 3856342532 | Already fixed by #628: config rejects convolution
kernels below 2 |
| #619 | 3856342580 | Already fixed by #628: GGUF contract rejects
convolution kernels below 2 |
| #620 | 3855717041 | Already fixed by #627: tied LM-head-only
checkpoints are retained |
| #621 | 3856722324 | Already fixed by #628: Kimi-K3 required metadata
is complete |
| #623 | 3855931210 | N/A to current main: comment belongs to open,
unmerged #623 |
| #623 | 3855939302 | N/A to current main: comment belongs to open,
unmerged #623 |
| #623 | 3855939358 | N/A to current main: comment belongs to open,
unmerged #623 |
| #623 | 3855939394 | N/A to current main: comment belongs to open,
unmerged #623 |
| #624 | 3856777152 | Implemented here: runtime compatibility reuses the
emitted model type |
| #625 | 3857049733 | Implemented here: unsupported header reports both
endian candidates |
| #629 | 3857313182 | Newer post-audit behavioral sidecar-symlink
cleanup finding; unchanged |
| #629 | 3857313251 | Newer post-audit cross-platform path-safety
finding; unchanged |

## Validation

- affected GGUF/package/ORT GenAI/model/schema tests: 1,040 passed
- broad non-integration suite: 7,851 passed, 56 skipped, 1 subtest
passed
- generated GGUF docs checks: 7 passed
- initialized `lintrunner`; full lint/format passed
- GPT-5.6 Sol medium review: one integrity finding fixed; re-review
found no significant issues

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
justinchuby added a commit that referenced this pull request Aug 25, 2026
## Summary

Promotes four stateless specialized GGUF encoder architectures from the
pinned llama.cpp census:

- `eurobert`: pre-RMSNorm split-QKV RoPE encoder with parallel SwiGLU
- `neo-bert`: fused contiguous QKV, interleaved RoPE, fused SwiGLU, and
CLS pooling
- `nomic-bert` (dense only): post-norm RoPE encoder with gated FFN
- `jina-bert-v2`: ALiBi encoder with optional Q/K norms, optional second
attention norm, and fused/separate GeGLU

All four use a dedicated GGUF feature-extraction task supporting `NONE`,
`MEAN`, and `CLS` pooling. Tensor closure and shape validation are
fail-closed. Quantized import is rejected until complete fused/split
packed-weight routes exist; runtime packaging remains deferred pending
representative real-weight evidence.

## Authoritative evidence

- llama.cpp pin: `8d9af256337d1a501250f9bbf4c0859a654bddd6`
- HF config pins:
  - `EuroBERT/EuroBERT-210m@39b51e15dd1f1a06f58b5cbf6a8a188cec60bd0e`
  - `chandar-lab/NeoBERT@5424c8efeea6491b151d62dee55a752165407430`
-
`nomic-ai/nomic-embed-text-v1.5@e9b6763023c676ca8431644204f50c2b100d9aab`
-
`jinaai/jina-embeddings-v2-small-en@44e7d1d6caec8c883c2d4b207588504d519788d0`

Tests cover tiny graph construction, pinned config transforms, exact
tensor mapping/closure, contiguous NeoBERT QKV and interleaved RoPE,
tanh GeGLU, FP16/BF16 Jina ALiBi graph loading, pooling ABI, left-padded
CLS value selection, and float-only quantization policy.

## Residual deferred architectures

- `jina-bert-v3`: released artifacts require adapter handling; MoE
scheduling is not covered
- `nomic-bert-moe`: encoder MoE schedule/experts remain unsupported
- `talkie`: dedicated gain/skip/logit-scale graph and value transforms
required
- `wavtokenizer-dec`: requires a code-token-to-ISTFT-feature task and
waveform processor
- `rwkv6`, `rwkv6qwen2`, `rwkv7`, `arwkv7`: token-shift plus
matrix-state ABI is not KV/Mamba state
- `bailingmoe3`: mixed KDA convolution/matrix state plus MLA cache
- `deepseek4`: compressed cache/history/rollback ABI is not represented
by the fallback graph
- `pockettts`, `qwen3tts`: primary GGUFs require mandatory sidecar
bundles and non-text orchestration

## Validation

- Shared registry/build/task/runtime/docs/coverage suite before the
formatter-only follow-up: **4146 passed, 284 skipped, 16 deselected**
- Directly affected conventional decoder/docs tests after formatting:
**53 passed**
- Broad non-integration suite before the formatter-only follow-up:
**7983 passed, 57 skipped**
- Generated GGUF docs: exact generator output
- Full initialized `lintrunner f --output oneline --all-files`: success
and zero worktree changes after commit `4e1059eb`
- GPT-5.6 Sol medium review of the formatter-only follow-up: clean;
semantic equivalence confirmed
- Exact base: `3b2c9cd624c5f1e58a5948fb7e6af6453ea64ff2` (#635)
- Head: `4e1059eb6516ba40d7e059a799ab47d1f420835e`

The post-format monolithic shared rerun was attempted twice, but the
host dropped to 100–115 MiB free and pytest could no longer create
temporary files (`FileNotFoundError: No usable temporary directory`;
OpenMP `/tmp` allocation failures). The formatting-only affected tests
pass, and the identical shared suite passed immediately before the
semantic no-op formatting commit.

## Waivers

- Generic L2/L4/L5: the four registered module types are GGUF-only and
have no native HF `model_type` route. Pinned HF-to-GGUF config semantics
and synthetic ORT parity are covered by `_specialized_encoders_test.py`;
misleading generic `test_model_id` claims are intentionally omitted.
- Real-weight runtime generation: these are encoder-only GGUF routes and
runtime support remains explicitly deferred; no runtime capability is
claimed.
- Quantized parity/Olive: packed fused/split projection ownership is
intentionally rejected, not silently dequantized under
`keep_quantized=True`.
- Exact-main coverage baseline: `kimi_k3` and `lfm2_moe` already have
test IDs without YAML cases on #635; the shared run excludes those two
cases and their aggregate sentinel. Specialized coverage checks pass.
- Existing SmolLM OGA 0.15.2 evidence probe has a baseline route-hash
mismatch (`3ca3…` produced vs `b999…` pinned) that reproduces unchanged
on untouched #630; this branch preserves the baseline route fingerprint
and does not update evidence.

---------

Signed-off-by: Justin Chu <[email protected]>
Copilot-Session: c9f552d7-041b-482e-b1a6-7227d980ed5f
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.

2 participants