Skip to content

fix(amd395): align Linux local model engines - #106

Merged
rjckkkkk merged 83 commits into
developfrom
amd395-linux
Aug 11, 2026
Merged

fix(amd395): align Linux local model engines#106
rjckkkkk merged 83 commits into
developfrom
amd395-linux

Conversation

@qinyue0508-cmd

@qinyue0508-cmd qinyue0508-cmd commented Aug 8, 2026

Copy link
Copy Markdown

Summary

  • unify native import, scan, resolver, and runtime handling for real root/bin/aima-engine + root/{lib,libexec,amdgcn} bundles
  • reject imports unless the promoted binary passes --version, is scan-visible, resolver-visible, and version-valid
  • persist/display detected_version and version_match; block unknown, mismatch, stale, and missing native binaries from deploy
  • make explicit model_path override an opposite-format DB row in both BF16/safetensors and GGUF directions
  • accept compatible llama.cpp revisions and use the AMD APU unified-memory pool for deployment admission

Final head and provenance

  • PR head: a426526b2fa2f4f0281fa792f066dc7a12fd17f8
  • Latest develop ancestor: d4de6c5b8dcf15ebb7ffc24ec5316547d770d79a
  • Baiying-tested package: aima-linux-amd64-v0.5-dev-amd-strix-halo-a426526b2fa2
  • Baiying-tested package binary SHA256: 9bb23bf7879f4dafc819d5aba5037bcfa93ee3862571763dbd2551eec8fc2ccf
  • build-metadata.json.git_commit: a426526b2fa2f4f0281fa792f066dc7a12fd17f8
  • Build time: 2026-08-11T03:45:00Z
  • Merge state: no conflicts with develop

GitHub Actions artifact (a separate object from the Baiying-tested package binary):

  • Name: aima-amd395-linux-a426526b2fa2
  • Artifact ID: 9088025507
  • AMD395 Linux Build run: 31455880915
  • ZIP archive digest: sha256:c4dd5ad96114ce27adc4dc8ebf57604464e84bc3e1983b0005dd6921fbfebdd1
  • Archive size: 26420253 bytes
  • Head SHA: a426526b2fa2f4f0281fa792f066dc7a12fd17f8

The ZIP archive digest and tested binary SHA256 identify different objects. Build time is embedded, so independently produced exact-head binaries need not be byte-identical.

Automated validation

All passed on a426526b2fa2f4f0281fa792f066dc7a12fd17f8:

go test ./... -count=1
go vet ./...
go test -race ./internal/engine ./internal/knowledge ./internal/hal ./cmd/aima -count=1

CI on the same head:

AMD395 Linux Build  success  run 31455880915
First Run Smoke     success  run 31455883710

Baiying AMD395 final-head validation

Target: baiying-algorithm-public@192.168.120.178

Isolation:

test root:     /tmp/aima-pr106-a426-codex.1KX99H
AIMA_DATA_DIR: /tmp/aima-pr106-a426-codex.1KX99H/data-main
ports:        18190, 18191, 18192, 18193
negative-only ports: 18197, 18198

Artifact verification on the machine:

$ sha256sum aima-linux-amd64-v0.5-dev-amd-strix-halo-a426526b2fa2
9bb23bf7879f4dafc819d5aba5037bcfa93ee3862571763dbd2551eec8fc2ccf

$ aima version
aima v0.5-dev
build:  2026-08-11T03:45:00Z
commit: a426526b2fa2f4f0281fa792f066dc7a12fd17f8

HAL

$ AIMA_DATA_DIR=<isolated> aima hal detect
GPU: AMD Radeon 8060S Graphics
Architecture: RDNA3.5 / gfx1151
VRAM/unified pool: 98304 MiB
unified_memory: true
ROCm: 7.2.3
System RAM: 127940 MiB

Native bundle import, scan, resolver, and runtime

The source is a 371MB production bundle with bin, lib, libexec, and amdgcn.

$ AIMA_DATA_DIR=<isolated> aima engine import <native-1.5.1-bundle-root>
Engine imported from <native-1.5.1-bundle-root>

$ AIMA_DATA_DIR=<isolated> aima engine scan --runtime native
native_matches=1
binary_path=/tmp/aima-pr106-a426-codex.1KX99H/data-main/dist/linux-amd64/aima-engine-native-amd395/1.5.1/bin/aima-engine
catalog_version=1.5.1
detected_version=1.5.1
version_match=exact
available=true

engine list persisted the same nested binary, version evidence, lifecycle_status=verified, and verification_status=verified. engine info aima-engine-native-amd395 showed catalog and installed version 1.5.1.

After unset AIMA_ENGINE_DIR, resolver/deploy selected the dist binary:

.../dist/linux-amd64/aima-engine-native-amd395/1.5.1/bin/aima-engine
  serve --model-dir /home/baiying-algorithm-public/models/Qwen3.6-35B-A3B
  --host 127.0.0.1 --port 18190 --cache-capacity 9216 --context-tokens 8192

$ <dist-binary> --version
aima-engine-native 1.5.1-native

health: HTTP 200, model_loaded=true, resident=true
/v1/chat/completions: HTTP 200, content="AIMA-A426-NATIVE-OK"
deploy status: phase=running, ready=true, recovery_state=healthy

Single-file import of source bin/aima-engine discovered and copied its companion bundle. The imported result contained bin/lib/libexec/amdgcn, returned aima-engine-native 1.5.1-native, and scanned exact/available. It did not leave an unusable launcher.

Native version gate

Reviewer commit dc18f05 advanced the final-head catalog requirement from 1.5.0 to 1.5.1 after the earlier validation. Final-head evidence therefore uses 1.5.1 as exact and treats both older installations as unavailable:

1.5.0: catalog=1.5.1 detected=1.5.0 version_match=mismatch available=false
deploy exit 1: requires catalog version 1.5.1; detected 1.5.0 (mismatch)

1.4.1: catalog=1.5.1 detected=1.4.1 version_match=mismatch available=false
deploy exit 1: requires catalog version 1.5.1; detected 1.4.1 (mismatch)

1.5.1: catalog=1.5.1 detected=1.5.1 version_match=exact available=true

llama.cpp ROCm/HIP and UD-Q4 GGUF

Imported bundle: official-b9637

source version: 9637 (aedb2a5e9)
binary_path=/tmp/aima-pr106-a426-codex.1KX99H/data-gguf/dist/linux-amd64/llamacpp-hip-linux/9637/llama-server
detected_version=9637
catalog_version=b9330
version_match=compatible
available=true

With AIMA_ENGINE_DIR unset, deploy selected that dist binary and the UD-Q4 model:

.../llamacpp-hip-linux/9637/llama-server
  --model .../Qwen3.6-35B-A3B-UD-Q4_K_M.gguf
  --port 18191 --cache-ram 0 --ctx-size 8192 --n-gpu-layers 999 --parallel 1

ROCm0: AMD Radeon Graphics (98304 MiB, 124706 MiB free)
health: HTTP 200
/v1/chat/completions: HTTP 200, content="AIMA-A426-GGUF-OK"
system_fingerprint: b9637-aedb2a5e9
deploy status: phase=running, ready=true, recovery_state=healthy

Explicit model_path precedence

Both opposite-DB-format directions were scanned into the DB and actually deployed without forcing --engine:

DB row: GGUF
explicit model_path: BF16/safetensors directory
selected: dist aima-engine-native 1.5.1
result: HTTP health 200

DB row: safetensors/BF16
explicit model_path: UD-Q4 GGUF file
selected: dist llamacpp-hip-linux b9637
result: HTTP health 200

Cleanup

ports 18190/18191/18192/18193/18197/18198: no listeners
processes under /tmp/aima-pr106-a426-codex.1KX99H: none
available RAM after cleanup: 124862 MiB

@rjckkkkk please re-review final head a426526b2fa2f4f0281fa792f066dc7a12fd17f8. This evidence was regenerated after your dc18f05 and a426526 commits, using the same final head for the artifact, automated tests, CI, and Baiying hardware validation.

@qinyue0508-cmd
qinyue0508-cmd requested a review from rjckkkkk August 8, 2026 02:08

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

我在 Baiying AMD395 Ubuntu 测试机上对当前 head a17a1c3b162c19dd8c69ede1569975775e571edc 做了复验。当前不能批准,下面几项需要修复并在同一个新 head 上重新完成实机验证。

必须修改

  1. 修复 native bundle 导入“成功但不可用”

    当前 head 的现场结果:

    • 单文件导入 .../bin/aima-engine 返回成功,扫描也显示 1 个 native engine,但 dist 中只有 706568-byte launcher;执行导入后的 aima-engine --version 退出 127,报 bundled ELF loader is missing。最新的 configured companion 查找仍覆盖不到真实 bundle 的 root/bin/aima-engine + root/{lib,libexec,amdgcn} 布局。
    • 按文档建议导入完整 371MB bundle 目录后,dist/bin/aima-engine --version 可以运行,但 aima engine scan --runtime native 返回 native_matches=0[]。扫描器只检查 dist 根目录且不递归,runtime/catalog 又只解析 bare aima-engine
    • ImportEngine 丢弃导入后的 scan 结果,因此上述两种情况都会静默返回成功。

    请统一 import、scan、runtime 对 bundle root / nested binary 的解析规则。只有当导入后的 binary 可被扫描、可被 resolver 定位,并通过最小 --version smoke 时,import 才能返回成功。新增真实目录拓扑测试:root/bin/aima-engineroot/libroot/libexecroot/amdgcn,不要只测 binary 与 so 同目录的简化 fixture。

  2. 强制校验预装 native engine 必须是 catalog 声明的 1.5.0

    catalog/engines/aima-engine-native-amd395.yaml 声明 version: 1.5.0,但当前 scanner 只要 regex 捕获到任何版本就标记 version_match=exact,没有和 catalog version 比较;unknown/mismatch 仍然 available=true,入库时还丢弃 DetectedVersion/VersionMatch。测试机上同时存在 1.2.0、1.3.0、1.4.0、1.4.1 和 1.5.0,这会让旧版被当成 1.5.0 使用。

    请比较实际版本与 catalog 期望版本;unknown/mismatch 至少必须阻止 deploy,并持久化、展示 detected version 和 match 状态。

  3. 显式 model_path 必须优先于扫描 DB 中的 format

    当前 resolveWithFallback 会先无条件应用同名 DB row 的 WithModelFormat。双格式模型中,如果 DB 记录的是 GGUF,而调用方显式传入 BF16/safetensors 路径,native variant 会在检查显式路径前被过滤;反向同理。请以显式路径识别出的格式为准,或在提供 model_path 时不要套用无关 DB row 的格式,并补两个方向的回归测试。

  4. 先 rebase 最新 develop 并解决冲突

    PR 当前仍为 CONFLICTING / DIRTY,且包含 159 个文件、96 个 commits;需要在解决冲突后的最终 head 上重新验证,不能复用旧 SHA 的结果。

必须完成的测试机验证

请使用修复后的同一个最终 head SHA 构建 artifact,并把以下命令、关键输出、SHA256 和 build-metadata.json.git_commit 记录到 PR 描述或 evidence 文件:

  1. 在 Baiying AMD395 上确认 HAL:Radeon 8060S / gfx1151 / 98304 MiB unified memory。
  2. 使用隔离的 AIMA_DATA_DIR 和未占用端口,不影响已有服务。
  3. 导入完整 native bundle,随后:
    • engine scan/list/info 能看到导入后的 nested binary;
    • detected version 为 1.5.0、match 为 exact;
    • unset AIMA_ENGINE_DIR 后 resolver/deploy 仍使用 dist 内导入的 binary;
    • --version、health 和一次 /v1/chat/completions 均成功。
  4. 单文件导入必须满足二选一:导入后可独立运行,或在导入阶段以明确错误拒绝;不能返回 success 后留下不可运行 launcher。
  5. 负向测试:分别扫描 1.4.1 和 1.5.0;1.4.1 必须 mismatch/unavailable 且不能 deploy,1.5.0 必须 exact/available。
  6. 双格式验证:
    • safetensors/BF16 解析并实际运行在 aima-engine-native
    • UD-Q4 GGUF 解析并实际运行在 llama.cpp ROCm/HIP;
    • 显式 model_path 覆盖 DB 中相反格式的两个方向都正确。
  7. 运行并记录:
    • go test ./... -count=1
    • go vet ./...
    • go test -race ./internal/engine ./internal/knowledge ./internal/hal ./cmd/aima -count=1
  8. 测试结束后清理临时进程和监听端口。

PR 描述目前仍写 Latest focused commit: 5011c98,原有 BF16/GGUF 实机结果不覆盖后续的 9319afa 和当前 a17a1c3 bundle/runtime 修改,请在最终 head 上重新给出完整证据。

Codex and others added 28 commits August 10, 2026 19:42
Prebuilt aima-windows-amd64.exe + serve.bat + handoff README for collaborator
R&D, on the develop + #78-#83 integration (Strix Halo hardware detection, model/
engine scan, draft-head + external-service n_guan, OpenClaw local-model sync).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The dist exe filename now carries its version string so a new build does NOT
overwrite the previous one in place. Two builds coexist:

  aima-windows-amd64-v0.5-dev-amd-strix-halo-20260610.exe  -> v0.5-dev-amd-strix-halo-20260610
      latest; adds the out-of-box AMD-HIP llama.cpp engine (#85, #86). serve.bat uses this.
  aima-windows-amd64-v0.5-dev-amd-strix-halo.exe           -> v0.5-dev-amd-strix-halo
      restored 2026-06-09 build (#78-#83 only, no HIP auto-download). Kept for rollback.

Both from source commit fc3ef41; filename == the exe's own `aima version` string.

- #85 llamacpp-hip-windows engine asset (go:embed'd into the exe + in source at
  catalog/engines/llamacpp-hip-windows.yaml, pins official b9330 win-hip-radeon-x64):
  a no-NVIDIA Strix Halo box auto-downloads the right ROCm/HIP llama.cpp instead of
  the CPU-only CUDA universal source.
- #86 native runtime resolves the engine binary against AIMA_ENGINE_DIR
  (dist -> AIMA_ENGINE_DIR -> auto-download -> PATH), so a pre-installed llama.cpp
  of ANY version is launchable -- the partner's llama.cpp version is supported
  whether or not it matches the bundled b9330.

Verified the latest build on the 395 rig: `aima version` ->
v0.5-dev-amd-strix-halo-20260610 / fc3ef41; `aima engine info llamacpp-hip-windows`
-> b9330 asset; `aima hal detect` -> RDNA3.5 gfx1151, ~110 GB VRAM.
README + serve.bat updated (build table; AIMA_ENGINE_DIR now optional).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
)

New version-stamped build aima-windows-amd64-v0.5-dev-amd-strix-halo-20260612.exe
(source commit fa35aa4) on top of the HIP-engine build. Adds, vs the 20260610 exe:

  #87 native deploy readiness uses the real runtime name (no false "not ready")
  #88 deploy launcher hidden (no cmd.exe console popup) via VBS launcher
  #89 Qwen2.5-VL-3B-Instruct catalog knowledge (vlm + aliases + verified perf)
  #90 zero-config vision: llama.cpp --mmproj auto-wired for VL gguf models
  #91 openclaw sync preflight-probes :6188 and warns loudly when unreachable

serve.bat now points at the 20260612 exe; older builds kept for rollback.
README build table + fixes list + OpenClaw data-plane guidance updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…text

A high catalog/user ctx_size (e.g. the 128000 default we now want for agent
clients) would OOM llama-server at load on memory-constrained machines — AIMA
previously passed ctx_size through unchanged (estimateVRAM ignores the KV cache;
CheckFit only adjusts vLLM/SGLang gpu_memory_utilization, never llama.cpp ctx).

On deploy, for llama.cpp GGUF models, size the context to the hardware:
- Read the model's real architecture from the GGUF header (new model.ReadKVArch:
  block_count / head_count_kv / head_dim / context_length) and compute exact f16
  KV bytes/token — not a guess.
- Clamp ctx_size down so weights + projector + KV cache fit usable memory (GPU
  VRAM for discrete GPUs, RAM minus an OS reserve for unified/CPU hosts), and cap
  it at the model's trained context. Only ever lowers; never raises.
- Graceful no-op when the GGUF arch can't be read or memory is unknown.

So a high default degrades gracefully: big boxes get the full context, small ones
auto-shrink to what fits instead of failing. Bump Qwen2.5-VL-3B default ctx_size
to 128000 (its trained max) now that it's memory-safe; the agent floor (~9.3K of
MCP tool schemas) always fits where the model fits.

clampContextForMemory / usableMemoryMiB are pure and unit-tested; verified on the
Strix Halo rig (request 200000 → clamped to trained 128000).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…K default

New version-stamped build aima-windows-amd64-v0.5-dev-amd-strix-halo-20260615.exe
(source commit 88ef097) on top of the 20260612 build. Adds:

  - Hardware-aware ctx_size clamping: reads the GGUF arch and fits the context to
    memory (weights + projector + KV) and the trained limit, only lowering it.
  - Qwen2.5-VL-3B default ctx_size 8192 -> 128000, now memory-safe everywhere:
    big boxes get 128K, constrained boxes auto-shrink instead of OOM-ing. Fixes
    OpenClaw agent "context overflow" (its MCP-tool-schema prompt exceeds 8192).

serve.bat points at the 20260615 exe; older builds kept for rollback.
README build table + fixes list + rebuild note updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…en3-Embedding-4B

Set each model's catalog default ctx_size to its full trained context (verified
loading + serving on the Strix Halo iGPU, 2026-06-16):
- glm-4.7-flash llamacpp variant: ctx_size 8192 -> 202752.
- qwen3.6-35b-a3b: add a universal llamacpp GGUF variant (ctx_size 262144) + gguf
  source + scan-name aliases (Qwen3.6-35B-A3B-UD-Q4_K_M, qwen3.6-35b-a3b-q4_k_m);
  it previously had only vLLM/Blackwell variants.
- new qwen3-embedding-4b.yaml: type embedding, llamacpp variant with embedding=true
  (-> llama-server --embedding) + ctx_size 40960; serves /v1/embeddings (2560-dim).
  Deploy-only — embedding models are not written into OpenClaw config by sync.

These large ctx defaults are memory-safe via the deploy-time auto-clamp.

Also fix usableMemoryMiB to prefer GPU VRAM over system RAM: an all-offloaded
llama.cpp model is bounded by GPU memory, and on unified-memory APUs the OS-visible
RAM is under-reported (Strix Halo: ~32GB OS vs ~110GB iGPU). The clamp now uses the
iGPU pool, so it won't wrongly shrink contexts on such APUs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… fix

New aima-windows-amd64-v0.5-dev-amd-strix-halo-20260616.exe (source 80c7216). Adds the
verified catalog context windows (GLM-4.7-Flash 202752, Qwen3.6-35B-A3B 262144 with
a new llama.cpp variant + aliases, new Qwen3-Embedding-4B in --embedding mode), and
the auto-clamp now sizes against the iGPU memory pool instead of under-reported APU
system RAM. serve.bat -> 20260616; older builds kept for rollback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (env)

Two product-level controls so a partner integrating AIMA owns OpenClaw behavior
without code changes on their side (both honor CLI sync AND the serve auto-sync loop):

- AIMA_OPENCLAW_SET_DEFAULT=false — register the AIMA provider + models but do NOT
  set OpenClaw's primary/default chat model (leave the user's current primary alone).
  Unset = previous behavior (AIMA sets it). Threaded as Deps.SetDefaultModel *bool →
  SyncResult.SkipDefaultModel → mergeChatModelDefault early-returns (preserving prior
  ownership record so toggling back on works).
- AIMA_OPENCLAW_CONFIG=<path>/openclaw.json — write to a custom config dir (e.g. a
  partner using .byClaw instead of .openclaw). Skills, extensions and managed-state
  all follow filepath.Dir(ConfigPath), so the whole set relocates. This is purely
  AIMA-side and independent of the OpenClaw/byClaw product's own layout.

Verified on the Strix Halo rig: SET_DEFAULT=false → provider written, primary empty;
default → primary set; custom config dir → config+skills land under .byClaw.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lt + config dir)

The 2026-06-16 build now also carries AIMA_OPENCLAW_SET_DEFAULT and
AIMA_OPENCLAW_CONFIG (partner-controllable primary-model + custom config dir).
Same version-stamped filename; README rebuild note updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…w sync controls)

Q&A capturing this round's partner requests and how each is handled: the four model
context windows (tested + yaml'd), embedding-not-synced, AIMA_OPENCLAW_SET_DEFAULT,
historical-service-info read paths, and AIMA_OPENCLAW_CONFIG custom dir.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…alog-miss fix)

Committing pre-existing uncommitted work from the 2026-06-18 round on this build
box (issues 4 & 5 of the integration list), verified building + tests passing:

- Issue 4 / B2 — engine image registry via env: AIMA_ENGINE_REGISTRIES /
  AIMA_ENGINE_REGISTRY merged into resolved registries (engineRegistriesWithEnv),
  native binary mirror/registry resolution in internal/engine/binary.go, + tests.
- Issue 5 / A2 — multi-model OpenClaw sync: models absent from the catalog (no
  type) were skipped by sync; now fall back to the backend-reported model type so
  every deployed provider syncs (TestSyncUsesBackendModelTypeWhenCatalogMisses);
  drop the canManageChatModelDefault guard so the synced model is set as default.

Also includes the round's dist artifacts (20260618 exe + P0 assessment doc).
Preserved as-is before layering the 2026-06-22 A-item fixes on top.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ch, A6 undeploy hint

A1 (P0) — deploy canonicalizes the model name (alias "Qwen2.5-VL-3B-Instruct-Q4_K_M"
→ "qwen2.5-vl-3b-instruct"), so undeploy/status/logs with the original alias failed
to match. Add canonicalModelAlt(cat, name) and retry undeploy/status/logs with the
canonical name; surface the original via a requested_model field in deploy results.

A5 — make the serve OpenClaw auto-sync loop switchable: `aima serve --no-openclaw-sync`
or AIMA_OPENCLAW_SYNC=manual|off|false|0|no disables it (sync then only on explicit
`aima openclaw sync`). Default unchanged (auto).

A6 — undeploy now prints a hint that model files are kept and how to free disk
(`aima model remove --delete-files <name>`); undeploy semantics unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New aima-windows-amd64-v0.5-dev-amd-strix-halo-20260623.exe (source 88b83b5) with the
2026-06-22 doc's A-item fixes: A1 undeploy/status/logs by original name, A5
--no-openclaw-sync / AIMA_OPENCLAW_SYNC switch, A6 undeploy disk-cleanup hint.
Adds AIMA集成问题-解决说明-20260623.md (per-item solution guide incl. A3 AIMA_MODEL_DIR
multi-dir, A4 AIMA_ENGINE_DIR, A2/A7 status). serve.bat -> 20260623.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
B3 removed from tracking: 趋境 native engine's own inference isn't ready (06-09/10
testing: /health + /v1/models OK but /v1/chat/completions no-token/garbled, an
upstream source issue). AIMA-side onboarding (external import + routing) was already
validated; revisit only after the partner fixes the engine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Solutions doc B class now lists only B3 (native-server.exe, pending on partner's
  engine); dropped B1/B2/B4 entries per request.
- Remove dist/partner-p0-assessment-2026-06-18.md from the repo (internal assessment,
  not for GitHub). File remains in git history + on the build box.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ding item

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New build v0.5-dev-amd-strix-halo-20260625b (code commit 2bf8496):
- #1 port-allocation in-flight reservation (a later deploy no longer steals a
  still-loading deploy's port and bind-kills it).
- #3 verbatim deploy model name as the served identity (/v1/models, routing,
  aima.dev/model, llm.model, openclaw all use the exact name incl. quant suffix).
  Reverses A1 canonicalization for the served identity — flagged in dist/README.md
  and AIMA集成问题-补充修复-20260625b.md.

Updates serve.bat to launch the new build; README table + rebuild note; adds the
fix doc. The separate `failed to remove sequence` abort was reproduced as
engine-build-specific (AIMA's b9330 + b9180 both fine; the partner's custom
AIMA_ENGINE_DIR build is the culprit) — no AIMA change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rid recurrent seq_rm crash)

Qwen3.6-35B-A3B is a hybrid Gated-DeltaNet (recurrent) MoE. llama.cpp's recurrent
memory can't be partially truncated, so when llama-server reuses a slot's cached
prefix it calls llama_memory_seq_rm(seq, p0>0, -1), which fails -> GGML_ABORT
("failed to remove sequence ... p0=10") and the server crashes the moment a second
prefix-overlapping request arrives (e.g. the deploy warmup's second identical
"Hello"). A bare manual llama-server start sends no request, so it only looks fine.

Fix (YAML, per INV-1/2): set cache_prompt: false in the universal-llamacpp variant
default_config -> emits --no-cache-prompt, forcing a full KV clear (seq_rm(0,-1),
valid on recurrent) each turn. cache_ram:0 alone is insufficient (it only disables
the RAM cache, not in-slot prefix reuse). Also restored the Strix-Halo-stable
parallel:1 + cache_ram:0 that a prior force-push had dropped from this variant.

Verified on AMD Strix Halo (b9180 & b9196 HIP): identical + divergent-prefix
requests serve without crashing. Adds a runtime test asserting
cache_prompt:false -> --no-cache-prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ships aima-windows-amd64-v0.5-dev-amd-strix-halo-20260629.exe (built from 4a2a6c4),
carrying the cache_prompt:false catalog fix for the Qwen3.6-35B-A3B deploy crash on
llama.cpp HIP (hybrid recurrent partial seq_rm GGML_ABORT). serve.bat now points to
this build; README updated; prior builds kept for rollback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nc revocation

AIMA's openclaw sync is authoritative full-reconcile (+ a ~5s auto-sync loop), so a
model the user removes from OpenClaw gets re-added on the next sync. This adds a
persistent, reversible opt-out so a revoked model stays out until explicitly restored:

- ManagedState.ExcludedModels (persisted in aima-openclaw-managed.json); Sync skips
  excluded models and preserves the marker across the reconcile that rewrites the rest.
- openclaw.Exclude/Include: mark/unmark + run a reconciling sync.
- MCP tool `openclaw` gains action=exclude/include (param `model`) — OpenClaw calls this
  through the already-registered `aima` MCP server (operator profile); no new wiring.
- CLI: `aima openclaw exclude/include <model>`.
- status surfaces excluded_models.

Persistent (survives restart + the auto-sync loop) but reversible (include clears it).
exclude only revokes OpenClaw exposure; the model keeps serving in AIMA (undeploy is
separate). deploy does not auto-clear the marker; undeploy keeps it.
Integration guide for the partner: dist/AIMA-OpenClaw撤回同步集成-20260629.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ships aima-windows-amd64-v0.5-dev-amd-strix-halo-20260629b.exe (built from e0c8460)
with the OpenClaw exclude/include revocation feature (+ the 20260629 Qwen3.6 crash
fix). serve.bat points to it; README updated; prior builds kept for rollback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…al fix is engine b9330+

Root cause of the deploy crash is the llama.cpp ENGINE VERSION, not a catalog flag:
same-machine A/B (Strix Halo HIP, identical command + ×4-identical-Hello trigger) —
b9196 (7ba22c6a0) CRASHES, b9330 (328874d05) SURVIVES. Upstream fixed the hybrid
recurrent partial seq_rm GGML_ABORT between b9196 and b9330. The cache_prompt:false I
added in 4a2a6c4 was only a b9196 workaround and it disables the prompt cache (slower)
— pointless on a good engine. Removed it; documented the b9330+ engine requirement on
the variant instead. AIMA auto-downloads b9330 (llamacpp-hip-windows); if pinning
AIMA_ENGINE_DIR, use b9330+.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… fix = engine b9330+)

Ships aima-windows-amd64-v0.5-dev-amd-strix-halo-20260629c.exe (built from 342d31b),
which removes the cache_prompt:false Qwen3.6-35B workaround (the crash is the llama.cpp
engine version; b9330 fixes it, b9196 crashes) and keeps the OpenClaw exclude/include
feature. serve.bat -> 20260629c; README updated; prior builds kept for rollback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…works on b9196)

Ships aima-windows-amd64-v0.5-dev-amd-strix-halo-20260629d.exe (built from 0abff4d):
the deploy warmup now sends cache_prompt:false, so aima deploy of Qwen3.6-35B no longer
crashes on b9180/b9196 (the partner's engine) and keeps the prompt cache (full speed).
serve.bat -> 20260629d; README updated; prior builds kept for rollback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tive session

launchViaSchtasks uses schtasks /it (interactive token) to run the engine
in the desktop session (Session 1) for GPU display access. But /it only
launches a process when the invoking user has an active interactive session;
over SSH / headless AIMA runs in Session 0, where schtasks /run reports
success yet spawns nothing — the 30s PID poll then fails with
"discover PID after schtasks launch".

Make the Windows launch path session-aware:
- hasInteractiveSession() (ProcessIdToSessionId, no admin needed) gates schtasks
- no interactive session -> start the engine directly (detached) in-session
- schtasks failure -> fall back to direct start instead of erroring
- configureDetachedProcess now sets DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP
  +HideWindow so the direct-launched engine is self-standing (no console flash)

Verified headless on Strix Halo (Ryzen AI MAX+395, Win, no desktop login):
deploy -> 'starting engine directly' -> health pass -> warmup -> ready.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

我复查了当前最终 head ce93341979491eec481054f7cad6ea4599a2a648。代码层面的三组修复和新增回归覆盖方向正确,本地在该 SHA 上重新运行以下命令均通过:

  • go test ./... -count=1
  • go vet ./...
  • go test -race ./internal/engine ./internal/knowledge ./internal/hal ./cmd/aima -count=1

当前仍不能批准或合并,原因如下。

  1. 最终 head 尚未完成要求的 Baiying AMD395 实机验证

PR 描述明确写明 ce933419… 的硬件验证为 BLOCKED,且此前 review 中要求的 HAL、隔离数据目录与端口、完整 native bundle import/scan/list/info、unset AIMA_ENGINE_DIR 后 resolver/deploy、--version/health/chat、1.4.1 与 1.5.0 负正向、BF16 native、UD-Q4 llama.cpp ROCm/HIP、双向显式 model_path 覆盖,以及进程/端口清理均未在这个最终 SHA 上给出证据。旧 SHA 的结果不能替代最终 head。

我在 2026-08-11 UTC 重试 192.168.120.178:22 时,SSH banner 和密钥交换已经恢复,服务端允许 publickey/password;但当前评审环境中已有密钥未获授权,因此仍无法代为完成实机复测。请在同一个最终 head 上补齐此前列出的完整测试机证据后重新请求 review。

  1. artifact SHA 证据不一致

PR 描述写的 Artifact SHA256 是 43d1504980b6bcfda7460c19530d47a99232089bbccad2df62d88776990d7586,但当前 GitHub Actions artifact aima-amd395-linux-ce9334197949 的 API digest 是 sha256:f9b8b4844712c7c9fbf52ce9b09ea1ea72f4bea043f7f40add17d9b5f8c57da5;下载后包内二进制及 checksums.txt 记录的 SHA256 是 de91e23fc5f2739de671dbc6637f69227bfac3069320f3ee6c916ceca1dc5406build-metadata.json.git_commit 确实是 ce93341979491eec481054f7cad6ea4599a2a648。请明确每个 SHA 对应的对象并修正 PR 描述,确保测试机使用的正是可追溯到该 head 的这份 artifact。

两项 Actions 检查目前均通过,分支也与 develop 无冲突;但 CI 不能替代上述 AMD395 实机门槛。

@qinyue0508-cmd

Copy link
Copy Markdown
Author

@rjckkkkk 已按上一轮 review 要求完成修复,并在同一个最终 head bb710b199b48557cb5f7db5c17f91d7095d83382 上重新完成 Baiying AMD395 实机验证。

PR 描述已更新完整证据:HAL、隔离 AIMA_DATA_DIR/端口、native 完整 bundle 与单文件导入、1.4.1 mismatch / 1.5.0 exact、unset AIMA_ENGINE_DIR 后 dist resolver/deploy、BF16 native 与 UD-Q4 llama.cpp ROCm/HIP、显式 model_path 双向覆盖、health/chat、artifact SHA 对象区分及清理结果。三个本地测试命令和 2/2 CI 也均通过。请基于当前最终 head 重新 review。

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

我重新 review 了当前 head a426526b2fa2f4f0281fa792f066dc7a12fd17f8。该 SHA 上两项 Actions 检查通过,本地重新运行以下命令也全部通过:

  • go test ./... -count=1
  • go vet ./...
  • go test -race ./internal/engine ./internal/knowledge ./internal/hal ./cmd/aima -count=1

当前仍不能批准或合并,有两个阻塞项。

1. Baiying 实机证据不是当前最终 head

PR 描述和测试机证据锁定的是 bb710b199b48557cb5f7db5c17f91d7095d83382,但当前实际 head 已推进到 a426526b2fa2f4f0281fa792f066dc7a12fd17f8,中间新增:

  • dc18f054:Catalog native engine 从 1.5.0 改为 1.5.1,新增 cache_capacity: 9216,关闭 warmup,并改变运行能力声明;
  • a426526b:benchmark 的 temperature=0 行为修改。

这不是可由旧实测自动覆盖的无关重建。现有证据明确验证的是 1.5.0 exact/available 和 1.5.0 BF16 health/chat;在当前 Catalog 下,1.5.0 应变为 mismatch/unavailable,而且 1.5.1 的新启动参数与关闭 warmup 也尚未在硬件上验证。

当前 Actions artifact 是 aima-amd395-linux-a426526b2fa2,artifact API digest 为 sha256:c4dd5ad96114ce27adc4dc8ebf57604464e84bc3e1983b0005dd6921fbfebdd1,下载后二进制 SHA256 为 ebb1d454c7f1854f0aa741231fd8f95b0b38b7e25ff477544525d8394b60db5a,且 build-metadata.json.git_commit 为当前 head。PR 中记录的 Baiying-tested package 仍是 bb710b1 的不同二进制。

请在不再推进的最终 head 上,用对应 artifact 重新完成至少 1.5.1 import/scan/version gate、BF16 resolver/deploy、health/chat、新 cache_capacity 参数、GGUF 路径与清理验证,并更新所有 SHA 证据。

2. compatible llama.cpp import 无法完成文档声明的 ensure/deploy 生命周期

ImportNative 对 b9637 持久化的是:

  • Version = 9637
  • DetectedVersion = 9637
  • CatalogVersion = b9330
  • VersionMatch = compatible

internal/engine/lifecycle.goinstalledVersionMatches 仍只做原始字符串精确比较。默认 engine.ensure llamacpp-hip-linux --apply 请求 Catalog 版本 b9330,因此不会复用并激活刚导入的 9637

即使显式使用 --version 9637 激活,local overlay 会把 asset 版本改为 9637,而 validatedPreinstalledNativeBinary 仍要求 VersionMatch == exact;库存记录保持 compatible,部署会被拒绝。当前实测之所以能启动,是未激活的 dist binary 被 runtime 直接找到,绕过了文档要求的生命周期路径。

请统一 compatible 版本在 import、ensure、overlay 和 deploy gate 中的判定,并新增端到端回归:导入 b9637 → 默认或明确的 ensure apply → 激活该库存项 → deploy 必须选中同一 binary 并成功;不应依赖未激活 dist binary 的隐式发现。

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

Approved final head a426526. Both CI checks pass. The exact Actions artifact was verified and retested on Baiying AMD395 with isolated data/ports: native 1.5.1 directory and single-file import, 1.5.0 mismatch/deploy rejection, unset-AIMA_ENGINE_DIR dist deployment, BF16 and GGUF explicit-path precedence, llama.cpp HIP, AIMA proxy routing, deterministic benchmark temperature 0 (3/3 success), and complete process/port cleanup.

@rjckkkkk
rjckkkkk merged commit a1546ed into develop Aug 11, 2026
2 checks passed
@qinyue0508-cmd

Copy link
Copy Markdown
Author

更正上一条说明:在该说明发布后,@rjckkkkk 又提交了 dc18f05(native catalog 1.5.1)和 a426526,因此我没有复用 bb710b1 的硬件结果,而是基于最终合并 head a426526b2fa2f4f0281fa792f066dc7a12fd17f8 重新构建并完整跑了一遍 Baiying AMD395 验证。

PR 描述现已替换为 a426526 的最终证据:测试包 SHA256 9bb23bf7879f4dafc819d5aba5037bcfa93ee3862571763dbd2551eec8fc2ccf,metadata commit 与 head 一致;native 1.5.1 exact、1.5.0/1.4.1 mismatch 且禁止 deploy;native BF16、llama.cpp UD-Q4、双向显式 model_path、health/chat 均通过;三个本地命令及 2/2 CI 通过;隔离进程和端口已清理。PR 已由 reviewer 合并。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants