Skip to content

update: a released codeaf installs the newest stable and restarts before the chat opens - #1826

Merged
ZeroPoint95 merged 7 commits into
devfrom
zeropoint95/auto-update-on-launch
Oct 15, 2026
Merged

ZeroPoint95 merged 7 commits into
devfrom
zeropoint95/auto-update-on-launch

Conversation

@ZeroPoint95

@ZeroPoint95 ZeroPoint95 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

A released codeaf now updates itself and restarts before the chat opens. Every other build is only told.

What changed

  • A stable build installed as codeaf, with automatic updates on, now updates before the chat opens:
    • looks for a newer stable release
    • installs it with a progress line
    • restarts into it with the same arguments
  • Among the chat's first lines it then says codeaf updated from <old> to <new> as it opened · automatic updates in /settings turns this off.
  • Startup never hangs:
    • The check is cached for a day; otherwise it waits at most 1.5s.
    • A check that failed or got no answer is not retried for an hour.
    • The install waits at most 20s. A release that runs out of time is left to the chat's background install for a day.
    • Slow, failed or ctrl+c opens the build already on disk.
  • Other launches print one terminal line before the chat, plus the existing chat line:
    • automatic updates off
    • dev, staging and rc builds, devaf, stageaf, any other file name
    • a pinned file
  • A release you skipped, or one backing off after a failure, prints nothing in the terminal (same as the chat).
  • The "named codeaf" rule reads the file that would be overwritten, with symlinks resolved, so it answers the same on macOS and Linux.
  • Some launches don't check at all:
    • source builds (make build, go run) make no request
    • no terminal, CI set, or --once: nothing runs
  • New: codeaf update --version <tag> and /update <tag> pin the file. A plain update unpins.
  • The chat's 10s countdown stays, but only as the fallback when the launch couldn't finish.
  • A finished background install now says just codeaf <tag> installed · restart to use the new version.
  • On Windows, the parent waiting on the restarted build ignores console ctrl+c.
  • Linuxbrew (/home/linuxbrew/.linuxbrew/) is treated as a package manager and is never replaced in place.
  • The manual, the settings hint and --help are updated.
  • keys.md: one heading reworded. The new update sections shifted search ranking, so "how do I make this one chat think harder" no longer reached that heading.

How it was checked

  • go test -race ./internal/update/ ./internal/config/ ./cmd/codeaf/:
    • ok internal/update 15.6s
    • ok internal/config 34.3s
    • cmd/codeaf (238.8s): one failure, TestAShellRunWaitsForItsLastCallsPriceAndKeepsItsClock (carried_money_test.go:64: stderr = "", want the wait said). It fails the same way under -race on origin/dev 1acf751, so it's pre-existing. No other failure and no data race reported.
  • go test -run 'Update|Offer|Skip|Pinned|Launch|Install|Grace|Countdown|Refus|FinishedInstall|Automatic|Deferred' ./internal/tui3/: ok … 15.0s
  • go run ./cmd/codeaf-changes check: docs/changes/unreleased: 2 entries, all well formed.
  • make test-laws: laws: 139 files in 30 packages, all 30 ok
  • make test-packed-manual: ok internal/manual
  • GOOS=windows and GOOS=linux builds of ./cmd/codeaf: compile
  • make test-touched at f53fa93 (the previous head): every touched package passed on its first run: cmd/codeaf, internal/config, internal/manual, internal/update, and all 8 shards of internal/tui3. Not re-run for this round.
  • By hand against the real GitHub stable, from a checkout of this branch.
    1. Build, copy and restore in one line, so bin/codeaf is never left stamped as a release:
      make build BUILD_REV=v0.0.1 && mkdir -p /tmp/au && rm -f /tmp/au/codeaf /tmp/au/devaf && cp bin/codeaf /tmp/au/codeaf && cp bin/codeaf /tmp/au/devaf && make build
    2. From cd $(mktemp -d), CODEAF_HOME=/tmp/au/home /tmp/au/codeaf:
      • Printed updating codeaf v0.0.1 to v0.8.0, then codeaf v0.8.0 installed · opening it.
      • Restarted on v0.8.0 in 3.3s, including the 66 MB download.
      • v0.8.0 predates this PR, so its chat has no "updated from" line.
    3. CODEAF_HOME=/tmp/au/home /tmp/au/devaf:
      • Nothing installed.
      • Chat: codeaf v0.8.0 is out · you have v0.0.1 · /update installs it for the next launch.
      • Terminal: … · devaf update installs it.
    4. Separately, against a local release host serving a v0.0.2 built from this branch, in a real terminal: restart with the "updated from" line; auto-update off; source build making zero requests; pin and unpin; silent network (1.8s, then 0.14s); slow download into the chat's countdown; ctrl+c.

Checklist

  • A change entry: docs/changes/unreleased/1826-auto-update-on-launch.md
  • The manual knows about it: running-from-the-terminal.md and commands.md, with new probes in internal/manual/chat_test.go
  • No new line in .github/known-red.txt
  • Only my own paths are staged — no git add -A

🤖 Generated with Claude Code

ZeroPoint95 and others added 3 commits October 13, 2026 18:39
…ore the chat opens

- A stable build in a file named codeaf, with automatic updates on, now
  looks before the chat opens (cached a day, otherwise at most 1.5s, and a
  look that got no answer is not waited on again for an hour), installs
  within 20s with a progress line, and hands the terminal to the new build
  with the same arguments. ctrl+c, a slow download or a failure opens the
  build on disk.
- Only that build is updated unasked (update.AutomaticFor): dev, staging,
  rc and source builds, devaf, stageaf and other file names are told on one
  terminal line and the chat's quiet line, and never replaced. Nothing runs
  without a terminal, under CI, or for --once.
- `codeaf update --version <tag>` and `/update <tag>` pin the file at that
  release; a plain install unpins. The pin lives in the install record, so
  a file replaced by curl drops it.
- The chat's countdown is kept as the fallback when the launch could not
  finish, and is now gated by the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@santoshkumarradha santoshkumarradha added feature Work that adds a capability; developers break it into tasks area:build make targets, size budget, cross-build, release labels Oct 14, 2026
ZeroPoint95 and others added 2 commits October 14, 2026 13:22
`codeaf <tag> installed · restart to use the new version`, in the
transcript and the keys line alike, instead of the sentence about
windows and engines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A launch that runs out of its 20s clock records the release as slow
  (AutoSlow); for a day the next launches leave it to the chat's
  background road instead of starting the same download again.
- The name rule reads the file that would be overwritten, links
  resolved, on every platform; the check decides it off the frame and
  carries it as Available.Automatic for both launch roads.
- A file already holding the release says "is already on disk ·
  opening it" instead of claiming an install.
- Windows Relaunch ignores console ctrl+c while it waits on the child.
- Both spellings of the restart marker are cleared; the download meter
  draws only when stderr is a terminal; a --debug record opens after
  the launch's own update; Linuxbrew is a package manager.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ZeroPoint95
ZeroPoint95 marked this pull request as ready for review October 14, 2026 20:30
…e-on-launch

# Conflicts:
#	internal/config/settings.go
…e-on-launch

# Conflicts:
#	internal/update/install.go
@ZeroPoint95
ZeroPoint95 merged commit d0cff6b into dev Oct 15, 2026
8 checks passed
@ZeroPoint95
ZeroPoint95 deleted the zeropoint95/auto-update-on-launch branch October 15, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build make targets, size budget, cross-build, release feature Work that adds a capability; developers break it into tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants