Skip to content

fix(core): correct AMD discovery and MCP/P2P handling - #13044

Merged
mudler merged 9 commits into
masterfrom
fix/small-pr-validation-batch
Nov 3, 2026
Merged

mudler merged 9 commits into
masterfrom
fix/small-pr-validation-batch

Conversation

@mudler-agent

@mudler-agent mudler-agent commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Combine five focused fixes, rebased on current master:

Original authors and sign-offs are kept (Stefan Walcz, Vivek1898, leilei3167). Maintainer commits on top: pass the limits choice through application and node configuration, test cleanups, and the changes below.

Changes made while taking the PR over:

  • Rebased on master; one conflict in core/cli/run.go (flag list) resolved by keeping master's flags and adding the new one.
  • The p2pWorkerCommand constant was flagged by gosec G101 ("potential hardcoded credentials": the name contains pw). Renamed to workerJoinCommand; gosec reports no G101 in core/cli now.
  • The new P2PEnableLimits fields were exposed as --p-2-p-enable-limits, not the --p2p-enable-limits the docs describe. Set the flag name explicitly on run, explorer and both P2P workers, with a test that parses the documented spelling (it fails without the fix).
  • Removed a P2P test that computed its own input and could not fail.
  • The earlier Ginkgo failures in the chats journeys came from master tests that were stale after the add-on changes; test: update stale tests after the add-on owner and Sandbox skill changes #13045 fixed them and this branch includes it.

Notes for Reviewers

The MCP timeout reuses the distributed config value MCPToolTimeout (default 360 s) for connectors in every mode. Resource limits are now off by default, which is the documented behaviour; before, they were on by default.

Local verification (Go 1.2x, generated protobuf sources, placeholder UI dist):

go test -race -count=1 -tags "debug auth" ./core/application/ ./core/cli/... ./core/config/ \
  ./core/explorer/ ./core/p2p/ ./pkg/xsysinfo/ ./core/services/studio/mcpconns/
golangci-lint run --build-tags "debug auth" ./core/application/ ./core/cli/... ./core/explorer/ ./core/p2p/ ./pkg/xsysinfo/
gosec ./core/cli/          # no G101
node tests/unit/run.mjs    # Node 22: swarm and join-command tests pass

Not run locally: browser e2e (add-node, addon-navigation), the Docker-based backend e2e suite, real AMD hardware.

Signed commits

  • Yes, I signed my commits. Original authors' sign-offs are preserved; maintainer commits carry the maintainer's sign-off.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable

mudler
mudler previously approved these changes Nov 2, 2026
Comment thread core/cli/run.go Outdated
// generates a token, and a test parses it against the CLI so it cannot drift
// from the command tree again (it named the pre-v4 `worker` command for a
// release cycle).
const p2pWorkerCommand = "local-ai p2p-worker p2p-llama-cpp-rpc"
walcz-de and others added 9 commits November 3, 2026 09:17
getAMDGPUMemory only asked rocm-smi. ROCm 7+ images no longer ship it
(only amd-smi, whose Python module is missing in the image), so on an
AMD Strix Halo (gfx1151, ROCm 10.1 image) GET /api/resources returned
"gpus": null and aggregate.gpu_count 0, and the Models page said
"No GPU found. Fit is measured against 122.7 GB of memory" while
inference ran on the GPU.

The amdgpu driver exposes the same figures in sysfs, readable inside the
container:

  /sys/class/drm/card0/device/vendor              0x1002
  /sys/class/drm/card0/device/mem_info_vram_total 536870912
  /sys/class/drm/card0/device/mem_info_vram_used  240300032
  /sys/class/drm/card0/device/mem_info_gtt_total  128849018880
  /sys/class/drm/card0/device/mem_info_gtt_used   33055911936

When rocm-smi is absent or reports nothing, walk the DRM tree with the
existing scanSysfsGPUs (cardN only, connectors skipped, vendor 0x1002)
and report every card that has mem_info_vram_total. The GPU report is
built by one helper shared with the rocm-smi parser, so the
shared-memory APU rule from #12058 (GTT >= 8x VRAM folds GTT into the
totals) applies identically. GetResourceInfo, GetGPUAggregateInfo and
the fit check all read GetGPUMemoryUsage, so they now see the GPU;
DetectGPUVendor already consulted sysfs.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
(cherry picked from commit bf222ca)
A tool call through an MCP connector was cut after the connector
package default of 60 seconds, while the model's own MCP servers allow
360 seconds. Research and document tools behind a connector take
minutes, so a saved agent lost them mid-turn with "connection closed:
calling tools/call: client is closing" and the model fell back to a
weaker tool.

The connector service now gets the MCP tool timeout the rest of
LocalAI uses (DistributedConfig.MCPToolTimeoutOrDefault, 360 s by
default). The package default and the per-call output cap are
unchanged.

Tests in core/application start the connector service on JSON stores
against a slow MCP server: the timeout defaults to the MCP tool
timeout, a tool slower than the old cap but within the timeout
returns, and a tool past the timeout is still stopped.

Docs: chats-connectors.md, "How chats use them".

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
(cherry picked from commit 99f663a)
Root cause: #9124 moved the llama.cpp P2P worker under `p2p-worker` and
made `worker` the generic distributed worker, but the hint printed after
`run --p2p`, the Swarm page's command builder and the docs kept the old
`local-ai worker p2p-llama-cpp-rpc`, which the parser now rejects with
"unexpected argument p2p-llama-cpp-rpc". The MLX shard command had the
same stale prefix.

The hint becomes a constant that a test parses against the real CLI
tree, so the printed command cannot drift from the command set again.

Fixes #13032

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Vivek1898 <viveksingh27795@gmail.com>
(cherry picked from commit 3c11ab9)

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Root cause: #5889 changed the comparison to `!= "true"` while the result
still feeds ResourceLimit.Enable directly, so the libp2p resource manager
was enabled when the variable was unset and disabled when it was set to
"true" -- the opposite of the docs, and of the debug example that the same
PR added.

Extract newNodeConfig from newNodeOpts so the environment parsing can be
covered by a test.

Fixes #13031

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Vivek1898 <viveksingh27795@gmail.com>
(cherry picked from commit 404f861)
The function templates stored the few-shot JSON sample inside a Go raw
string that still had an extra pair of braces. text/template printed
that literal, so the prompt showed {{"example_name": "example_value"}}
and models copied invalid JSON.

Fixes #12890

Signed-off-by: leilei3167 <imleilei123@gmail.com>
(cherry picked from commit 72f1dc2)
Name the MCP tool explicitly so the Ginkgo-only lint rule does not
mistake its Run method for testing.T.Run.

Assisted-by: nib:gpt-6.1-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Pass the resource-limit choice through application and node configuration.
Keep only the exact string true enabled, including worker and explorer
entry points. Leave other legacy environment reads unchanged.

Assisted-by: nib:gpt-6.1-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

Assisted-by: Claude Code:claude-sonnet-5-5
Describe the 1.2-second case as success within its configured timeout,
not as exceeding the actual 60-second connector default.
Remove trailing whitespace from the P2P command example.

Assisted-by: nib:gpt-6.1-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
kong derives a flag name from the Go field name, so the P2PEnableLimits
fields were exposed as --p-2-p-enable-limits. The docs and the help text
describe --p2p-enable-limits. Set the name on the four commands that take
it (run, explorer, and the llama.cpp and MLX P2P workers) and parse the
documented spelling in the CLI boundary test.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

This branch was previously deployed

1 inactive deployment
github-pages — 438e5268 Deployed Nov 3, 2026 by mudler via deploy #860
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.

6 participants