Repository navigation
Description
Problem
The prescribed recovery for an installation whose agent unit predates the upgrade guard is to run the installer again. The installer refuses any existing Shipkeep installation and has no migration mode. This leaves no supported in-place path from those installations to the guarded upgrade mechanism.
The existing-installation checks are valuable and should not simply be removed. A state-preserving migration path is needed instead of directing operators to a command that must refuse their server.
Audited revision: 1295e534d7a1c3cd0a492449de8806aa532a4924.
A pre-publication comparison of this snapshot with main 2ee78ff1e96118b1732b98bc54c99f5f91b95a32 found that the only intervening change was to apps/api/src/modules/deployments/application/exec-sessions.spec.ts. None of the affected production paths changed.
Scenario and evidence
- A server was installed before its systemd unit included the root-owned upgrade guard.
- The upgrade handler, when available, refuses an agent unit without that guard.
- The operator follows the documented instruction to run the installer again.
- The installer detects the existing configuration/state/service files or service accounts and exits before migration.
Source references:
- The upgrader refuses an absent or outdated guard.
- Its user-facing failure text says to run the installer again.
- ADR 0028 prescribes rerunning the installer for these older units.
- The installer's options expose no migration mode.
- Existing Shipkeep paths, accounts and groups are unconditionally refused.
- The README's reset procedure is explicitly for a disposable VM and removes configuration, agent state and Caddy state. It is not a production migration procedure.
Verification and limits
This is a source-verified operational contradiction. No installer was run on an existing server, no VM migration was attempted, and no state was deleted. A much older agent may not support UpgradeAgent at all; this issue does not assume it can report the newer handler's specific error. The documented installer fallback must still provide a supported way to migrate that installation.
Fresh installations with the new unit are not affected by this bootstrap gap. This issue is separate from whether the current binary-swap and rollback implementation works once the prerequisites are installed.
Proposed correction
Provide a narrow, explicit migration command or documented, tested procedure for supported legacy layouts. Verify ownership and recognized service layouts, stage the verified agent/guard and service changes, preserve identity and durable state, and make interruption/retry safe. Keep the ordinary installer strict for unknown existing installations.
Until that path exists, replace the misleading retry instruction with an accurate explanation of the required migration. Do not present deleting the installation as an in-place upgrade.
Acceptance criteria
- Start from a fixture matching a supported previous installation, including its old unit and binary path; migrate to the new guard/layout and then perform an agent upgrade.
- Preserve node identity/credentials, the operation journal, managed workload definitions, routes and Caddy state.
- Repeat the migration safely; interrupt each mutation boundary and verify retry or rollback leaves a runnable supported installation.
- Verify the old unit's fallback message points to a procedure that actually accepts it.
- Unknown or conflicting layouts remain refused with actionable diagnostics; migration never silently replaces unrelated services.
- Record real-VM acceptance under the parent upgrade work when that environment is available.
Related work
A concrete compatibility subtask of open #240, which tracks agent/control-plane upgrades and rollback. Related installer acceptance: #239. This report does not duplicate their full scope: it isolates the currently contradictory legacy-unit to guarded-upgrade bootstrap path. Closed #327 concerned retrying an interrupted Docker package installation on a fresh host; this concerns preserving and migrating a completed existing Shipkeep installation.
Activity
feat(agent): adopt-routes records the routes older agents left unreco…