Report an unreachable training host and offer a remote-training service #129

Merged
aluminum-ice merged 6 commits from feature/remote-training-service into main 2026-10-31 20:56:47 +00:00
Owner

What this PR does

remote-train now tells a training host it can't reach (or log in to) apart from one that's still being prepared. When ssh can't connect or log in, the card's Training line says "can't reach or log in to the host (last reached 3h ago)", the Plugins note names the host, the Host stack line keeps its last known state, and the plugin stops retrying host prep, pulls and launches until the host answers. Before, a desktop that was off showed as "installing" and each pass spent about a minute retrying.

It also keeps the last contact and the last model across daemon restarts (<agent_dir>/.remote-staging/remote-status.json), so "Last model pulled" no longer resets to "never", and it offers a remote-training service that other plugins can read: whether remote training is configured, the host state, the host's training-software state, the last contact, the last model and the running algorithms. The service never carries the host name, user, path, port or key path.

The algorithms help now says the agent's own algorithm is always trained, first, even when the list leaves it out (true since 1.0.11), and the on-device guide no longer says remote models are adopted when "fresher" (they win the same contest as on-device ones).

Checklist

  • Lint passes — make lint.
  • Tests pass — make test: 21 new remote-train tests (50 in all). Locally, test_gps_serial_reader_recovers_from_a_stalled_link fails and test_main_ignores_sighup ends the run early on this host, both on main too; CI runs them.
  • Nothing real: no secrets, no personal information, no real data. Tests use the existing desk/me//w placeholders.
  • Consent gates intact. Unchanged: remote-train still declares network and ships disabled.
  • Docs updated in the same PR: docs/developer/remote-training.md (the unreachable state, the status file, a section on the service), docs/developer/plugin-development.md (a table of the shipped services), docs/user-guide/remote-training.md, GUIDE_MD, pull-agent-diagnostics.sh (prints the status file), CLAUDE.md.
  • Commit messages are short and imperative.

Release impact

  • App-layer-safe — a plugin, a desktop script and docs.
  • Reflash-class

Notes for review

  • ssh exits 255 when it can't connect or log in; any other status is the remote command's own, so the host was reached. The plugin's host scripts never exit 255 (a comment at _SSH_FAILED keeps it that way).
  • _stack_ready() now returns None for "couldn't reach the host"; the existing tests' True/False stubs keep their meaning. _remote() keeps its (ok, output) contract; _remote_rc() adds the exit status and records the contact.
  • The status file is separate from host-models.json, which the plugin and the diagnostics script read as one record per algorithm.
  • The contact time is saved at most every ten minutes (the light poll runs every two).
  • The runtime state moved into _init_state(), which on_loaded and the test helper both call, so the two can't drift.
  • Plugin 0.1.0 → 0.2.0. The census plugin (planned) will be the first reader of the service.

🤖 Generated with Claude Code

## What this PR does `remote-train` now tells a training host it can't reach (or log in to) apart from one that's still being prepared. When ssh can't connect or log in, the card's Training line says "can't reach or log in to the host (last reached 3h ago)", the Plugins note names the host, the Host stack line keeps its last known state, and the plugin stops retrying host prep, pulls and launches until the host answers. Before, a desktop that was off showed as "installing" and each pass spent about a minute retrying. It also keeps the last contact and the last model across daemon restarts (`<agent_dir>/.remote-staging/remote-status.json`), so "Last model pulled" no longer resets to "never", and it offers a `remote-training` service that other plugins can read: whether remote training is configured, the host state, the host's training-software state, the last contact, the last model and the running algorithms. The service never carries the host name, user, path, port or key path. The `algorithms` help now says the agent's own algorithm is always trained, first, even when the list leaves it out (true since 1.0.11), and the on-device guide no longer says remote models are adopted when "fresher" (they win the same contest as on-device ones). ## Checklist - [x] **Lint passes** — `make lint`. - [x] **Tests pass** — `make test`: 21 new `remote-train` tests (50 in all). Locally, `test_gps_serial_reader_recovers_from_a_stalled_link` fails and `test_main_ignores_sighup` ends the run early on this host, both on `main` too; CI runs them. - [x] **Nothing real: no secrets, no personal information, no real data.** Tests use the existing `desk`/`me`/`/w` placeholders. - [x] **Consent gates intact.** Unchanged: `remote-train` still declares `network` and ships disabled. - [x] **Docs updated in the same PR**: `docs/developer/remote-training.md` (the unreachable state, the status file, a section on the service), `docs/developer/plugin-development.md` (a table of the shipped services), `docs/user-guide/remote-training.md`, `GUIDE_MD`, `pull-agent-diagnostics.sh` (prints the status file), `CLAUDE.md`. - [x] Commit messages are short and imperative. ## Release impact - [x] **App-layer-safe** — a plugin, a desktop script and docs. - [ ] **Reflash-class** ## Notes for review - ssh exits 255 when it can't connect or log in; any other status is the remote command's own, so the host was reached. The plugin's host scripts never exit 255 (a comment at `_SSH_FAILED` keeps it that way). - `_stack_ready()` now returns `None` for "couldn't reach the host"; the existing tests' `True`/`False` stubs keep their meaning. `_remote()` keeps its `(ok, output)` contract; `_remote_rc()` adds the exit status and records the contact. - The status file is separate from `host-models.json`, which the plugin and the diagnostics script read as one record per algorithm. - The contact time is saved at most every ten minutes (the light poll runs every two). - The runtime state moved into `_init_state()`, which `on_loaded` and the test helper both call, so the two can't drift. - Plugin 0.1.0 → 0.2.0. The `census` plugin (planned) will be the first reader of the service. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the remote-training service and an unreachable host
All checks were successful
Test / test (push) Successful in 26s
Lint / lint (push) Successful in 33s
Lint / lint (pull_request) Successful in 33s
Test / test (pull_request) Successful in 25s
a43f1189da
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch feature/remote-training-service 2026-10-31 20:56:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aluminum-ice/kestrel!129
No description provided.