Skip to content

fix(selfupdate): let older agents accept the next release - #187

Merged
ehsandeep merged 4 commits into
mainfrom
claude/selfupdate-preflight-compat
Nov 13, 2026
Merged

ehsandeep merged 4 commits into
mainfrom
claude/selfupdate-preflight-compat

Conversation

@ehsandeep

Copy link
Copy Markdown
Member

Impact

Agents on v0.2.0 to v0.2.3 can't update themselves: the Update button downloads the new release, then refuses it at preflight. Those agents stay on their version until someone reinstalls them by hand. With this change, the next release installs on them through the Update button.

RCA

Pressing Update on an agent did nothing; the agent stayed on its old version.
The old agent only accepted a new version if it was still running 15 seconds after a test start, but the new version stops right after saying "ok".
Every self-update from v0.2.0 to v0.2.3 is affected (the check in the old binary does the refusing).

Change

The new binary satisfies the old check, and the check is fixed for later releases.

  • In preflight mode the binary prints preflight ok, then waits 20s before exiting, without touching the database or NATS. That outlasts the old 15s window.
  • The preflight now passes as soon as it reads preflight ok on stdout. It fails if the binary exits or runs 30s without printing it.

Evidence

Real v0.2.2 agent on darwin/arm64 against a dev server, with PDCP_UPDATE_URL pointing at builds of this branch:

  • Update to v0.2.3 (before): refused with "exited cleanly without honoring PDCP_PREFLIGHT".
  • Update to this branch (after): "preflight passed" at the 15s window, then the binary swap and restart with the same agent id. The health check reports the new version, and a nuclei retest over NATS passes through it.
  • Next update from this branch: passes preflight in under 0.1s.
  • Unit tests cover a binary that prints the marker, one that keeps running without it, one that exits cleanly, and one that crashes.

Claude-Local-Session: claude --resume 99f2d9da-2a0a-4594-a18f-45d2f9fb5f21

ehsandeep and others added 2 commits November 13, 2026 05:24
Updaters in v0.2.0 to v0.2.3 passed the preflight only when the new binary
was still running after 15s, but the new binary exits as soon as it prints
"preflight ok", so every update from those versions was refused.

The new binary now stays up for 20s after printing the marker, and the
preflight passes as soon as it sees the marker on stdout. A binary that
exits or keeps running without the marker still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehsandeep ehsandeep added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Nov 12, 2026
@ehsandeep ehsandeep self-assigned this Nov 12, 2026
ehsandeep and others added 2 commits November 13, 2026 05:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
errcheck rejects a bare receive and staticcheck rejects assigning it to _.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehsandeep
ehsandeep marked this pull request as ready for review November 13, 2026 00:35
@ehsandeep
ehsandeep merged commit 08f7aae into main Nov 13, 2026
5 checks passed
@ehsandeep
ehsandeep deleted the claude/selfupdate-preflight-compat branch November 13, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant