8c69911252
Design-only artifacts for unifying saved tasks on ssh_tasks services. No implementation yet. - proposal: two-path problem (Actions→machine vs widget→service), goals, non-goals, grilling decisions (SSH-only, service_task_runs only, keep override) - design: shared run_saved_task helper, column rename, saved_task_runs dropped, API + frontend changes, 2-slice plan - tasks: backend (shared runner + router) + frontend (Actions page)
3.4 KiB
3.4 KiB
Proposal: Unify Saved Tasks on SSH Services
Change: unify-tasks-on-services
Phase: proposal
Date: 2026-06-19
Status: awaiting review (design only — no implementation yet)
Context and problem
Saved tasks (the Actions page) currently have two execution paths:
- Actions page → resolves a machine (
default_machine_id) → runs via_client_for_machine→ logs tosaved_task_runs. - SSH task widget → resolves an
ssh_tasksservice instance → runs via_build_ssh_client→ logs toservice_task_runs.
Same saved-task records, two runners, two history tables, two target models. This is the leftover inconsistency from the service-registry change (design §12): the widget was migrated to services but the Actions page was not.
Proposal
Migrate the Actions page onto the same ssh_tasks service model the widget
already uses, so there is one execution path and one history table.
- Saved tasks gain
default_service_id(replacesdefault_machine_id), pointing at anssh_tasksservice instance. - The Actions runner resolves an
ssh_tasksservice (the task's default, or an explicit run-time override), builds the SSH client from the service record, runs the task, and logs toservice_task_runs. saved_task_runsis dropped; both the Actions page and the widget readservice_task_runs.- Local (API-host) task execution is dropped — all tasks run over SSH against
ssh_tasksservices.
Goals
- One execution path for saved tasks (Actions page + widget share it).
- One run-history table (
service_task_runs). - Tasks target
ssh_tasksservice instances, consistent with the rest of the service registry. - Run-time override preserved: a task can be run against any
ssh_tasksinstance.
Non-goals
- No change to the jobs router (
/api/jobs/run, thedisk_usagetemplate, etc.). That stays machine-based for the File Browser's on-demand SSH checks. - No machine/service unification (follow-up #3). Machines still own File Browser + node_exporter transport.
- No local execution mode. Dropped per decision; tasks are SSH-only.
- No automatic data migration of
default_machine_id→default_service_id. Break backwards compatibility (consistent with the service-registry change): existing tasks lose their default target and the user re-points them.
Decisions (from grilling)
| Topic | Decision |
|---|---|
| Local execution | SSH-only. Drop local mode; ssh_tasks services handle all task execution. |
| Run history | service_task_runs only. Drop saved_task_runs. |
| Run-time override | Keep. A task can run against any ssh_tasks instance at run time. |
Risks
- Breaking upgrade. Existing tasks lose
default_machine_id; users re-point to anssh_tasksservice. Document in changelog. - Local-mode loss. Any deployment relying on local task execution must set up an SSH loopback (or an ssh_tasks service pointing at localhost with a key) to keep running local tasks.
- Shared execution code. The Actions runner and the widget must share one
run_saved_taskhelper to avoid divergence; extracting it is the core refactor.
Out of scope
- Machine/service unification (follow-up #3).
- Migrating the jobs router (
/api/jobs) off machines. - A UI for browsing
service_task_runsacross all services (the service page already shows per-instance history; the Actions page shows per-task history).