feat(remote): per-host remote config + rsync --rsync-path + scp -O for locked-down hosts #2

Open
s-celles wants to merge 1 commit from s-celles/feat/per-host-remote-rsync-path into main
s-celles commented 2026-07-15 12:57:06 -07:00 (Migrated from github.com)

Problem

Some NAS/appliance firmware ships a patched rsync that gates the server side to a whitelist of "shared folders", so a home-dir destination is rejected with invalid path during the "Provision env" step. The same devices often ship a disabled sftp subsystem, which makes the default (SFTP-protocol) scp fail with Permission denied. Both break remote-worker provisioning even when SSH and Julia themselves are fine — the preflight passes "SSH reachable" and "Julia present", then fails on "Provision env".

Changes

  • Per-host remote config. _rcfg/_rcfg_str gain a host= kwarg and a new _rcfg_hostval, so any remote knob resolves remote.hosts.<host>.<key> → global remote.<key>KAIMONSLATE_<ENV> → default. Host matching tolerates a user@host ssh target (falls back to the bare hostname). Fully backward compatible. Applies uniformly to the preflight, run_on <host>, and regions (a region provisions on its host, so it inherits that host's config automatically).
  • rsync_path knob. When set, _rsync! passes --rsync-path=<path> so provisioning uses a stock rsync you dropped in (e.g. ~/bin/rsync) instead of the firmware-patched one. It's a machine property, hence per-host (the preflight/provision runs before any region exists).
  • scp -O. The three provisioning scp -q calls become scp -O -q (legacy protocol), which bypasses sftp-server and works when SFTP is disabled. Harmless on normal hosts.
  • GUI. An "rsync path (advanced)" field in the Remotes-modal host form, with a ? help popover explaining when it's needed, saved per host via new GET/POST /api/host-settings (persist hook _HOST_CFG_PERSIST, installed at init, writes remote.hosts.<host>.rsync_path and refreshes the live config). Loads on host pick/blur; saved before "Test & prime" so a first-time locked-down host provisions with the right rsync in one click.

Config shape

{
  "remote": {
    "hosts": {
      "my-nas.local": { "rsync_path": "/home/you/bin/rsync" }
    }
  }
}

Any remote knob can be overridden the same way under remote.hosts.<host>.

Verification

End-to-end on a real locked-down NAS: the preflight (provision → KaimonGate load → spawn + connect + eval round-trip) now passes. Per-host resolution, the persist/prune hook, and region-host inheritance tested live; the GUI field + help popover rendered and checked.


Developed with AI assistance.

## Problem Some NAS/appliance firmware ships a **patched `rsync`** that gates the server side to a whitelist of "shared folders", so a home-dir destination is rejected with `invalid path` during the "Provision env" step. The same devices often ship a **disabled sftp subsystem**, which makes the default (SFTP-protocol) `scp` fail with `Permission denied`. Both break remote-worker provisioning even when SSH and Julia themselves are fine — the preflight passes "SSH reachable" and "Julia present", then fails on "Provision env". ## Changes - **Per-host remote config.** `_rcfg`/`_rcfg_str` gain a `host=` kwarg and a new `_rcfg_hostval`, so any remote knob resolves `remote.hosts.<host>.<key>` → global `remote.<key>` → `KAIMONSLATE_<ENV>` → default. Host matching tolerates a `user@host` ssh target (falls back to the bare hostname). Fully backward compatible. Applies uniformly to the preflight, `run_on <host>`, **and regions** (a region provisions on its `host`, so it inherits that host's config automatically). - **`rsync_path` knob.** When set, `_rsync!` passes `--rsync-path=<path>` so provisioning uses a stock rsync you dropped in (e.g. `~/bin/rsync`) instead of the firmware-patched one. It's a machine property, hence per-host (the preflight/provision runs before any region exists). - **`scp -O`.** The three provisioning `scp -q` calls become `scp -O -q` (legacy protocol), which bypasses `sftp-server` and works when SFTP is disabled. Harmless on normal hosts. - **GUI.** An "rsync path (advanced)" field in the Remotes-modal host form, with a `?` help popover explaining when it's needed, saved per host via new `GET/POST /api/host-settings` (persist hook `_HOST_CFG_PERSIST`, installed at init, writes `remote.hosts.<host>.rsync_path` and refreshes the live config). Loads on host pick/blur; saved before "Test & prime" so a first-time locked-down host provisions with the right rsync in one click. ## Config shape ```json { "remote": { "hosts": { "my-nas.local": { "rsync_path": "/home/you/bin/rsync" } } } } ``` Any remote knob can be overridden the same way under `remote.hosts.<host>`. ## Verification End-to-end on a real locked-down NAS: the preflight (provision → KaimonGate load → spawn + connect + eval round-trip) now passes. Per-host resolution, the persist/prune hook, and region-host inheritance tested live; the GUI field + help popover rendered and checked. --- Developed with AI assistance.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin s-celles/feat/per-host-remote-rsync-path:s-celles/feat/per-host-remote-rsync-path
git switch s-celles/feat/per-host-remote-rsync-path

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff s-celles/feat/per-host-remote-rsync-path
git switch s-celles/feat/per-host-remote-rsync-path
git rebase main
git switch main
git merge --ff-only s-celles/feat/per-host-remote-rsync-path
git switch s-celles/feat/per-host-remote-rsync-path
git rebase main
git switch main
git merge --no-ff s-celles/feat/per-host-remote-rsync-path
git switch main
git merge --squash s-celles/feat/per-host-remote-rsync-path
git switch main
git merge --ff-only s-celles/feat/per-host-remote-rsync-path
git switch main
git merge s-celles/feat/per-host-remote-rsync-path
git push origin main
Sign in to join this conversation.
No description provided.