From 6c165747a9357277ca7a8ca2e3731e1723beb305 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Wed, 1 Jul 2026 03:22:43 +0000 Subject: [PATCH] docs(paged): verify patch-series mirror invariant Record the Phase 22 strict git-apply mirror check proving the LocalAI paged patch series reconstructs the canonical llama.cpp fork tree after patch 0055. Assisted-by: Codex:gpt-5 --- .../docs/GB10_PARITY_PHASE0_RESULTS.md | 26 +++++++ .../docs/PARITY_HANDOFF.md | 6 ++ .../docs/PATCH_MAINTENANCE.md | 15 ++++ ...1-patch-series-mirror-invariant-phase22.md | 78 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 docs/superpowers/plans/2026-07-01-patch-series-mirror-invariant-phase22.md diff --git a/backend/cpp/llama-cpp-localai-paged/docs/GB10_PARITY_PHASE0_RESULTS.md b/backend/cpp/llama-cpp-localai-paged/docs/GB10_PARITY_PHASE0_RESULTS.md index 7488ab4b1..9cce412d4 100644 --- a/backend/cpp/llama-cpp-localai-paged/docs/GB10_PARITY_PHASE0_RESULTS.md +++ b/backend/cpp/llama-cpp-localai-paged/docs/GB10_PARITY_PHASE0_RESULTS.md @@ -1441,3 +1441,29 @@ Decision: snapshots. - Do not use stale DGX `~/bench/combined_definitive.sh` without porting it to `~/llama-phase6-source` and the owner-file lock discipline. + +## Phase 22 Patch-Series Mirror Invariant + +Phase 22 verified that the LocalAI on-disk paged patch series still reconstructs +the canonical llama.cpp fork tree after patch `0055`. + +Method: + +- Create a fresh worktree at Makefile pin + `0ed235ea2c17a19fc8238668653946721ed136fd`. +- Apply every `backend/cpp/llama-cpp-localai-paged/patches/paged/0*.patch` with + strict `git apply`, matching the LocalAI build path. +- Stage the result and compare `git write-tree` with the fork branch HEAD tree. + +Result: + +```text +base=0ed235ea2c17a19fc8238668653946721ed136fd +applied_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb +fork_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb +``` + +Decision: + +- The patch series is drift-free against fork branch `localai-paged` at + `fb9402661 feat(server): trace speculative batch shapes`. diff --git a/backend/cpp/llama-cpp-localai-paged/docs/PARITY_HANDOFF.md b/backend/cpp/llama-cpp-localai-paged/docs/PARITY_HANDOFF.md index 9854e1eba..5b67e912d 100644 --- a/backend/cpp/llama-cpp-localai-paged/docs/PARITY_HANDOFF.md +++ b/backend/cpp/llama-cpp-localai-paged/docs/PARITY_HANDOFF.md @@ -315,6 +315,12 @@ Use this harness for future current-stack GB10 snapshots. Do not reuse `~/bench/combined_definitive.sh` unless it is first ported away from stale `~/llama-paged-dev` paths and old lock assumptions. +Phase 22 re-verified the patch-series mirror invariant after patch `0055`: +applying every LocalAI `patches/paged/0*.patch` with strict `git apply` on top of +Makefile pin `0ed235ea2c17a19fc8238668653946721ed136fd` produced tree +`5bdbf8ea3d750fe6fa1f85175fd6357d36222edb`, exactly matching fork branch +`localai-paged` HEAD `fb9402661 feat(server): trace speculative batch shapes`. + --- ## 5. METHODOLOGY LESSONS (so you do not repeat the mistakes) diff --git a/backend/cpp/llama-cpp-localai-paged/docs/PATCH_MAINTENANCE.md b/backend/cpp/llama-cpp-localai-paged/docs/PATCH_MAINTENANCE.md index 13ce1194e..eb999a9f2 100644 --- a/backend/cpp/llama-cpp-localai-paged/docs/PATCH_MAINTENANCE.md +++ b/backend/cpp/llama-cpp-localai-paged/docs/PATCH_MAINTENANCE.md @@ -55,6 +55,21 @@ for p in $(PAGED_PATCHES_DIR)/0*.patch; do git apply --verbose "$p" || exit 1; d All variants (avx/avx2/avx512/cuda/…) clone + apply into their own build copy, so the series ships everywhere without ever touching the stock `llama-cpp` source tree. +## Latest mirror check + +Phase 22 re-verified the mirror invariant after adding patch `0055`: + +```text +base=0ed235ea2c17a19fc8238668653946721ed136fd +applied_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb +fork_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb +``` + +The check used a fresh worktree at `LLAMA_VERSION`, applied every +`patches/paged/0*.patch` with strict `git apply`, staged the result, and compared +`git write-tree` to canonical fork branch `localai-paged` at +`fb9402661 feat(server): trace speculative batch shapes`. + ## Status - **0001 vendor manager — DONE.** Applies clean to the pin; builds into `libllama`. diff --git a/docs/superpowers/plans/2026-07-01-patch-series-mirror-invariant-phase22.md b/docs/superpowers/plans/2026-07-01-patch-series-mirror-invariant-phase22.md new file mode 100644 index 000000000..149d84488 --- /dev/null +++ b/docs/superpowers/plans/2026-07-01-patch-series-mirror-invariant-phase22.md @@ -0,0 +1,78 @@ +# Patch Series Mirror Invariant Phase 22 Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use +> superpowers:verification-before-completion before recording the phase result. +> Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** prove the LocalAI `patches/paged/` series still reconstructs the +canonical llama.cpp fork tree after adding patch `0055`. + +**Architecture:** use the same strict `git apply` method as the LocalAI +Makefile. Apply every on-disk paged patch to a fresh worktree at +`LLAMA_VERSION`, then compare the resulting tree hash with the fork branch HEAD. + +**Tech Stack:** Git worktrees, `git apply`, LocalAI paged patch stack, +llama.cpp fork branch `localai-paged`. + +--- + +## Task 1: Apply Patch Series + +- [x] **Step 1: Read the pinned base** + + Source: + + - `backend/cpp/llama-cpp-localai-paged/Makefile` + + Result: + + - `LLAMA_VERSION=0ed235ea2c17a19fc8238668653946721ed136fd` + +- [x] **Step 2: Apply all patches with strict `git apply`** + + Command shape: + + ```bash + git -C /home/mudler/_git/llama.cpp worktree add --detach \ + /tmp/llama-paged-series-applycheck \ + 0ed235ea2c17a19fc8238668653946721ed136fd + + for p in backend/cpp/llama-cpp-localai-paged/patches/paged/0*.patch; do + git -C /tmp/llama-paged-series-applycheck apply --verbose "$PWD/$p" + done + ``` + + Result: + + - every patch applied successfully with `git apply`. + +## Task 2: Compare Tree Hash + +- [x] **Step 1: Compare applied tree to fork HEAD** + + Result: + + ```text + base=0ed235ea2c17a19fc8238668653946721ed136fd + applied_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb + fork_tree=5bdbf8ea3d750fe6fa1f85175fd6357d36222edb + ``` + + Canonical fork: + + - `/home/mudler/_git/llama.cpp` + - branch `localai-paged` + - HEAD `fb9402661 feat(server): trace speculative batch shapes` + +## Decision + +- [x] **Step 1: Mark mirror invariant green** + + The LocalAI `patches/paged/` series is a byte-for-byte source mirror of the + canonical fork branch at `fb9402661`. + +## Self-Review + +- No source or benchmark behavior changed. +- The check used the Makefile's strict `git apply` method, not `git am`. +- The temporary worktree was removed after verification.