Skip to content

Updates 1/3: daily update check on the machine, plannotator update, PLANNOTATOR_UPDATE_CHECK - #1830

Merged
backnotprop merged 3 commits into
mainfrom
feat/updates-check
Oct 11, 2026
Merged

backnotprop merged 3 commits into
mainfrom
feat/updates-check

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Part 1 of 3 of the owner-approved update notices and updating (design: .product/approved/plannotator-updates/, owner answers in its approval.md). This part is the plumbing; the Inbox button (2/3) and the review-window toast (3/3) are stacked on it.

What it does

  • One check, on the machine (packages/shared/update-check.ts, node-only, vendorable to Pi). runReleaseCheck asks GitHub releases/latest at most once per 24h per data dir, claims the attempt in update-state.json before the request (concurrent starts ask once), waits 6h after a failure (never a retry loop), logs failures to update.log, and keeps the last known answer. The tag is reduced to a canonical X.Y.Z. Release notes (## What's New in → ## Install / Update, 64 KB cap, plus the "Missed recent releases?" table) are kept in update-notes/<version>.json. User agent plannotator-update-check, no version in it.
  • Who asks: the compiled CLI at registerCliSession, on the same unref'd, never-awaited tick as auto-update. No check in dev/source runs.
  • Knob PLANNOTATOR_UPDATE_CHECK / { "updateCheck": false }: env > config > default on (resolveUpdateCheck). Allowlisted on POST /api/config in all six servers (Bun + Pi); getServerConfig sends updateCheck + updateCheckEnv. Off = no automatic request, no notice, no auto-update.
  • Auto-update now reads the shared cache (runAutoUpdateCheck gains checks-off), so the machine makes one request per day total.
  • plannotator update [--check] (apps/hook/server/update-command.ts): forces a check, then runs the same wrapper as auto-update in the foreground (beginManualUpdate + runInstallerForeground: update.lock, pinned tag, remembered install-flags.json, output to the terminal and update.log, update-result.json). No 24h window, no open-sessions gate. Refuses dev builds and unmanaged binaries (prints the install command with the remembered flags). Exit 0 / 1 / 2.
  • startManualUpdate: the detached "Update now" used by parts 2 and 3; a second press while one runs gets locked.
  • Terminal hint: one stderr line after an interactive review / annotate / last / archive session, TTY only, never with --json / --hook / inside an agent (CLAUDECODE, PLANNOTATOR_SESSION_TAG), at most once a day, from the cache. plannotator --version unchanged.
  • Testing / mirror knobs PLANNOTATOR_UPDATE_API_URL and PLANNOTATOR_INSTALL_SCRIPT_URL (https or loopback http only), used by the process test.
  • Docs: CLAUDE.md env rows, environment-variables reference, installation §Updating, the plannotator skill (+ freshness test passes), uninstall --purge removes update-notes/.

Tests

  • packages/shared/update-check.test.ts: 24h throttle, 6h retry after failure, concurrent claim, off = no request, forced check, junk tags, notes extraction + cap, advert, install commands per platform, hint once a day, knob precedence.
  • packages/server/auto-update.test.ts: existing suite unchanged and passing, plus checks-off, answering from the shared cache, Update now runs the wrapper once (lock), unmanaged / dev / up-to-date refusals.
  • apps/hook/server/update-command.test.ts: outcomes over seams, and the real CLI as a process with a fake GitHub API and fake install.sh on loopback (temp HOME whose ~/.local/bin/plannotator links to bun, so it counts as managed): installer argv carries --version v9.9.9 --non-interactive --skip-codex, lock released, failure exits 1, --check installs nothing.
  • packages/server/update-check-config.test.ts: the knob through POST /api/config on plan / review / annotate.

bun run typecheck passes.

…e, PLANNOTATOR_UPDATE_CHECK

The machine asks GitHub (never the browser) at most once per 24h per data
dir, 6h after a failure, and caches the release and its notes in the data
dir (packages/shared/update-check.ts, vendorable to Pi). Auto-update now
answers from that cache and needs update checks on. New knob
PLANNOTATOR_UPDATE_CHECK / { updateCheck } (default on), allowlisted on
POST /api/config in all six servers. New plannotator update [--check] runs
the same install wrapper as auto-update in the foreground (lock, pinned tag,
remembered install flags). A one-line stderr hint after an interactive
session, at most once a day, TTY only.
…ase-only checks, process test without the built HTML

- plannotator update's process test spawns update-command-entry.ts (the same
  function, no built HTML import), so the test job needs no build.
- The POSIX wrapper traps INT/TERM/HUP and the PowerShell wrapper records its
  result in finally: a Ctrl-C writes exit 130 and releases update.lock at once.
  runInstallerForeground forwards INT/TERM to the wrapper and finishes on exit,
  so a wrapper killed outright still releases the lock (abortLaunch).
- A failed release fetch gives auto-update's 24h window back (the 6h backoff
  still bounds requests).
- plannotator update asks GitHub only from a release build (0.0.0-dev never).
- CLAUDE.md and docs describe only what this change does on its own.
@backnotprop
backnotprop merged commit 74594c8 into main Oct 11, 2026
32 checks passed
@backnotprop
backnotprop deleted the feat/updates-check branch October 11, 2026 00:27
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