4.0 KiB
r031: shell spawn and connection diagnostics
Confirmed on 2026-10-12 before any change:
- MUA r030 is
/usr/local/bin/mua, host plugin, process root/, not a container. /proc/<mua-pid>/cwd=/tmp/mua-storage-units-check (deleted)./proc/<mua-pid>/root/bin/shexists, symlink to bash.- Authenticated MCP: shell and connection-test reproduce ENOENT posix_spawn /bin/sh; read-only hostname succeeds on HomeServer.
Cause: r030 was started from the temporary installation directory, which was
later removed. runLocal/runShell inherited this deleted cwd, causing Bun's spawn
to fail before launching the existing interpreter. runReadOnlyCommand already
used explicit cwd /. This is not missing shell, container/SSH misrouting or
failed host connectivity. Local subprocess regression reproduces the same ENOENT.
Minimal fix:
- runLocal/runShell set cwd
/, like the read-only executor. - rc.mua starts daemon from
/, independent of install/update caller directory. - shell response adds execution metadata (local process host, Unraid marker, stable cwd/interpreter). Exit code/stdout/stderr remain present.
- controlled error JSON reports spawn/execution phase, system error code or timeout, interpreter existence and host, omitting command and raw exception text. Local process failures explicitly are not connection failures.
- connection test now returns structured JSON with transport arrival, authentication-before-dispatch (SSH login not applicable), and command-execution result separately. Handler arrival is not a new network probe from the client. Transport/auth errors before dispatch remain HTTP/network errors; the tool cannot diagnose an HTTP request which never reaches it.
No new permissions, mount, socket, transport, SSH setup or enabled tools. Command validation, API auth, risk classes and timeout checks retained. Read-only shell unchanged. No foreign containers restarted.
File transfer: existing abilities and limits
Actual tool list has unraid_files_inventory, which lists names only; no dedicated
upload/download/copy tool. Read-only shell cannot copy files. The unrestricted
shell can perform explicitly authorized host copies using existing host access:
Open-Terminal /home/user/<relative> is already bind-mounted from
/mnt/nvme-storage/appdata/Open-Terminal/workspace/<relative>.
A file there can be copied to the existing /mnt/user/Musik/<destination> after
checking source/destination and overwrite policy. No copy was performed in tests.
This mapping does not cover arbitrary terminal paths: files elsewhere inside the
container would need an explicitly authorized host docker cp or a different
existing mapping. No direct access to the MCP client's local files, no generic
remote SSH/SFTP upload bridge. Paths/data must never be invented or passed through
model context unnecessarily. Existing root-shell permission required and unchanged.
Validation, installation and restore
23 Bun tests (82 assertions), including inherited-deleted-cwd reproduction and
successful fixed execution, spawn error diagnostics/secret omission, command error
versus transport, existing safety/concurrency tests. TypeScript and rc.mua syntax
checks. Live scripts/verify-live-shell.php: exclusively hostname and existence
of /mnt/user/Musik, connection identity, existing read-only hostname, unauthenticated
401 versus authenticated transport, and daemon cwd /.
Package release r031; SHA256 and plugin manifest validation. Install only MUA
when health tool_calls.active is zero; start service from /. Configuration,
API key and tool permissions retained. Remove temporary installation artifacts
only after live acceptance. Host/media/share data untouched.
Restore: existing r030 package remains in dist and on Unraid. After confirming
no active MUA calls, run cd / then upgradepkg with the prior package and restart
rc.mua from /. Restore the matching prior plugin manifest from Git. Restoring
r030 removes the new diagnostics; shell calls can fail again if a future daemon
start inherits a deleted directory. No configuration/credential rollback needed.