Skip to content

engine upgrade: bring the fleet to main's head in one command - #233

Merged
dinoderek merged 3 commits into
mainfrom
task/engine-62
Nov 10, 2026
Merged

dinoderek merged 3 commits into
mainfrom
task/engine-62

Conversation

@dinoderek

Copy link
Copy Markdown
Owner

Objective

engine upgrade [--dry-run] brings every host in hosts.toml, the caller included, to the head of main. The run: preflight; read the target once; stop the server's systemd unit; back up with the binary the server ran; install the engine and the caller's plugins (through the new harness.Setup.PluginUpdate); set up the server's host with the new binary; start the server (it starts on every exit once the stop was tried, an interrupt included); set up the rest; then report per host and exit 1 while anything is open. Server task t62, plan p53.

Gates

Lane Result Evidence
./dev test (every required lane) PASS head 494680f: format, vet, lint, unit, coverage (92.4%), file-length, imports, versions, docs-check, harness-names all PASS
  • New or changed tests:
    • internal/upgrade/upgrade_test.go: order on a three-host fleet (remote server host, and the caller as server host); target read once; every setup runs the new ~/.local/bin/engine; every refusal names its cause and changes nothing; --dry-run; interrupts before and after the stop.
    • internal/upgrade/failures_test.go: O3 (a failed server-host setup, install, backup or stop, a broken or wrong installed binary, the server host lost after the stop: each still starts the unit; a failed or silent start names journalctl); O5 (an unreachable host and an open setup leave the others set up and exit 1); plugin-update failures stay open.
    • internal/cli/upgrade_test.go: cli.Run dry-run runs only reads; a busy task exits 1; bad flags exit 2 with the usage.
    • internal/harness/claude/setup_test.go, internal/harness/codex/pluginupdate_test.go: each adapter's exact plugin-update commands.
  • Not run, with reason: none. The live check, one real engine upgrade, is the plan's post-merge step for the operator.

Rulings

Low-risk decisions

Ruling (risk: low): preflight also refuses when the unit is not active, so a backup can never race a server running outside the unit (documented in operator-setup.md).
Ruling (risk: low): --dry-run runs the read-only preflight and the target read, then prints the numbered steps.
Ruling (risk: low): after the start, the run polls the server's task list 30 times, 1s apart (injected Sleep).
Ruling (risk: low): an interrupt (SIGINT/SIGTERM) ends the run early but still starts a stopped server; the caller's install is checked by running the new binary before any setup uses it.
Ruling (risk: low): the replace of the running binary is justified by a cited reason in internal/upgrade/fleet.go (cmd/go renames, or removes then creates), not a real-process test.

No review rulings.

Review

  • Fresh reviewer: Claude Code, claude-opus-5-5, three rounds. Round 1 on 5cd8a26: APPROVED with optional findings, of which four were fixed in 700a69f. Round 2 on 700a69f: APPROVED. Round 3 on the merge with main, 494680f: APPROVED.
  • Declined findings (all optional):
    • Share setup's hostEngine with the report's commit reader: setup's version also reads the Go toolchain and returns another type. The duplicate is about ten lines.
    • "did not answer within 30s" understates a server that hangs per request: 30s is the bounded retry budget the message names; each call is already capped by the client's timeout.
    • ENGINE_SERVER_URL could point the task check at another server: every engine CLI honours it on purpose, and the engine sessions that set it are refused anyway because their own task is running.
    • Telling the operator to stop a tmux server before enabling the unit: the refusal already prevents a raced backup, and the transition is a one-time manual step.
    • Spell out the Mac host's install commands: the card reduces Upgrading to the command and the unit. The by-hand order is one sentence, and setup's section has the plugin commands.
    • A better command for an adapter with no plugin-update commands: hosts.toml already rejects a listed harness with no bin for Codex, so the path is near unreachable.
  • Review hard: internal/upgrade/plan.go (execute: start-on-every-exit logic), internal/upgrade/preflight.go (refusals), internal/harness/setup.go (the interface change).

Deviations

  • docs/project-structure.md gets no row for internal/upgrade: main's trim, merged here, groups the product packages into one row, "one per component or command", which covers it. docs/architecture.md names it in the adapter sentence.
  • None else.

🤖 Generated with Claude Code

https://claude.ai/code/session_012F3VVBf6JkXJCACGLzAGuG

dinoderek and others added 3 commits November 10, 2026 19:16
Task t62 (plan p53).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012F3VVBf6JkXJCACGLzAGuG
…r host's order

Task t62 (plan p53), review round 1's optional findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012F3VVBf6JkXJCACGLzAGuG
# Conflicts:
#	docs/architecture.md
#	docs/project-brief.md
#	docs/project-structure.md
@dinoderek
dinoderek merged commit 836fd24 into main Nov 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant