Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/temporary-pr254-extra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
post_start_begin = (
' if (\n'
' "private func refreshPostStartState(" in ours\n'
)
post_start_end_marker = ' kinds.add("post_start")\n'
post_start_start = rebase.find(post_start_begin)
if post_start_start < 0:
raise SystemExit("post-start resolver start anchor changed")
post_start_end = rebase.find(post_start_end_marker, post_start_start)
if post_start_end < 0:
raise SystemExit("post-start resolver end anchor changed")
post_start_end += len(post_start_end_marker)
post_start_replacement = ''' if (
"configuration: MTPLXAppConfiguration," in ours
and "lifecycleEpoch: Int" in ours
and "recoveryGeneration: Int?" in ours
and ") async -> Bool" in ours
and "configuration: MTPLXAppConfiguration" in theirs
and "daemonBackendKind(for: configuration) == .mtplx" in theirs
and "external mlx-serve ready" in theirs
and "startExternalMlxServeHealthWatchdog" in theirs
):
text = ours
if not text.endswith("\\n"):
text += "\\n"
text += (
" guard daemonBackendKind(for: configuration) == .mtplx else {\\n"
" health = nil\\n"
" capabilities = nil\\n"
" sessions = nil\\n"
" sessionBank = nil\\n"
" settings = nil\\n"
" pendingLiveSettings = nil\\n"
" pendingLiveSettingsModel = nil\\n"
" connectionState = .idle\\n"
" await supervisor.logs.append(\\n"
" \\\"external mlx-serve ready; MTPLX live controls and metrics are unavailable\\\",\\n"
" stream: .system\\n"
" )\\n"
" guard daemonSessionIsCurrent(\\n"
" lifecycleEpoch: lifecycleEpoch,\\n"
" launchID: nil,\\n"
" recoveryGeneration: recoveryGeneration\\n"
" ) else { return false }\\n"
" startExternalMlxServeHealthWatchdog()\\n"
" return daemonSessionIsCurrent(\\n"
" lifecycleEpoch: lifecycleEpoch,\\n"
" launchID: nil,\\n"
" recoveryGeneration: recoveryGeneration\\n"
" )\\n"
" }\\n"
)
kinds.add("post_start")
'''
rebase = rebase[:post_start_start] + post_start_replacement + rebase[post_start_end:]
247 changes: 247 additions & 0 deletions .github/workflows/temporary-materialize-pr254.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
name: Temporary materialize PR 254 current-main candidate

on:
push:
branches:
- codex/deepseek-v4-mlxserve-v26

permissions:
contents: write

concurrency:
group: temporary-materialize-pr254
cancel-in-progress: true

jobs:
materialize:
runs-on: macos-15
timeout-minutes: 45
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: codex/deepseek-v4-mlxserve-v26
fetch-depth: 0

- name: Rebuild and validate one clean feature commit on current upstream main
shell: bash
run: |
set -euo pipefail
git config user.name "Philip John Basile"
git config user.email "PBasile@Basilecom.com"
git remote add upstream https://github.com/youssofal/MTPLX.git || true
git fetch upstream main
git fetch origin agent/pr254-rebase-inspect
git show origin/agent/pr254-rebase-inspect:.github/workflows/temporary-rebase-254.yml > /tmp/pr254-source.yml

python - <<'PY'
from pathlib import Path

lines = Path("/tmp/pr254-source.yml").read_text(encoding="utf-8").splitlines()
blocks: list[str] = []
index = 0
while index < len(lines):
if lines[index] == " run: |":
index += 1
block: list[str] = []
while index < len(lines):
current = lines[index]
if current and len(current) - len(current.lstrip()) <= 8:
break
if current.startswith(" "):
block.append(current[10:])
elif not current:
block.append("")
else:
raise SystemExit(f"unexpected workflow indentation: {current!r}")
index += 1
blocks.append("\n".join(block))
continue
index += 1
if len(blocks) < 3:
raise SystemExit(f"expected at least three guarded run blocks, found {len(blocks)}")

rebase = blocks[0]
old_expected = ' test "$conflicts" = "mtplx/hf_loader.py"'
new_expected = (
" expected=$'apps/MTPLXApp/Sources/MTPLXAppCore/Services/"
"DaemonSupervisor.swift\\napps/MTPLXApp/Sources/MTPLXAppCore/Stores/"
"MTPLXBackendStore.swift\\nmtplx/hf_loader.py'\n"
" test \"$conflicts\" = \"$expected\""
)
if rebase.count(old_expected) != 1:
raise SystemExit("hf_loader conflict expectation anchor changed")
rebase = rebase.replace(old_expected, new_expected, 1)

old_continue = (
" git add mtplx/hf_loader.py\n"
" set +e\n"
" GIT_EDITOR=true git rebase --continue\n"
" rc=$?\n"
" set -e"
)
new_continue = (
" git add mtplx/hf_loader.py\n"
" # The two Swift paths remain unmerged in this same rebase stop.\n"
" rc=1"
)
if rebase.count(old_continue) != 1:
raise SystemExit("hf_loader continuation anchor changed")
rebase = rebase.replace(old_continue, new_continue, 1)

def replace_resolver(start_marker: str, end_marker: str, replacement: str, label: str) -> None:
global rebase
start = rebase.find(start_marker)
if start < 0:
raise SystemExit(f"{label} resolver start anchor changed")
end = rebase.find(end_marker, start)
if end < 0:
raise SystemExit(f"{label} resolver end anchor changed")
end += len(end_marker)
rebase = rebase[:start] + replacement + rebase[end:]

replace_resolver(
' if (\n "private func waitForHealth(" in ours\n',
' kinds.add("wait_for_health")\n',
(
' if (\n'
' ours.strip() == ") async throws -> HealthPayload {"\n'
' and ") async throws -> HealthPayload?" in theirs\n'
' and "waitForExternalMlxServeHealth" in theirs\n'
' and "let client = MTPLXAPIClient" in theirs\n'
' ):\n'
' text = theirs\n'
' kinds.add("wait_for_health")\n'
),
"waitForHealth",
)

replace_resolver(
(
' if "public func refreshStaticState(" in ours '
'and "supportsMTPLXLiveControls" in theirs:\n'
),
' kinds.add("refresh_static")\n',
(
' if (\n'
' "public func refreshStaticState(" in ours\n'
' and "public func refreshStaticState()" in theirs\n'
' and "guard supportsMTPLXLiveControls else { return }" in theirs\n'
' and "let client = apiClient" not in ours\n'
' ):\n'
' text = ours\n'
' if not text.endswith("\\n"):\n'
' text += "\\n"\n'
' text += (\n'
' " guard supportsMTPLXLiveControls else {\\n"\n'
' " health = nil\\n"\n'
' " capabilities = nil\\n"\n'
' " sessions = nil\\n"\n'
' " prefillHistory = nil\\n"\n'
' " models = nil\\n"\n'
' " return\\n"\n'
' " }\\n"\n'
' )\n'
' kinds.add("refresh_static")\n'
),
"refreshStaticState",
)

replace_resolver(
(
' if (\n'
' "private func flushFreshLaunchLiveOnlySettingsIfNeeded(" in ours\n'
),
' kinds.add("flush_fresh")\n',
(
' if (\n'
' "private func flushFreshLaunchLiveOnlySettingsIfNeeded(" in ours\n'
' and "private func flushFreshLaunchLiveOnlySettingsIfNeeded()" in theirs\n'
' and "guard supportsMTPLXLiveControls else {" in theirs\n'
' and "guard let pending = pendingLiveSettings" not in ours\n'
' ):\n'
' text = ours\n'
' if not text.endswith("\\n"):\n'
' text += "\\n"\n'
' text += (\n'
' " guard supportsMTPLXLiveControls else {\\n"\n'
' " pendingLiveSettings = nil\\n"\n'
' " pendingLiveSettingsModel = nil\\n"\n'
' " settings = nil\\n"\n'
' " return\\n"\n'
' " }\\n"\n'
' )\n'
' kinds.add("flush_fresh")\n'
),
"flushFreshLaunchLiveOnlySettingsIfNeeded",
)

extra_patch = Path(".github/temporary-pr254-extra.py")
if extra_patch.exists():
namespace = {"rebase": rebase}
exec(compile(extra_patch.read_text(encoding="utf-8"), str(extra_patch), "exec"), namespace)
rebase = namespace["rebase"]

blocks[0] = rebase
Path("/tmp/pr254-rebase.sh").write_text(blocks[0] + "\n", encoding="utf-8")
Path("/tmp/pr254-squash.sh").write_text(blocks[1] + "\n", encoding="utf-8")
Path("/tmp/pr254-validate.sh").write_text(blocks[2] + "\n", encoding="utf-8")
PY

cat > /tmp/pr254-run.sh <<'SH'
set -euo pipefail
git reset --hard d079df37916f646f0a5b34343f317a03aa3a2e07
bash -n /tmp/pr254-rebase.sh
bash -n /tmp/pr254-squash.sh
bash -n /tmp/pr254-validate.sh
bash /tmp/pr254-rebase.sh
rm -f \
.github/workflows/temporary-materialize-pr254.yml \
.github/workflows/temporary-rebase-254.yml \
.github/workflows/temporary-execute-rebase-254-macos14.yml \
.github/workflows/temporary-execute-rebase-254-quote-fix.yml \
.github/pr254-wrapper-template.yml \
.github/temporary-rebase-254-trigger.txt \
.github/temporary-pr254-extra.py
bash /tmp/pr254-squash.sh
test "$(git rev-list --count upstream/main..HEAD)" = "1"
test "$(git rev-parse HEAD^)" = "$(git rev-parse upstream/main)"
test -z "$(git diff --name-only upstream/main...HEAD -- '.github/workflows/temporary-*' '.github/pr254-wrapper-template.yml' '.github/temporary-*')"
git show -s --format=%B HEAD | grep -F "Signed-off-by: Philip John Basile <PBasile@Basilecom.com>"
git diff --check upstream/main...HEAD
bash /tmp/pr254-validate.sh
SH

set +e
bash /tmp/pr254-run.sh > /tmp/pr254-run.log 2>&1
status=$?
set -e
cat /tmp/pr254-run.log

if [ "$status" -ne 0 ]; then
git rebase --abort >/dev/null 2>&1 || true
git reset --hard upstream/main
mkdir -p diagnostics
cp /tmp/pr254-run.log diagnostics/pr254-current-main-failure.log
git add diagnostics/pr254-current-main-failure.log
git commit -m "diagnostics: capture PR 254 current-main failure"
git push \
"https://x-access-token:${GH_TOKEN}@github.com/PhilipJohnBasile/MTPLX.git" \
HEAD:agent/pr254-failure-log --force
exit "$status"
fi

candidate="$(git rev-parse HEAD)"
git push \
"https://x-access-token:${GH_TOKEN}@github.com/PhilipJohnBasile/MTPLX.git" \
HEAD:sync/pr254-rebased-inspect --force
{
echo "## PR 254 current-main candidate"
echo ""
echo "- upstream main: \`$(git rev-parse upstream/main)\`"
echo "- validated candidate: \`$candidate\`"
echo "- commits ahead: 1"
echo "- temporary repair files: absent"
echo "- focused Python, package, hygiene, full Swift test, and release build: passed"
} >> "$GITHUB_STEP_SUMMARY"
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,30 @@ comfortable. MTPLX defaults Laguna to a 32,768-token context
and response cap, and checks larger explicit server contexts against the active
Metal memory cap.

[DeepSeek-V4-Flash-0731 MLX M5 Max Target-Only](https://huggingface.co/philipjohnbasile/DeepSeek-V4-Flash-0731-MLX-M5Max-TargetOnly)
uses a separate, experimental external runtime route. MTPLX pins the public
artifact to `ac33e4f3ca3546e6cec104558d42161e15814e33`, admits the exact 44
weight shards and required sidecars, then delegates serving to a separately
installed `mlx-serve` executable. This is target-only AR — it has no MTP or
DSpark weights — and it is not a native MTPLX backend:

```bash
mtplx pull philipjohnbasile/DeepSeek-V4-Flash-0731-MLX-M5Max-TargetOnly

MTPLX_MLX_SERVE_BIN=/path/to/mlx-serve \
mtplx serve \
--model philipjohnbasile/DeepSeek-V4-Flash-0731-MLX-M5Max-TargetOnly \
--no-mtp --host 127.0.0.1 --port 8000 --yes
```

The route requires a 128 GB Apple Silicon Mac, defaults to an 8,192-token
context, disables PLD, decode-attention quantization, and vision, and preserves
the external runtime's memory preflight. MTPLX clears ambient `MLX_SERVE_*`
settings and launches with `MLX_SERVE_WIRED=fit` plus a 256 MB cache limit;
set `MTPLX_DSV4_WIRED` only to make an explicit override. Representative
streaming performance is unapproved, so neither this integration nor its dry
run output makes a throughput claim.

## What MTPLX is not

- Not an external-drafter system. The drafter is the target model's own MTP heads.
Expand Down
Loading