Skip to content

Add Inkling Q2 staged runtime and certify text split serving - #1017

Closed
michaelneale wants to merge 67 commits into
mainfrom
codex/inkling-q2-skippy
Closed

Add Inkling Q2 staged runtime and certify text split serving#1017
michaelneale wants to merge 67 commits into
mainfrom
codex/inkling-q2-skippy

Conversation

@michaelneale

@michaelneale michaelneale commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What this PR adds

  • Inkling architecture, tensor, tokenizer, multimodal-projector, and appended MTP metadata support in the patched llama.cpp/Skippy runtime.
  • Q2 layer-package and Hugging Face publication automation.
  • F32 staged activation-wire and F16 K/V family defaults.
  • Stage-wire v11 for the Inkling sideband additions; older stage binaries fail closed instead of decoding the changed layout.
  • Multi-device balancing for filtered layer-package stages, so a stage assigned to a dual-GPU host uses both devices.
  • Generic split hardening found during certification: package-size-aware stage preparation timeouts, retry of source-preparation timeouts, complete-chain prefix-restore accounting, request-local N-gram bypass after a distributed restore, and exact recurrent-session position tracking after a backwards restore.

Current support claim

This PR has now run real Inkling Q2 text inference across a three-stage mixed Metal/CUDA mesh. The certified live shape is:

Stage Host Layers
0 / coordinator Vast, 2 x RTX PRO 6000 Blackwell 0..39
1 Apple M5 Max 39..59
2 / logits Vast, RTX PRO 6000 Blackwell 59..66 + output

Fixed test settings: ctx=8192, one lane, F32 activation wire, F16 K/V, and meshllm/inkling-UD-Q2_K_XL-layers@9b4b91a7ddd978dd7a01679bc977f6e53777f2c7.

All stage traffic used the normal Iroh/QUIC mesh data path. Typical direct-path RTTs in the final runs were about 10–15 ms between the M5 and coordinator and 4–6 ms between the two Vast stages, with occasional larger spikes.

This is a text split-serving claim for this Q2 artifact and configuration. It is not yet a claim of tool-use, multimodal, live MTP, full native-context, multi-lane, Q8-wire, or DFlash certification.

Evidence on current head 19653da2

End-to-end text and cache stability

  • Four alternating 3,531/3,532-token prompts with 128-token limits all returned HTTP 200 and the topology remained available.
  • A following exact replay returned the expected KV-PIN-8842, reported cached_tokens=3532, and completed in 2.718 s.
  • OTLP recorded a full-chain restore (hit_stage_mask=7) to token 3,538 after the lane had previously advanced to a longer state. This is the live regression proof for the recurrent-position fix: the old code retained the previous high-water position and failed the next divergent llama_decode; the current code moves the tracked position back to the imported state.
  • No llama_decode failed, binary-stage disconnect, or topology loss occurred in the fixed sequence.

Exact replay is healthy. Arbitrary same-length shared-prefix reuse is not yet certified: the maintained same-prefix probe failed its semantic assertion because Q2 omitted KV-PIN-8842, and the custom alpha/beta/gamma variants reported cached_tokens=0 because stage 0 missed the shared prefix. That is recorded as a remaining cache limitation, not described as a pass.

N-gram latency hiding

The same three-stage topology was tested with standalone suffix N-gram speculation:

Configuration Workload Decode result
proposal cap 4, verify max 4, depth 4 96-token repeated JSON/tool-shaped completion 10.79 tok/s
proposal cap 48, verify max 32, depth 4 same uncached reference prompt 20.31 tok/s
proposal cap 48, verify max 32, depth 4 fresh Melbourne variant 15.45 tok/s
proposal cap 48, verify max 32, depth 4 fresh fully accepted Brisbane variant 120.00 tok/s
proposal cap 48, verify max 32, depth 4 repeated Rust function copy 49.14 tok/s
proposal cap 48, verify max 32, depth 4 agent history with tool output, then source reproduction 15.67 tok/s
proposal cap 48, verify max 32, depth 4 novel Rust iterator control 9.38 tok/s

The reference deep run accepted 72 N-gram tail tokens, opened five verify windows, and reached three windows in flight. The repeated-Rust and tool-output cases accepted 64/90 and 32/90 proposals respectively; the novel control accepted 0/90 and stayed below 10 tok/s. N-gram is therefore a real latency-hiding win for repeated/copy/tool-output text, not a universal speed guarantee.

The performance result does not erase Q2 output quality limits. The repeated-Rust response reproduced the requested function, while the agent/tool-output response changed the iterator range and violated the supplied test contract. Throughput and semantic correctness are reported separately.

A subsequent 12-request uncached soak alternated unique repeated-JSON and novel ring-buffer prompts. All 12 returned HTTP 200 with no stage failure. Repeated prompts had median 35.86 tok/s (21.91–46.11); novel prompts had median 14.92 tok/s (8.55–19.21). Every request reported cached_tokens=0, so this was generation/latency-hiding stability rather than exact replay. The soak did not score semantic quality.

Build and test gates

  • MESH_LLM_DYNAMIC_NATIVE_RUNTIME=0 just release-build
  • fresh Linux CUDA SM120 patch application and MESH_LLM_DYNAMIC_NATIVE_RUNTIME=0 MESH_LLM_BUILD_PROFILE=release just build-runtime cuda 120
  • cargo fmt --all --check
  • cargo test -p skippy-server --lib — 343 passed
  • cargo test -p mesh-llm-host-runtime --lib — 1,860 passed, 8 ignored
  • warning-denying Clippy for skippy-server, mesh-llm-host-runtime, and mesh-llm
  • cargo check -p skippy-server and cargo check -p mesh-llm

Artifact-side evidence remains available from the earlier jobs:

Explicitly not proven

  • Tool calls: a forced 512-token tool request returned HTTP 200 but no structured tool_calls; the Q2 output was malformed tool-like text. Tool use fails this certification.
  • Image/audio generation: projector attachment is tested, but no successful live split image or audio generation is claimed.
  • Native Inkling MTP: sidecar attachment primitives are tested, but no live split MTP run is claimed. The frontend/final-stage placement relationship still needs an operational design and test.
  • Full context: Inkling advertises a 1,048,576-token native context; live distributed testing here used ctx=8192 with prompts up to roughly 3.5k tokens.
  • Concurrency: one lane is the supported test shape. Four lanes produced unacceptable 432–518 s behavior; overload with one lane returned controlled 429s and recovered.
  • Other data formats: F16 activation wire changed routing/logits in earlier tests, Q8 activation wire was not tested, and DFlash was not tested. The proven combination is F32 activation wire plus F16 K/V.
  • Clean Metal teardown: after model_unloaded, one M5 SIGINT shutdown ended in the upstream ggml_metal_device_free resource-set assertion. Serving was already stopped. The generic hosted-stage drain work and required M5 proof are tracked explicitly in Drain hosted Skippy stages before Metal backend teardown #1103; this PR does not claim clean shutdown behavior.

Review and merge posture

The branch is mergeable and CI is running. The intended merge claim is Inkling Q2 text split serving plus the architecture/package plumbing above. Tool use, multimodal generation, live MTP, full native context, multi-lane serving, shared-prefix variants, and the Metal teardown assertion remain visible follow-ups rather than implied successes.

Before leaving draft:

  1. CI must finish green on 19653da2.
  2. Review the new recurrent-restore, chain-restore, timeout, and filtered multi-device changes.
  3. Keep the generic Metal teardown follow-up in Drain hosted Skippy stages before Metal backend teardown #1103 visible in review and release notes.

Related latency-hiding evidence and follow-up are tracked in #1025.

@i386 @ndizazzo Please review the current, narrowed support claim and the generic fixes found by the live three-stage run.

Summary by CodeRabbit

  • New Features

    • Added Inkling model support, including multimodal vision/audio inputs, multi-depth MTP, projector handling, and improved staged execution.
    • Added experimental model packaging with projector discovery, source revision tracking, and experimental catalog publishing.
    • Added projector and MTP attachment validation commands.
    • Added configurable split networking, capacity reporting, coordinator election, and improved mesh connection handling.
    • Added support for Q2_0 quantization and richer GGUF metadata.
  • Bug Fixes

    • Improved cache sizing, session cleanup, speculative decoding, verification-state restoration, and dynamic request timeouts.
    • Preserved multimodal token data and applied reasoning defaults more consistently.
  • Documentation

    • Updated packaging, certification, onboarding, CLI, and relay infrastructure documentation.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds Inkling model conversion and native execution support, including multimodal projectors, MTP sidecars, activation payloads, split-runtime coordination, package inventory metadata, validation commands, server transport updates, capability records, and certification documentation.

Changes

Inkling packaging and conversion

Layer / File(s) Summary
Package inventory and experimental publishing
crates/model-package/..., crates/mesh-llm-commands/..., crates/mesh-llm-cli/...
Package jobs now resolve immutable revisions, discover projector sidecars, account for projector sizes, propagate experimental metadata, and expose --experimental.
GGUF and tokenizer conversion
crates/skippy-quantize/..., crates/model-artifact/...
Inkling metadata, tokenizer handling, per-layer KV heads, Q2_0 quantization, tensor remapping, and fused MTP tensor streaming are supported.
Validation and automation
crates/skippy-correctness/..., scripts/hf-skippy-*.py
Stage FlashAttention parity, projector validation, MTP attachment validation, conversion, certification, and upload workflows are added.

Mesh runtime and server execution

Layer / File(s) Summary
Capacity and split coordination
crates/mesh-llm-host-runtime/src/mesh/..., runtime/..., crates/skippy-coordinator/...
Local runtime capacity, dynamic split thresholds, participant settling, canonical coordinator election, stage-0-constrained planning, source preparation timeouts, retry classification, and connection draining are implemented.
Native runtime integration
third_party/llama.cpp/patches/0048-*.patch through 0060-*.patch
llama.cpp gains Inkling architecture execution, staged layers, MTP sidecars, multimodal embeddings, recurrent checkpoint restoration, and filtered-stage device balancing.
Transport and frontend behavior
crates/skippy-server/..., crates/skippy-runtime/..., crates/skippy-protocol/..., crates/skippy-ffi/...
Downstream readiness handshakes, orphan session reclamation, dynamic timeouts, reasoning defaults, speculative decoding adjustments, media token forwarding, ABI updates, and Inkling activation sidebands are added.

Capability records and documentation

Layer / File(s) Summary
Inkling capability and operational documentation
crates/skippy-topology/..., docs/..., website/..., tools/relay-fly-legacy/...
Inkling family capability data, certification requirements, package usage documentation, relay documentation, and HF job guidance are updated.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested labels: experimental

Suggested reviewers: ndizazzo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: Inkling Q2 staged runtime work and certified text split serving.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/inkling-q2-skippy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request is currently a draft. Reviews will not take place until the PR is marked as ready for review.

@michaelneale

Copy link
Copy Markdown
Collaborator Author

Placement dependency: this Inkling work should follow the final-stage native-MTP placement and exact-byte planning work in #938 rather than introduce a separate placement path. In particular, the external 15.5 GB Inkling sidecar should be charged to and loaded by the final/logits-owning stage, with Q2 layer allocation adjusted around that fixed cost. We will keep #1017 in draft and wait for #938 to settle before finalizing this integration. @i386 please flag any manifest, planner, or stage-load interfaces here that should align with the GLM work.

@michaelneale

Copy link
Copy Markdown
Collaborator Author

Test plan (how I'll validate this once it's ready to try)

Recording the intended plan of attack so it's clear how Inkling Q2 + MTP will be
exercised beyond the CPU-XL artifact certification.

Topologies (box mixture + latency regimes)

Inkling Q2 is large, so it must split. I'll validate across three latency
regimes, cheapest/lowest-risk first:

  1. Single big box (baseline / no split). One high-VRAM GPU box, model whole
    if it fits, else minimal split on one host. Establishes the correctness +
    solo throughput ceiling and proves artifact load + MTP attach + multimodal
    handoff on a real GPU (not just CPU-XL).
  2. LAN split (sub-ms RTT). Two/three GPU hosts on the same LAN. This is the
    regime where MTP should actually shine — high acceptance at a large window
    amortized over near-zero-latency hops. Primary throughput + acceptance run.
  3. WAN split (~20-25ms RTT). Coordinator + remote GPU worker across the
    internet. Stress test: does native MTP hold up acceptance well enough to beat
    no-speculation over WAN (where ngram does not — see Enable adaptive verify window for ngram/draft speculation #1023 findings). This is
    the real bar for distributed Inkling.

Mixed backends will be covered too (Metal coordinator + CUDA worker) since that
is a normal real-world split shape.

Steps per topology

  1. Build the branch identically on all nodes; verify commit parity (not version
    string).
  2. Bring the split up with the product --split path; confirm the planner
    places all layers incl. the 8 appended MTP layers and reaches serving/ready.
  3. Correctness first: text generation, then image, then audio — confirm coherent
    output across the split before any perf claims.
  4. Speculation A/B with acceptance telemetry (metrics-server on coordinator):
    MTP off vs native MTP vs MTP+ngram. Capture accept rate, window behaviour,
    early-reject/recovery counters, tok/s.
  5. Recovery/robustness: kill the worker mid-generation, confirm fast-fail and
    clean recovery; restart coordinator, confirm the split re-forms.
  6. Record tok/s vs the solo ceiling and the per-hop latency floor for each
    regime; note where MTP acceptance keeps enough tokens-per-round-trip to win.

What "good" looks like

  • Correct multimodal output across a real GPU split (not just artifact load).
  • Native MTP beats no-MTP on LAN by a clear margin (high acceptance, large
    committed window).
  • On WAN, native MTP at least holds parity or better vs no-speculation — the
    thing ngram could not do. That is the key result that makes distributed
    Inkling worthwhile.

Happy to run this once the draft is far enough along; will report evidence
(topology, RTT, acceptance, tok/s) rather than just artifact certification.

michaelneale and others added 6 commits July 22, 2026 19:36
…ex/inkling-q2-skippy

Conflict resolution notes:
- llama.cpp patch queue: renumbered Inkling patches 0017-0023 to 0022-0028
  after main's 0018-0021 (ngram cache ABI, checkpoint removal, MTP re-prime,
  ngram confidence fix). SKIPPY_FEATURE_INKLING_MTP_MM moved 1<<26 -> 1<<27
  (main took 1<<26 for FEATURE_NGRAM_CACHE_DRAFT); ABI patch bumped 31 -> 32
  in patch 0027 and the skippy-ffi mirror.
- skippy-topology: inkling family expectation moved into main's new
  family_capability.rs.
- skippy-runtime: multimodal text-chunk token capture re-applied to main's
  extracted media.rs/types.rs.
- model-artifact: per-layer kv_head_counts pricing ported into main's new
  gguf/kv_cache.rs (glm-dsa absorbed-MLA case preserved).
- skippy-quantize: branch's tensor_stream.rs folded into gguf_writer.rs
  (AlternatingRows joined main's TensorTransform in glm_dsa.rs); Q2_0 now
  FFI-supported so the pinned-catalog test exemption is removed.
- host-runtime: audio+vision projector evidence helper re-applied to main's
  restructured local.rs and local_split/loading.rs.
Rebased patches 0022-0028 onto main's 0018-0021 (ngram cache ABI,
checkpoint removal, MTP re-prime, ngram confidence fix) so the full
queue applies cleanly:
- Replay-multi-depth-MTP hunk re-anchored around main's chain_heads
  sync path in skippy_mtp_sync_target_tokens.
- SKIPPY_FEATURE_INKLING_MTP_MM moved to 1<<27 next to main's
  NGRAM_CACHE_DRAFT (1<<26); abi_features advertises both.
- ABI patch 31 -> 32 (mirrored in skippy-ffi).

Full just build (prepare + patch queue + native ABI + UI + binary)
passes end-to-end.
- parser.rs test module: import Command and ModelsCommand (the merge left
  the new experimental-publication test without them).
- CLI.md: document the models package --experimental flag so the
  cli-docs-sync gate sees the CLI surface change reflected in public docs.
Standalone N-gram plans (no native MTP) ran the serial propose->send->wait->commit
loop, one verify window per round trip, regardless of verify_window_pipeline_depth.
The composite verify-window pipeline machinery already handles pure-N-gram proposals
(native_mtp_token_count == 0), so route standalone drafting through it.

- NativeMtpDecodeOptions gains ngram_proposals_enabled (the provider should produce
  N-gram tokens for a standalone plan as well as an MTP composite), and
  ngram_max_proposal_tokens now falls back to the proposer's own limit when there is
  no extension policy. CompositeProposalProvider keys `enabled` off the new flag.
- embedded_generation enables the pipeline for a standalone N-gram plan at
  verify_window_pipeline_depth > 1 (standalone_ngram_pipelining), while the single
  native-MTP verify-window path stays composite-only. The serial block is gated off
  when the pipeline is active so a request is drafted by exactly one path; depth 1
  keeps the proven serial path.

Opt-in: default depth is 1 (serial, unchanged). Pipelining trades extra speculative
work for latency hiding, so it only pays off at high RTT; on loopback it is pure
overhead. Local 2-stage split confirms the mechanism engages: at depth 3,
verify_window_max_in_flight goes 0 -> 3 and occupancy_parallel_fraction 0 -> 0.81
on a standalone suffix re-emit, output correct, accept 0.92. WAN-lab RTT sweep is
the remaining performance validation before this is worth turning on by default.
@michaelneale

Copy link
Copy Markdown
Collaborator Author

🤖 The streaming "empty deltas" issue is not a streaming bug and not from this branch.

Reproduced locally on Qwen3-0.6B (different model family, no GPU needed):

  • stream + enable_thinking=false → correct token-by-token deltas
  • stream without it → role chunk, then finish_reason:length, zero content deltas
  • non-stream, same requestcontent: null and reasoning_content: null, predicted_n=60

60 tokens were generated and dropped on both paths, so the streaming layer is fine. The chat-output parser returns nothing when a thinking model hits max_tokens mid-reason. reasoning_format auto/deepseek/none all behave identically.

Not introduced here: git diff origin/main...HEAD over parsing.rs, prompting.rs, streaming.rs is empty, patch 0011 is content-identical to main's copy, and it reproduces on a non-Inkling model. I did not A/B against a main-built binary, so "pre-existing" is inferred from the untouched diff plus the cross-family repro rather than a direct run.

Reclassifying as a pre-existing parser bug affecting any thinking model that exhausts its budget mid-reason. Filing separately against main; not a blocker for this PR.

* origin/main:
  Hand npm publishing to mesh-packaging
  feat(runtime): add daemon model lifecycle reconciliation (#1082)
  Accept bounded external token proposals in local Skippy generation (#1081)
  Expose target-authoritative local generation receipts (#1080)

# Conflicts:
#	crates/mesh-llm-host-runtime/src/runtime/model_lifecycle.rs
* origin/main:
  fix: use published mesh-llm-hf-hub crate (#1096)
@michaelneale michaelneale changed the title Add Inkling Q2 multimodal and MTP support Add Inkling Q2 staged runtime and certify text split serving Jul 28, 2026
@michaelneale
michaelneale marked this pull request as ready for review July 28, 2026 20:42
@michaelneale

Copy link
Copy Markdown
Collaborator Author

Ready for review at 19653da2; all required CI checks are green.

The merge claim is deliberately narrow: Inkling Q2 text generation ran through a real three-stage M5 Metal + Australian Vast CUDA topology over Iroh/QUIC. The completed 12-request mixed-workload soak was 12/12 HTTP 200 with no stage failure. Deep suffix N-gram reached a 35.86 tok/s median on repeated/copy-shaped requests and 14.92 tok/s on novel controls; it is effective latency hiding for repetition, not a universal speedup.

This does not claim production tool-call quality, multimodal generation, native Inkling MTP, the full 1,048,576-token context, multi-lane serving, arbitrary shared-prefix cache hits, or clean Metal shutdown. The generic hosted-stage teardown failure is tracked in #1103. The PR body contains the complete evidence and limits.

@i386 @ndizazzo, review of the Inkling architecture/patch queue and staged recurrent-state handling would be particularly useful.

@coderabbitai coderabbitai 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.

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/mesh-llm-host-runtime/src/models/capabilities.rs (1)

81-98: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Downgrade audio capability when the audio projector is absent.

audio_projector_loaded comes from the same GGUF projector scan used for vision, but the verified-capability path only demotes vision when its projector is missing. When audio_projector_loaded is false, a static name/config signal for audio: Supported is preserved, so advertise only the audio capability actually present in the loaded projector.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mesh-llm-host-runtime/src/models/capabilities.rs` around lines 81 -
98, Update runtime_verified_capabilities_from_static to explicitly set
caps.audio to CapabilityLevel::None when evidence.audio_projector_loaded is
false, while preserving the existing multimodal consistency behavior and
promoting audio when the projector is loaded. Ensure static audio signals cannot
survive verification without the corresponding projector.
🧹 Nitpick comments (7)
crates/mesh-llm-host-runtime/src/inference/skippy/resolver/resolution.rs (1)

240-241: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider importing FamilyPolicy instead of repeating the super::super::family_policy::FamilyPolicy path.

Both resolve_cache_type_k and resolve_cache_type_v spell out the full relative path for the type. A use at the top of the file (or a local type alias) would be more readable and easier to keep in sync if the module ever moves.

♻️ Suggested cleanup
-fn resolve_cache_type_k(
-    context: &ResolverContext<'_>,
-    kv: &KvDefaults,
-    kv_policy: KvCachePolicy,
-    family_policy: &super::super::family_policy::FamilyPolicy,
-) -> String {
+fn resolve_cache_type_k(
+    context: &ResolverContext<'_>,
+    kv: &KvDefaults,
+    kv_policy: KvCachePolicy,
+    family_policy: &FamilyPolicy,
+) -> String {

(with use super::super::family_policy::FamilyPolicy; added near the top of the file, applying the same change to resolve_cache_type_v and resolve_model_fit_config.)

Also applies to: 270-271

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mesh-llm-host-runtime/src/inference/skippy/resolver/resolution.rs`
around lines 240 - 241, Import FamilyPolicy near the top of the module, then
replace the repeated super::super::family_policy::FamilyPolicy paths in
resolve_cache_type_k, resolve_cache_type_v, and resolve_model_fit_config with
the imported type.
crates/skippy-server/src/binary_transport/binary_messaging/connection.rs (1)

198-219: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Bundle the parameters instead of silencing the lint.

The split into handle_binary_connection_messages pushed the signature to 20 parameters and required a bare #[allow(clippy::too_many_arguments)] with no justification. Group the invariant transport/telemetry knobs (activation_width, wire_dtype, max_inflight, reply_credit_limit, async_prefill_forward, downstream_wire_condition, downstream_connect_timeout_secs, native_mtp_enabled) into a context struct, or at minimum document why the allow is needed.

As per coding guidelines: "do not use #[allow(...)] to silence warnings without a clear reason and developer approval".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/skippy-server/src/binary_transport/binary_messaging/connection.rs`
around lines 198 - 219, Remove the unjustified
#[allow(clippy::too_many_arguments)] from handle_binary_connection_messages by
grouping the invariant transport and telemetry parameters into a dedicated
context struct and passing that struct to the function. Update the call sites
and field accesses for activation_width, wire_dtype, max_inflight,
reply_credit_limit, async_prefill_forward, downstream_wire_condition,
downstream_connect_timeout_secs, and native_mtp_enabled, preserving their
existing values and behavior.

Source: Coding guidelines

crates/skippy-topology/src/tests.rs (1)

953-965: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise the new fallback inference path separately.

This identity is the newly added reviewed JSON record, so infer_family_capability can return before reaching the Inkling branch in family_capability.rs at Lines [1109-1111]. Add a second identity absent from the reviewed catalog to verify inkling_capability itself and catch regressions in the new fallback path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/skippy-topology/src/tests.rs` around lines 953 - 965, Extend the
Inkling tests around infer_family_capability with a second, unreviewed identity
that is absent from the reviewed catalog, ensuring it reaches and validates
inkling_capability directly. Keep the existing reviewed JSON record assertions
unchanged, and verify the fallback result’s family, wire dtype, validation,
state mobility, and recurrent range behavior.
crates/mesh-llm-host-runtime/src/runtime/local.rs (1)

520-520: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Clarify vram_bytes as local-fit capacity in the planner docs.

local_runtime_capacity_bytes() is a broader local budget that may include CPU offload memory, while vram_bytes is documented as accelerator-resident capacity. Since this path can pass the former to RuntimeResourcePlanInput, update the planner docs or introduce a separate input for CPU-aware budgeting so future callers don’t misuse accelerator VRAM planning for CPU-inclusive capacity.**

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mesh-llm-host-runtime/src/runtime/local.rs` at line 520, Clarify the
planner contract around RuntimeResourcePlanInput.vram_bytes and the local.rs
fallback using local_runtime_capacity_bytes(): document that vram_bytes must
represent accelerator-resident capacity, or introduce a distinct CPU-aware
capacity input for the broader local budget. Ensure callers cannot treat
CPU-inclusive local capacity as VRAM capacity.
crates/model-package/src/bin/queue-unsloth-layer-packages.rs (2)

792-799: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Two implementations of source-total sizing with different overflow semantics. The planning path saturates while the job-spec path errors, so an overflow would produce a plan and a spec that disagree — and the duplication invites drift as projector accounting evolves.

  • crates/model-package/src/bin/queue-unsloth-layer-packages.rs#L792-L799: make candidate_source_total_bytes the single source of truth (returning Result<u64> with the checked arithmetic and overflow context).
  • crates/model-package/src/bin/queue-unsloth-layer-packages.rs#L1100-L1111: replace the inline try_fold/checked_add block with a call to candidate_source_total_bytes(candidate)?.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/model-package/src/bin/queue-unsloth-layer-packages.rs` around lines
792 - 799, Update candidate_source_total_bytes to return Result<u64>, use
checked arithmetic for quant and projector totals, and preserve the existing
overflow context in its error. In
crates/model-package/src/bin/queue-unsloth-layer-packages.rs:792-799, make this
function the single sizing implementation; at
crates/model-package/src/bin/queue-unsloth-layer-packages.rs:1100-1111, replace
the inline try_fold/checked_add logic with
candidate_source_total_bytes(candidate)?.

690-698: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Avoid expect on a cross-function invariant.

The pipeline tag is only guaranteed by model_split_compatibility ~180 lines away; a future compatibility branch that doesn't require a tag turns this into a panic in unattended queue automation. Prefer the same skip path used just above.

♻️ Skip instead of panicking
-    let source_pipeline_tag =
-        model_pipeline_tag(&source_info).expect("compatible model must have a pipeline tag");
+    let Some(source_pipeline_tag) = model_pipeline_tag(&source_info) else {
+        eprintln!("skip {}: source repo info has no pipeline tag", model.repo_id);
+        return Ok(None);
+    };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/model-package/src/bin/queue-unsloth-layer-packages.rs` around lines
690 - 698, Replace the expect call on model_pipeline_tag in the package queue
flow with an Option-aware skip path matching the source_revision branch above.
When no pipeline tag is returned, log an appropriate skip message including
model.repo_id and return Ok(None); preserve the existing tag-based processing
for Some values.
crates/skippy-quantize/src/gguf_writer.rs (1)

431-441: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document the forced-F32 override.

The override silently ignores output_type for attn_rel_proj.weight and .shortconv_ tensors. A one-line comment stating the runtime requirement would keep future dtype work from "fixing" this.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/skippy-quantize/src/gguf_writer.rs` around lines 431 - 441, The forced
F32 branches in target_dtype_for_mapped_tensor must be documented with a
one-line comment explaining the runtime requirement and that they intentionally
override output_type. Add the comment immediately before the mapped-name
condition without changing the existing dtype behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/mesh-llm-commands/src/model_package.rs`:
- Around line 197-199: The submit JSON payload in the model package command must
include the same experimental release-channel flag reported by the dry-run
payload. Update the payload construction near sourceRevision, sourceFile, and
projectors to add the existing experimental value under the "experimental"
field, preserving the current dry-run behavior.

In `@crates/mesh-llm-host-runtime/src/mesh/direct_path.rs`:
- Around line 223-241: Update record_draining_replaced_connection to reuse the
bounded drain-and-close helper used by remember_incoming_connection instead of
only logging the replacement. Expose that helper from connections.rs with crate-
or module-level visibility, then invoke it for the existing connection so
retained stream/dispatch clones receive an explicit terminal close after the
configured grace period; preserve the current logging context.

In `@crates/mesh-llm-host-runtime/src/runtime/local_package.rs`:
- Around line 445-472: Update collect_split_participant_membership to apply
split_peer_stage_path_exclusion_reason alongside
split_peer_preflight_exclusion_reason when evaluating each peer. Record
stage-path rejections in excluded and omit those peers from participants,
keeping the membership snapshot’s eligibility consistent with
collect_split_participants and topology planning.

In `@crates/mesh-llm-host-runtime/src/runtime/local.rs`:
- Around line 621-623: Update the startup paths in the async functions around
runtime_media_capability_evidence (including both direct-GGUF and layer-package
flows) to execute the projector metadata scan through
tokio::task::spawn_blocking. Await the blocking task and preserve the existing
capability evidence result and error handling while ensuring
scan_gguf_projector_meta does not run on Tokio worker threads.

In `@crates/skippy-correctness/src/runner/stage_fa_parity.rs`:
- Around line 9-48: Guard stage_fa_parity against invalid comparison ranges and
payloads before computing parity metrics. Validate that the decoded activation
range is non-empty and that enabled_values and disabled_values have equal,
nonzero lengths; return an error otherwise. Update the comparison flow around
decode_boundary, payload_f32, and the RMS calculation so tolerance checks only
run for valid matching data.

In `@crates/skippy-quantize/src/projector_validate.rs`:
- Around line 39-51: Update the projector validation flow around
mtmd_init_from_file to load and pass a valid llama_model pointer as its
text_model argument instead of std::ptr::null(). Ensure the model is initialized
before the call and properly released afterward, while preserving the existing
null-result validation and projector cleanup behavior.

In `@crates/skippy-quantize/src/tokenizer_metadata.rs`:
- Around line 287-296: Update the inkling_mm_model branch in tokenizer metadata
conversion to accept config.eos_token_id only when it meets the reference
converter’s minimum floor of 199998; otherwise fall back to 200006. Apply this
validated EOS value consistently to both tokenizer.ggml.eos_token_id and
tokenizer.ggml.bos_token_id while preserving the existing metadata flags and
return flow.

In `@crates/skippy-server/src/binary_transport/stage_execution.rs`:
- Around line 79-89: Update the stage execution retry loop and
take_warm_or_connect_downstream to pass the current remaining Duration into
connection establishment, then recompute remaining time after connecting before
calling complete_downstream_ready so all connect and handshake work shares the
absolute deadline. Preserve timeout and retry behavior, and add a regression
test covering a one-second configured timeout to verify the overall wait does
not exceed the deadline, including retry sleep.

In `@scripts/hf-skippy-mtp-certify-job.py`:
- Around line 22-36: Update ensure_build_tools to check shutil.which("apt-get")
before invoking apt-get, matching the guard in hf-skippy-convert-job.py. Raise
the same clear error when apt-get is unavailable, while preserving the existing
dependency detection and installation flow.
- Around line 73-83: Update projector_path to parse and validate
args.projector_url before calling urllib.request.urlopen, allowing only HTTP and
HTTPS schemes and rejecting all others before creating or writing the temporary
projector file.

In `@third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch`:
- Around line 2032-2034: Remove the out-of-bounds memcpy writing rel_extent in
the operation setup near ggml_set_op_params; rely on rel->ne[0] or
rel_logits->ne[0] for the banded attention paths, preserving the existing scale
parameter initialization.

In
`@third_party/llama.cpp/patches/0053-Restore-recurrent-verify-window-state.patch`:
- Around line 194-201: Guard the accepted_count > 0 branch in the checkpoint
verification flow before calling skippy_decode_tokens: validate that
checkpoint.token_ids is non-empty, and explicitly fail using the existing
out_error/status mechanism when it is empty. Only pass
checkpoint.token_ids.data() with a positive count when the vector contains the
required tokens.

In `@tools/relay-fly-legacy/README.md`:
- Around line 10-13: Update the four relay URLs in the README table to remove
the trailing dot after “iroh.link”, changing each hostname from “iroh.link.” to
“iroh.link” while preserving the rest of every endpoint.

---

Outside diff comments:
In `@crates/mesh-llm-host-runtime/src/models/capabilities.rs`:
- Around line 81-98: Update runtime_verified_capabilities_from_static to
explicitly set caps.audio to CapabilityLevel::None when
evidence.audio_projector_loaded is false, while preserving the existing
multimodal consistency behavior and promoting audio when the projector is
loaded. Ensure static audio signals cannot survive verification without the
corresponding projector.

---

Nitpick comments:
In `@crates/mesh-llm-host-runtime/src/inference/skippy/resolver/resolution.rs`:
- Around line 240-241: Import FamilyPolicy near the top of the module, then
replace the repeated super::super::family_policy::FamilyPolicy paths in
resolve_cache_type_k, resolve_cache_type_v, and resolve_model_fit_config with
the imported type.

In `@crates/mesh-llm-host-runtime/src/runtime/local.rs`:
- Line 520: Clarify the planner contract around
RuntimeResourcePlanInput.vram_bytes and the local.rs fallback using
local_runtime_capacity_bytes(): document that vram_bytes must represent
accelerator-resident capacity, or introduce a distinct CPU-aware capacity input
for the broader local budget. Ensure callers cannot treat CPU-inclusive local
capacity as VRAM capacity.

In `@crates/model-package/src/bin/queue-unsloth-layer-packages.rs`:
- Around line 792-799: Update candidate_source_total_bytes to return
Result<u64>, use checked arithmetic for quant and projector totals, and preserve
the existing overflow context in its error. In
crates/model-package/src/bin/queue-unsloth-layer-packages.rs:792-799, make this
function the single sizing implementation; at
crates/model-package/src/bin/queue-unsloth-layer-packages.rs:1100-1111, replace
the inline try_fold/checked_add logic with
candidate_source_total_bytes(candidate)?.
- Around line 690-698: Replace the expect call on model_pipeline_tag in the
package queue flow with an Option-aware skip path matching the source_revision
branch above. When no pipeline tag is returned, log an appropriate skip message
including model.repo_id and return Ok(None); preserve the existing tag-based
processing for Some values.

In `@crates/skippy-quantize/src/gguf_writer.rs`:
- Around line 431-441: The forced F32 branches in target_dtype_for_mapped_tensor
must be documented with a one-line comment explaining the runtime requirement
and that they intentionally override output_type. Add the comment immediately
before the mapped-name condition without changing the existing dtype behavior.

In `@crates/skippy-server/src/binary_transport/binary_messaging/connection.rs`:
- Around line 198-219: Remove the unjustified
#[allow(clippy::too_many_arguments)] from handle_binary_connection_messages by
grouping the invariant transport and telemetry parameters into a dedicated
context struct and passing that struct to the function. Update the call sites
and field accesses for activation_width, wire_dtype, max_inflight,
reply_credit_limit, async_prefill_forward, downstream_wire_condition,
downstream_connect_timeout_secs, and native_mtp_enabled, preserving their
existing values and behavior.

In `@crates/skippy-topology/src/tests.rs`:
- Around line 953-965: Extend the Inkling tests around infer_family_capability
with a second, unreviewed identity that is absent from the reviewed catalog,
ensuring it reaches and validates inkling_capability directly. Keep the existing
reviewed JSON record assertions unchanged, and verify the fallback result’s
family, wire dtype, validation, state mobility, and recurrent range behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 02055626-4bcf-4045-b0bc-f23de6a22719

📥 Commits

Reviewing files that changed from the base of the PR and between a878919 and 19653da.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (114)
  • .github/workflows/queue-unsloth-layer-packages.yml
  • Justfile
  • crates/llama-quant-ffi/src/lib.rs
  • crates/mesh-llm-cli/src/models.rs
  • crates/mesh-llm-cli/src/parser.rs
  • crates/mesh-llm-commands/src/model_package.rs
  • crates/mesh-llm-host-runtime/src/inference/skippy/family_policy.rs
  • crates/mesh-llm-host-runtime/src/inference/skippy/mod.rs
  • crates/mesh-llm-host-runtime/src/inference/skippy/resolver/resolution.rs
  • crates/mesh-llm-host-runtime/src/inference/skippy/resolver/tests.rs
  • crates/mesh-llm-host-runtime/src/mesh/capacity.rs
  • crates/mesh-llm-host-runtime/src/mesh/connections.rs
  • crates/mesh-llm-host-runtime/src/mesh/direct_path.rs
  • crates/mesh-llm-host-runtime/src/mesh/mod.rs
  • crates/mesh-llm-host-runtime/src/mesh/node.rs
  • crates/mesh-llm-host-runtime/src/mesh/peer_state.rs
  • crates/mesh-llm-host-runtime/src/mesh/stage_artifacts.rs
  • crates/mesh-llm-host-runtime/src/mesh/stage_transport.rs
  • crates/mesh-llm-host-runtime/src/mesh/tests/connections.rs
  • crates/mesh-llm-host-runtime/src/mesh/tests/direct_path.rs
  • crates/mesh-llm-host-runtime/src/models/capabilities.rs
  • crates/mesh-llm-host-runtime/src/models/mod.rs
  • crates/mesh-llm-host-runtime/src/runtime/local.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_package.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_split.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_split/loading.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_split/tests.rs
  • crates/mesh-llm-host-runtime/src/runtime/mod.rs
  • crates/mesh-llm-host-runtime/src/runtime/model_lifecycle/load.rs
  • crates/mesh-llm-host-runtime/src/runtime/model_lifecycle/reconciliation.rs
  • crates/mesh-llm-host-runtime/src/runtime/split_participant_settle.rs
  • crates/mesh-llm-host-runtime/src/runtime/split_planning.rs
  • crates/mesh-llm-host-runtime/src/runtime/startup_handles.rs
  • crates/mesh-llm-host-runtime/src/runtime/startup_retry.rs
  • crates/mesh-llm-host-runtime/src/sdk.rs
  • crates/mesh-llm-types/src/mesh/mod.rs
  • crates/mesh-llm/src/commands/mod.rs
  • crates/mesh-llm/src/commands/models/mod.rs
  • crates/model-artifact/src/gguf.rs
  • crates/model-artifact/src/gguf/kv_cache.rs
  • crates/model-package/src/bin/queue-unsloth-layer-packages.rs
  • crates/model-package/src/jobs.rs
  • crates/model-package/src/prepare.rs
  • crates/model-package/src/script.rs
  • crates/model-package/src/scripts/split-model-job.sh
  • crates/skippy-coordinator/src/topology.rs
  • crates/skippy-correctness/src/cli.rs
  • crates/skippy-correctness/src/main.rs
  • crates/skippy-correctness/src/runner/mod.rs
  • crates/skippy-correctness/src/runner/stage_fa_parity.rs
  • crates/skippy-ffi/src/lib.rs
  • crates/skippy-protocol/src/binary/activation.rs
  • crates/skippy-protocol/src/binary/mod.rs
  • crates/skippy-protocol/src/binary/types.rs
  • crates/skippy-quantize/Cargo.toml
  • crates/skippy-quantize/src/backend.rs
  • crates/skippy-quantize/src/gguf_metadata.rs
  • crates/skippy-quantize/src/gguf_template.rs
  • crates/skippy-quantize/src/gguf_writer.rs
  • crates/skippy-quantize/src/gguf_writer/glm_dsa.rs
  • crates/skippy-quantize/src/gguf_writer_tests.rs
  • crates/skippy-quantize/src/hf_checkpoint.rs
  • crates/skippy-quantize/src/inkling_metadata.rs
  • crates/skippy-quantize/src/main.rs
  • crates/skippy-quantize/src/mtp_attach.rs
  • crates/skippy-quantize/src/projector_validate.rs
  • crates/skippy-quantize/src/tensor_map.rs
  • crates/skippy-quantize/src/tokenizer_metadata.rs
  • crates/skippy-quantize/src/types.rs
  • crates/skippy-runtime/src/media.rs
  • crates/skippy-runtime/src/runtime_events.rs
  • crates/skippy-runtime/src/types.rs
  • crates/skippy-server/src/binary_transport/binary_messaging.rs
  • crates/skippy-server/src/binary_transport/binary_messaging/connection.rs
  • crates/skippy-server/src/binary_transport/binary_messaging/reply.rs
  • crates/skippy-server/src/binary_transport/options.rs
  • crates/skippy-server/src/binary_transport/stage_execution.rs
  • crates/skippy-server/src/cli.rs
  • crates/skippy-server/src/frontend/decode_scheduler.rs
  • crates/skippy-server/src/frontend/embedded_execution.rs
  • crates/skippy-server/src/frontend/embedded_generation.rs
  • crates/skippy-server/src/frontend/embedded_generation/lifecycle.rs
  • crates/skippy-server/src/frontend/generation.rs
  • crates/skippy-server/src/frontend/generation/persistent_lanes.rs
  • crates/skippy-server/src/frontend/generation/timeouts.rs
  • crates/skippy-server/src/frontend/generation_flow.rs
  • crates/skippy-server/src/frontend/request.rs
  • crates/skippy-server/src/frontend/tests/prefill.rs
  • crates/skippy-server/src/frontend/tests/request.rs
  • crates/skippy-server/src/frontend/tests/wire_messages.rs
  • crates/skippy-server/src/frontend/wire_messages.rs
  • crates/skippy-server/src/runtime_state.rs
  • crates/skippy-topology/capabilities/reviewed-family-capabilities.json
  • crates/skippy-topology/src/family_capability.rs
  • crates/skippy-topology/src/tests.rs
  • docs/LAYER_PACKAGE_REPOS.md
  • docs/skippy/llama-parity-candidates.json
  • scripts/hf-skippy-convert-job.py
  • scripts/hf-skippy-mtp-certify-job.py
  • third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch
  • third_party/llama.cpp/patches/0047-Add-staged-execution-support-for-Inkling.patch
  • third_party/llama.cpp/patches/0048-Advance-native-MTP-depth-per-draft-step.patch
  • third_party/llama.cpp/patches/0049-Replay-multi-depth-MTP-caches-correctly.patch
  • third_party/llama.cpp/patches/0050-Add-Inkling-multi-depth-MTP-sidecars.patch
  • third_party/llama.cpp/patches/0051-Carry-multimodal-Inkling-embeddings-into-MTP.patch
  • third_party/llama.cpp/patches/0052-Size-recurrent-memory-for-appended-MTP-layers.patch
  • third_party/llama.cpp/patches/0053-Restore-recurrent-verify-window-state.patch
  • third_party/llama.cpp/patches/0054-skippy-preserve-verify-checkpoint-until-trim.patch
  • third_party/llama.cpp/patches/0055-skippy-retain-pipelined-verify-checkpoints.patch
  • third_party/llama.cpp/patches/0056-skippy-filter-Inkling-stage-memory-by-layer-range.patch
  • third_party/llama.cpp/patches/0057-Complete-Inkling-and-GLM-metadata-integration.patch
  • third_party/llama.cpp/patches/0058-skippy-balance-filtered-stages-across-devices.patch
  • tools/relay-fly-legacy/README.md
  • website/src/docs/pages/CLI.md

Comment thread crates/mesh-llm-commands/src/model_package.rs
Comment on lines +223 to +241
record_draining_replaced_connection(remote, existing.as_ref(), &conn);
}
}

fn record_draining_replaced_connection(
remote: EndpointId,
existing: Option<&Connection>,
replacement: &Connection,
) {
let Some(existing) = existing else {
return;
};
tracing::debug!(
peer = %remote.fmt_short(),
replaced_stable_id = existing.stable_id(),
replacement_stable_id = replacement.stable_id(),
"Direct path connection replaced; allowing existing streams to drain"
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Replaced direct-path connection now never gets a terminal close.

The helper only logs, so once existing is dropped from state.connections the old QUIC connection is retained by whatever stream/dispatch tasks still hold clones and is only reclaimed by idle timeout. remember_incoming_connection in crates/mesh-llm-host-runtime/src/mesh/connections.rs (Lines 705-736) solves the identical problem with a bounded drain grace plus explicit close. Reuse that path here instead of an unbounded drain.

♻️ Suggested change
-        record_draining_replaced_connection(remote, existing.as_ref(), &conn);
+        if let Some(existing) = existing.filter(|existing| existing.stable_id() != conn.stable_id())
+        {
+            record_draining_replaced_connection(remote, Some(&existing), &conn);
+            Self::spawn_replaced_connection_drain(remote, existing);
+        }

Note the drain helper is currently private to connections.rs; it needs pub(crate)/pub(super) visibility.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mesh-llm-host-runtime/src/mesh/direct_path.rs` around lines 223 - 241,
Update record_draining_replaced_connection to reuse the bounded drain-and-close
helper used by remember_incoming_connection instead of only logging the
replacement. Expose that helper from connections.rs with crate- or module-level
visibility, then invoke it for the existing connection so retained
stream/dispatch clones receive an explicit terminal close after the configured
grace period; preserve the current logging context.

Comment thread crates/mesh-llm-host-runtime/src/runtime/local_package.rs
Comment thread crates/mesh-llm-host-runtime/src/runtime/local.rs Outdated
Comment thread crates/skippy-correctness/src/runner/stage_fa_parity.rs
Comment thread scripts/hf-skippy-mtp-certify-job.py
Comment thread scripts/hf-skippy-mtp-certify-job.py
Comment on lines +2032 to +2034
+ float params[] = { scale, 0.0f, 0.0f };
+ ggml_set_op_params(result, params, sizeof(params));
+ memcpy(result->op_params + 16, &rel_extent, sizeof(rel_extent));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm GGML_MAX_OP_PARAMS and op_params declaration in the vendored tree,
# and check whether anything reads rel_extent back from op_params.
fd -t f 'ggml.h$' third_party --exec rg -n 'GGML_MAX_OP_PARAMS|int32_t op_params' {}
rg -n 'op_params \+ 16|rel_extent' third_party/llama.cpp/patches | head -50

Repository: Mesh-LLM/mesh-llm

Length of output: 8032


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate ggml.h under third_party and print GGML_MAX_OP_PARAMS / op_params declarations.
printf 'ggml.h GGML_MAX_OP_PARAMS and op_params declarations:\n'
fd -t f 'ggml.h$' third_party --print0 | while IFS= read -r -d '' f; do
  echo "--- $f"
  rg -n -C 3 'GGML_MAX_OP_PARAMS|int32_t op_params' "$f" || true
done

printf '\nRelevant patch region:\n'
sed -n '2010,2045p' third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch

printf '\nAll rel_extent occurrences in patch (no source code execution):\n'
rg -n 'rel_extent|REL_EXTENT|INKLING_REL_EXTENT' third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch

printf '\nStruct/constructor declaration context for ggml_inkling_rel_logits:\n'
rg -n -C 5 'ggml_inkling_rel_logits|rel_logits' third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch

Repository: Mesh-LLM/mesh-llm

Length of output: 14720


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Model the ggml_tensor layout from the vendored ggml.h and confirm that
# writing sizeof(int64_t) at offset GGML_MAX_OP_PARAMS from op_params is
# an out-of-bounds store into the ggml_tensor object for the common GGML_MAX_OP_PARAMS count.
python3 - <<'PY'
from pathlib import Path
import re

for f in Path('third_party').glob('**/ggml.h'):
    s = f.read_text()
    m = re.search(r'(?m)defn\|GGML_MAX_OP_PARAMS\s+=(\s*\d+)', s)
    op = re.search(r'(?m)int32_t\s+op_params\s*\[\s*GGML_MAX_OP_PARAMS\s*/\s* sizeof\(int32_t\)\s*\]', s)
    if m and op:
        maxv = int(m.group(1))
        ne_size = 8
        print(f'{f}: GGML_MAX_OP_PARAMS={maxv} op_params_elements={maxv//4} layout_ok={op.group(0)}')
        bytes_for_rel_extent = 8
        offset = maxv + bytes_for_rel_extent
        print(f'  bytes from tensor start: flags={8}; ne={8*ne_size}; np=0; src=8; type={8}; padding={8*(4-ne_size//4)}; data=8; id=8; name=64; op_params={maxv}; total_before_op_params={sum([8,8*ne_size,0,8,8,8*(4-ne_size//4),8,8,64])}')
        print(f'  op_params starts at {sum([8,8*ne_size,0,8,8,8*(4-ne_size//4),8,8,64])}; out-of-bounds end is {sum([8,8*ne_size,0,8,8,8*(4-ne_size//4),8,8,64]) + maxv}')
        print(f'  memcpy(result->op_params + 16, &rel_extent, 8) writes through offset {sum([8,8*ne_size,0,8,8,8*(4-ne_size//4),8,8,64]) + maxv + 8}')
PY

Repository: Mesh-LLM/mesh-llm

Length of output: 155


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Tracked third_party files matching ggml:ggml:*.h:\n'
git ls-files third_party | rg 'ggml.*\.h$|ggml\.h$' || true

printf '\nTop-level files matching ggml:ggml:*.h:\n'
git ls-files | rg '(^|/)ggml.*\.h$' || true

printf '\nAll files containing GGML_MAX_OP_PARAMS:\n'
rg -n 'GGML_MAX_OP_PARAMS|int32_t\s+op_params' . --glob '*.h' --glob '*.hpp' --glob '*.c' --glob '*.cpp' --glob '*.cc' | head -80

Repository: Mesh-LLM/mesh-llm

Length of output: 288


Remove the out-of-bounds rel_extent write.

ggml_tensor::op_params is a fixed-size 16-element int32_t array for GGML_MAX_OP_PARAMS == 64, so result->op_params + 16 is past-the-end and the 8-byte memcpy corrupts whichever ggml_tensor field follows the array. The banded attention paths read rel_extent from rel->ne[0], so the store is redundant; drop it or keep the value in rel_logits->ne[0].

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@third_party/llama.cpp/patches/0046-Add-TML-Inkling-architecture.patch` around
lines 2032 - 2034, Remove the out-of-bounds memcpy writing rel_extent in the
operation setup near ggml_set_op_params; rely on rel->ne[0] or rel_logits->ne[0]
for the banded attention paths, preserving the existing scale parameter
initialization.

Comment on lines +194 to +201
+ } else if (accepted_count > 0) {
+ status = skippy_decode_tokens(
+ session,
+ checkpoint.token_ids.data(),
+ accepted_count,
+ false,
+ out_error);
+ }

@coderabbitai coderabbitai Bot Jul 28, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

checkpoint.token_ids.data() can be empty here.

skippy_checkpoint_verify_window only fills token_ids when the caller passes a non-null pointer (skippy_verify_tokens_frame_sampled passes token_ids, but a checkpoint taken without them leaves the vector empty). Reaching this branch with accepted_count > 0 and an empty vector hands skippy_decode_tokens a dangling pointer plus a positive count. Guard on emptiness and fail explicitly instead.

🛡️ Proposed guard
-    } else if (accepted_count > 0) {
+    } else if (accepted_count > 0) {
+        if (checkpoint.token_ids.size() < accepted_count) {
+            skippy_set_error(out_error, SKIPPY_STATUS_RUNTIME_ERROR,
+                    "verify checkpoint is missing the accepted token prefix");
+            return SKIPPY_STATUS_RUNTIME_ERROR;
+        }
         status = skippy_decode_tokens(
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
+ } else if (accepted_count > 0) {
+ status = skippy_decode_tokens(
+ session,
+ checkpoint.token_ids.data(),
+ accepted_count,
+ false,
+ out_error);
+ }
} else if (accepted_count > 0) {
if (checkpoint.token_ids.size() < accepted_count) {
skippy_set_error(out_error, SKIPPY_STATUS_RUNTIME_ERROR,
"verify checkpoint is missing the accepted token prefix");
return SKIPPY_STATUS_RUNTIME_ERROR;
}
status = skippy_decode_tokens(
session,
checkpoint.token_ids.data(),
accepted_count,
false,
out_error);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0053-Restore-recurrent-verify-window-state.patch`
around lines 194 - 201, Guard the accepted_count > 0 branch in the checkpoint
verification flow before calling skippy_decode_tokens: validate that
checkpoint.token_ids is non-empty, and explicitly fail using the existing
out_error/status mechanism when it is empty. Only pass
checkpoint.token_ids.data() with a positive count when the vector contains the
required tokens.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This recovery code is being isolated and its review feedback addressed in #1100. I am deliberately not duplicating a potentially conflicting checkpoint fix in #1017 while that work is active; this thread should remain open until the #1100 change lands or is incorporated here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@michaelneale, acknowledged. I’ll leave this thread open and defer verification until the checkpoint-recovery work from #1100 is merged or incorporated into this PR.

Comment thread tools/relay-fly-legacy/README.md

@i386 i386 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review of changes since prior review head a3673cbb, at current head 19653da2.

The KV planning/runtime policy now resolves the Inkling family default consistently from GGUF metadata, and the replaced direct-path connection now uses the bounded drain-and-close path. I also reviewed the subsequent Inkling sidecar, wire-version, split-cache, and stage-loading hardening changes. No additional blocking finding in this pass; current required checks are green.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
crates/skippy-server/src/binary_transport/stage_execution.rs (1)

575-613: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Convert native-MTP proposals from the fixed array using token_count.

NativeMtpDraft::token_ids is [i32; 8], while StageReply expects a Vec<i32>. Convert draft.token_ids[0..draft.token_count.try_into()?].to_vec() (or return an error when token_count exceeds the array length) so the wire protocol carries only the actual proposals.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/skippy-server/src/binary_transport/stage_execution.rs` around lines
575 - 613, The stage_native_mtp_draft function currently forwards the entire
fixed-size token_ids array instead of only the actual proposals. Use
draft.token_count to bound the slice, validate that it does not exceed the array
length, and return or propagate an error for an invalid count while preserving
proposal_compute_us.
third_party/llama.cpp/patches/0053-Carry-multimodal-Inkling-embeddings-into-MTP.patch (1)

47-58: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

A failed MTP observe now reports the whole llama_decode as failed after KV was already mutated.

ctx->decode(batch) has already committed KV/state when skippy_external_decode_observe runs. Returning its -1 from llama_decode makes every caller treat the decode as failed and typically retry or abort the sequence, while the target context has in fact advanced — a silent position/cache divergence. The sidecar sync is auxiliary (drafting); a failure there should be logged and swallowed, or surfaced through a distinct channel, not folded into the decode return code.

🛠️ Keep decode success authoritative
     int ret = ctx->decode(batch);
     if (ret == 0) {
-        ret = skippy_external_decode_observe(ctx, batch);
+        // decode already committed KV; a sidecar/draft failure must not be
+        // reported as a decode failure
+        (void) skippy_external_decode_observe(ctx, batch);
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0053-Carry-multimodal-Inkling-embeddings-into-MTP.patch`
around lines 47 - 58, Keep ctx->decode(batch)'s return value authoritative in
llama_decode; invoke skippy_external_decode_observe(ctx, batch) only as
auxiliary sidecar work after a successful decode, and do not assign its failure
result to ret. Log or propagate observer failures through a separate mechanism
while preserving the successful decode return code.
third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch (2)

445-450: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Inconsistent unpadded_vocab_size contract.

get_vocab_base treats it as optional (hp.get("unpadded_vocab_size") or n_vocab), but set_gguf_parameters (Line 502) and the log line (Line 505) index hp["unpadded_vocab_size"] directly, so a checkpoint without the key passes vocab validation and then dies with a KeyError late in conversion. Pick one contract — either validate/raise early in __init__, or fall back consistently.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch` around
lines 445 - 450, Make the unpadded_vocab_size handling consistent across
get_vocab_base, set_gguf_parameters, and the related log statement. Either
validate the key during __init__ with an early, clear error or reuse the n_vocab
fallback everywhere, ensuring checkpoints without unpadded_vocab_size do not
reach direct hp[...] accesses and fail late.

4692-4695: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Include <cstdlib> for atoi.

main calls atoi, but the file does not include <cstdlib>. Add #include <cstdlib> and call std::atoi so this does not depend on indirect or nonstandard headers.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch` around
lines 4692 - 4695, Add the <cstdlib> header to the file containing main, and
update the repeats initialization in main to call std::atoi explicitly instead
of the unqualified atoi.
third_party/llama.cpp/patches/0054-Size-recurrent-memory-for-appended-MTP-layers.patch (1)

26-40: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Version or gate the recurrent-state format change.

This patch makes exported MTP recurrent state include appended layers (n_layer_all) but the reader rejects any saved blob whose n_layer count differs from n_layer_all, including old MTP states that only contain n_layer(). Add a format/version path or migration for cross-runtime state loads, or explicitly enforce/import-bound this format boundary.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0054-Size-recurrent-memory-for-appended-MTP-layers.patch`
around lines 26 - 40, Version or explicitly gate the recurrent-state format
change in llama_memory_recurrent::state_write_data and state_read_data so
readers can distinguish legacy n_layer() state blobs from the new n_layer_all
format. Support migration or compatibility for old MTP states, or enforce an
explicit import/export boundary that rejects incompatible formats before
loading; preserve the existing layer-count validation for the selected format.
🧹 Nitpick comments (4)
third_party/llama.cpp/patches/0052-Add-Inkling-multi-depth-MTP-sidecars.patch (2)

444-467: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

MTP logits skip the padded-vocab mask when the stage filter suppresses it.

vocab_mask is only allocated when !stage_filtered || stage_filter.include_output (0049), but the MTP branch adds it unconditionally-if-present. Today the sidecar only runs on an include_output stage so it holds, but if that invariant ever slips, MTP drafts can sample padded ids while the trunk cannot. A GGML_ASSERT on the invariant here would make the coupling explicit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0052-Add-Inkling-multi-depth-MTP-sidecars.patch`
around lines 444 - 467, Add a GGML_ASSERT in the MTP branch around vocab_mask
handling to enforce that any MTP execution requiring output has vocab_mask
available, matching the allocation condition from the stage-filter logic. Keep
the existing ggml_add path unchanged when the mask is present.

472-492: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

output_norm now runs over every token, even when embeddings_nextn is off.

The norm was moved before the inp_out_ids gather so t_h_nextn can see the full sequence, but the reorder is unconditional: on a large prefill the final RMS norm now processes n_tokens × n_embd instead of just the output rows. Keep the old order when !cparams.embeddings_nextn.

♻️ Gate the reorder on the nextn path
-    cur = build_norm(cur, model.output_norm, NULL, LLM_NORM_RMS, -1);
-    cb(cur, "result_norm_all", -1);
     if (cparams.embeddings_nextn) {
+        cur = build_norm(cur, model.output_norm, NULL, LLM_NORM_RMS, -1);
+        cb(cur, "result_norm_all", -1);
         ggml_tensor * h_nextn = cur;
         if (cparams.embeddings_nextn_masked && inp_out_ids) {
             h_nextn = ggml_get_rows(ctx0, h_nextn, inp_out_ids);
         }
         cb(h_nextn, "h_nextn", -1);
         res->t_h_nextn = h_nextn;
+        if (inp_out_ids) {
+            cur = ggml_get_rows(ctx0, cur, inp_out_ids);
+        }
+    } else {
+        if (inp_out_ids) {
+            cur = ggml_get_rows(ctx0, cur, inp_out_ids);
+        }
+        cur = build_norm(cur, model.output_norm, NULL, LLM_NORM_RMS, -1);
     }
-    if (inp_out_ids) {
-        cur = ggml_get_rows(ctx0, cur, inp_out_ids);
-    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0052-Add-Inkling-multi-depth-MTP-sidecars.patch`
around lines 472 - 492, Update llama_model_inkling::graph::graph so output_norm
remains after the inp_out_ids gather when cparams.embeddings_nextn is disabled,
preserving the existing output-only normalization path. Only normalize the full
sequence before gathering when cparams.embeddings_nextn is enabled, then
populate h_nextn and t_h_nextn from that normalized sequence while retaining the
existing result outputs.
third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch (1)

4047-4053: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

These tests bypass the llama_build_and_test helper.

Every other entry in this file registers through llama_build_and_test, which centralizes labels, working directory, and sanitizer handling. Raw add_executable/add_test here will drift (e.g. no LABEL, no consistent test env). Consider matching the surrounding convention unless the helper's llama linkage is the blocker.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch` around
lines 4047 - 4053, Update the test registrations for test-flash-attn-bias and
test-flash-attn-generic-hash to use the surrounding llama_build_and_test helper
instead of raw add_executable/add_test calls, preserving their existing source
files and linkage while inheriting centralized labels, working-directory, and
sanitizer handling.
third_party/llama.cpp/patches/0051-Replay-multi-depth-MTP-caches-correctly.patch (1)

220-247: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Batch is re-allocated every depth iteration.

llama_batch_init + std::malloc + llama_batch_free inside the depth loop reallocates a max-draft_limit-row batch up to draft_limit times per proposal, on the decode hot path. Allocating once for draft_limit + 1 rows and just setting batch.n_tokens = n_rows per iteration would remove the churn and the repeated failure-path bookkeeping.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@third_party/llama.cpp/patches/0051-Replay-multi-depth-MTP-caches-correctly.patch`
around lines 220 - 247, Move llama_batch initialization and token allocation out
of the depth loop in the chain_heads path, allocating capacity for draft_limit +
1 rows once and handling allocation failure once. Reuse that batch on each
iteration by updating batch.n_tokens to n_rows and overwriting the active rows,
then free it once after the loop while preserving the existing
proposal-generation behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@crates/skippy-server/src/binary_transport/stage_execution.rs`:
- Around line 575-613: The stage_native_mtp_draft function currently forwards
the entire fixed-size token_ids array instead of only the actual proposals. Use
draft.token_count to bound the slice, validate that it does not exceed the array
length, and return or propagate an error for an invalid count while preserving
proposal_compute_us.

In `@third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch`:
- Around line 445-450: Make the unpadded_vocab_size handling consistent across
get_vocab_base, set_gguf_parameters, and the related log statement. Either
validate the key during __init__ with an early, clear error or reuse the n_vocab
fallback everywhere, ensuring checkpoints without unpadded_vocab_size do not
reach direct hp[...] accesses and fail late.
- Around line 4692-4695: Add the <cstdlib> header to the file containing main,
and update the repeats initialization in main to call std::atoi explicitly
instead of the unqualified atoi.

In
`@third_party/llama.cpp/patches/0053-Carry-multimodal-Inkling-embeddings-into-MTP.patch`:
- Around line 47-58: Keep ctx->decode(batch)'s return value authoritative in
llama_decode; invoke skippy_external_decode_observe(ctx, batch) only as
auxiliary sidecar work after a successful decode, and do not assign its failure
result to ret. Log or propagate observer failures through a separate mechanism
while preserving the successful decode return code.

In
`@third_party/llama.cpp/patches/0054-Size-recurrent-memory-for-appended-MTP-layers.patch`:
- Around line 26-40: Version or explicitly gate the recurrent-state format
change in llama_memory_recurrent::state_write_data and state_read_data so
readers can distinguish legacy n_layer() state blobs from the new n_layer_all
format. Support migration or compatibility for old MTP states, or enforce an
explicit import/export boundary that rejects incompatible formats before
loading; preserve the existing layer-count validation for the selected format.

---

Nitpick comments:
In `@third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch`:
- Around line 4047-4053: Update the test registrations for test-flash-attn-bias
and test-flash-attn-generic-hash to use the surrounding llama_build_and_test
helper instead of raw add_executable/add_test calls, preserving their existing
source files and linkage while inheriting centralized labels, working-directory,
and sanitizer handling.

In
`@third_party/llama.cpp/patches/0051-Replay-multi-depth-MTP-caches-correctly.patch`:
- Around line 220-247: Move llama_batch initialization and token allocation out
of the depth loop in the chain_heads path, allocating capacity for draft_limit +
1 rows once and handling allocation failure once. Reuse that batch on each
iteration by updating batch.n_tokens to n_rows and overwriting the active rows,
then free it once after the loop while preserving the existing
proposal-generation behavior.

In
`@third_party/llama.cpp/patches/0052-Add-Inkling-multi-depth-MTP-sidecars.patch`:
- Around line 444-467: Add a GGML_ASSERT in the MTP branch around vocab_mask
handling to enforce that any MTP execution requiring output has vocab_mask
available, matching the allocation condition from the stage-filter logic. Keep
the existing ggml_add path unchanged when the mask is present.
- Around line 472-492: Update llama_model_inkling::graph::graph so output_norm
remains after the inp_out_ids gather when cparams.embeddings_nextn is disabled,
preserving the existing output-only normalization path. Only normalize the full
sequence before gathering when cparams.embeddings_nextn is enabled, then
populate h_nextn and t_h_nextn from that normalized sequence while retaining the
existing result outputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 92245f70-47a0-4d16-ab38-c871adcfcf11

📥 Commits

Reviewing files that changed from the base of the PR and between 3f538a9 and f6f5ada.

📒 Files selected for processing (29)
  • crates/mesh-llm-commands/src/model_package.rs
  • crates/mesh-llm-host-runtime/src/mesh/connections.rs
  • crates/mesh-llm-host-runtime/src/mesh/direct_path.rs
  • crates/mesh-llm-host-runtime/src/models/capabilities.rs
  • crates/mesh-llm-host-runtime/src/runtime/local.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_package.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_split/loading.rs
  • crates/skippy-correctness/src/runner/stage_fa_parity.rs
  • crates/skippy-ffi/src/lib.rs
  • crates/skippy-quantize/src/tokenizer_metadata.rs
  • crates/skippy-server/src/binary_transport/binary_messaging/connection.rs
  • crates/skippy-server/src/binary_transport/preconnect.rs
  • crates/skippy-server/src/binary_transport/stage_execution.rs
  • crates/skippy-server/src/frontend/generation/persistent_lanes.rs
  • crates/skippy-server/src/runtime_state.rs
  • scripts/hf-skippy-mtp-certify-job.py
  • third_party/llama.cpp/patches/0048-Add-TML-Inkling-architecture.patch
  • third_party/llama.cpp/patches/0049-Add-staged-execution-support-for-Inkling.patch
  • third_party/llama.cpp/patches/0050-Advance-native-MTP-depth-per-draft-step.patch
  • third_party/llama.cpp/patches/0051-Replay-multi-depth-MTP-caches-correctly.patch
  • third_party/llama.cpp/patches/0052-Add-Inkling-multi-depth-MTP-sidecars.patch
  • third_party/llama.cpp/patches/0053-Carry-multimodal-Inkling-embeddings-into-MTP.patch
  • third_party/llama.cpp/patches/0054-Size-recurrent-memory-for-appended-MTP-layers.patch
  • third_party/llama.cpp/patches/0055-Restore-recurrent-verify-window-state.patch
  • third_party/llama.cpp/patches/0056-skippy-preserve-verify-checkpoint-until-trim.patch
  • third_party/llama.cpp/patches/0057-skippy-retain-pipelined-verify-checkpoints.patch
  • third_party/llama.cpp/patches/0058-skippy-filter-Inkling-stage-memory-by-layer-range.patch
  • third_party/llama.cpp/patches/0059-Complete-Inkling-and-GLM-metadata-integration.patch
  • third_party/llama.cpp/patches/0060-skippy-balance-filtered-stages-across-devices.patch
🚧 Files skipped from review as they are similar to previous changes (12)
  • crates/skippy-server/src/runtime_state.rs
  • crates/mesh-llm-host-runtime/src/mesh/direct_path.rs
  • crates/mesh-llm-host-runtime/src/runtime/local.rs
  • crates/mesh-llm-host-runtime/src/mesh/connections.rs
  • crates/skippy-correctness/src/runner/stage_fa_parity.rs
  • crates/mesh-llm-host-runtime/src/runtime/local_split/loading.rs
  • crates/mesh-llm-host-runtime/src/models/capabilities.rs
  • scripts/hf-skippy-mtp-certify-job.py
  • crates/skippy-server/src/binary_transport/binary_messaging/connection.rs
  • crates/skippy-server/src/frontend/generation/persistent_lanes.rs
  • crates/skippy-quantize/src/tokenizer_metadata.rs
  • crates/skippy-ffi/src/lib.rs

@michaelneale

Copy link
Copy Markdown
Collaborator Author

Inkling checkpoint before returning to Poolside

Branch codex/inkling-q2-skippy is clean and fully pushed at f6f5adad. PR CI is green and GitHub currently reports the PR mergeable.

Completed

  • refreshed the Inkling llama.cpp patch series onto current main
  • fixed the confirmed native 8-byte out-of-bounds write in the Inkling graph metadata path
  • addressed the actionable review findings
  • passed clean patch application, embedded Metal release build, Linux/CUDA builds, workspace formatting, warning-denying Clippy, Skippy correctness/unit suites, host-runtime tests, and the repository's ordinary split/inference smokes
  • built a corrected-head CUDA/SM120 runtime artifact

Evidence boundary

The earlier M5 + Vast model run showed that the Inkling implementation can load and execute across Metal/CUDA, but it used the pre-fix binary containing the now-corrected out-of-bounds write. It is implementation evidence only and must not be presented as final merge evidence.

The corrected head has not yet completed:

  • a model-backed Inkling request on Metal
  • a corrected-head distributed Inkling request
  • the intended 128K cache/recovery/N-gram trial

Therefore this checkpoint does not yet claim production Inkling support, corrected-head Metal execution, or corrected-head 128K distributed inference.

Next steps

  1. Provision sufficient nearby Vast capacity and run the expensive work entirely in cloud: corrected-head 128K split inference, exact-prefix reuse, recovery, and suffix N-gram throughput.
  2. Keep the claim scoped to the pinned Q2 package/quant.
  3. Before marking the PR ready, run one short corrected-head model-backed Metal smoke on M5; no long M5 soak is required.
  4. Replace the provisional evidence in the PR description with corrected-head results and document the practical topology/capacity profile.
  5. Keep skippy: recover hybrid speculative windows and orphaned lanes #1100's generic recovery work separate; consume it after review/landing rather than broadening this PR.

Work is intentionally pausing here so Poolside #1095 can be finished first.

@michaelneale

Copy link
Copy Markdown
Collaborator Author

Combined replacement branch is now open as #1118. It carries the current work from this PR onto current main, linearizes the shared llama.cpp patch queue, and separates prior live evidence from validation run on the combined head. Please continue review on #1118; this PR is left open for provenance until maintainers decide to close/supersede it.

@ndizazzo

Copy link
Copy Markdown
Collaborator

Superseded by #1118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants