Repository navigation
fix: Do not replace a dev build with the newest release - #1999
Conversation
A build from make dev-install reports its version as "dev". agentop update with no --ref compared that to the newest release, found no match, and offered to install the release. A dev build can be newer than the newest release, so that offer can replace newer code with older code. Now agentop update stops for a dev build when there is no --ref. It prints how to build again or how to install a release, and exits 0. An explicit --ref still installs that ref. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The fix works. With no --ref, agentop update now stops before latestRelease() when the installed agentop reports dev, and an explicit --ref still goes through to the installer. I checked this three ways. A binary built the way make agentop builds it (-X main.revision=...) prints agentop dev for --version, so installedVersion() gets exactly dev: the revision only goes into displayVersion, not into the --version line. The new dev build row fails against the base runUpdate (exit 1, empty stdout) and passes at head, so the test really catches the bug. TestUpdate* passes locally, and so do gofmt and go vet on cmd/agentop.
I have one non-blocking suggestion: docs/laptop-service.md still says a manual agentop update installs the newest release over a dev build (inline comment). I also have one nit.
Author: huang195 (MEMBER, maintainer)
Areas reviewed: Go (cmd/agentop update path, tests), usage text, docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: all green except Go CI (core), which fails at the Lint step (go fmt/go vet in core/). That job fails the same way on main at 542eb59, and this PR touches only the cmd/agentop module, so the failure is not from this PR.
|
|
||
| Downloads nothing when agentop and cortex in ~/.local/bin are already at the | ||
| release asked for. Run agentop doctor to check the rest of the install. | ||
| release asked for, or when agentop is a dev build (make dev-install) and there |
There was a problem hiding this comment.
suggestion: The usage text is updated, but two docs still describe the old behaviour:
docs/laptop-service.md(Automatic updates, around L336-340): "It does not change adevormain-<sha>install. ...agentop updateby hand installs the newest release, and automatic updates start again from there." Fordev, this is now false. A manual update prints the notice, and you need--ref=vX.Y.Zto get back onto releases.cmd/agentop/README.mdL35: "agentop updateinstalls the newest release at once." This could mention the dev-build exception.
That same paragraph puts main-<sha> next to dev as "often ahead of" Latest. This guard covers only dev, so a manual agentop update on a channel build still installs the older release. An RC ahead of Latest does too (auto-update protects it with rcAhead, but the manual path doesn't). This may be intentional, since plain agentop update is the documented way off the channel. If so, it would help if the docs split the two cases so that readers don't assume main-<sha> gets the same protection.
| } | ||
| // A source build (make dev-install) reports "dev" and can be ahead of every | ||
| // release, so only an explicit --ref replaces it. | ||
| if env.readVersions(); *ref == "" && env.installedVersion == "dev" { |
There was a problem hiding this comment.
nit: Calling the side-effect-only env.readVersions() in the if's init statement reads a little oddly. A reader can take it for part of the condition. Two lines would make it plainer:
env.readVersions()
if *ref == "" && env.installedVersion == "dev" {A --ref=main install reports "main-<sha>". The check for "dev" did not match it, so agentop update with no --ref replaced it with the newest release, which is older code. Use the check that the automatic update uses: stop when the installed version is not a release and not an RC. An empty version (no agentop, or no answer) still installs. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The fix works for the cases it claims. With no --ref, an installed agentop that reports dev or main-<sha> now gets the notice and exit 0, without reading Latest and without writing the status file. --ref=vX still installs, and a missing or failing agentop (empty version) still installs. I checked these against the PR head with probe cases, and they behave as the description says. TestUpdateSkipsTheInstallerWhenCurrent passes locally. I found no must-fix issues. Two suggestions below are about matching autoUpdate more closely. Neither is a regression against main.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Go (cmd/agentop update path, tests), usage/docs text
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits, all signed-off: yes
CI status: one failure, Go CI (core). It fails at the Lint step with not enough arguments in call to eventually. That is already broken on main: core/listener/forwardproxy/parent_test.go (#1995) calls eventually(t, func() bool {...}), but #1984 changed the signature to eventually(t, store, cond, what). Go CI (core) also fails on main at 0ac29b9 and 377211b. This PR does not touch core/. All other checks pass, including Go CI (authbridge agentop).
| // every release, so only an explicit --ref replaces it. The automatic update | ||
| // makes the same check. "" (no agentop, or no answer) still installs. | ||
| env.readVersions() | ||
| if v := env.installedVersion; *ref == "" && v != "" && !updatestatus.IsRelease(v) && !updatestatus.IsRC(v) { |
There was a problem hiding this comment.
suggestion: The comment above says "The automatic update makes the same check", but autoUpdate does two more things here.
- It requires both binaries to be updatable (
!updatable(agentop) || !updatable(cortex)). This check reads only agentop. With a release agentop and adevcortex, the manual update still replaces the dev cortex with the newest release. I confirmed that on the head: the probe exits 7 withstaged setup.make dev-installinstalls both binaries together, so this is an edge case. AddinginstalledVersion(filepath.Join(env.binDir, proxyBinary))to the condition would give the parity the comment claims. - It treats an RC that is ahead of Latest as current (
rcAhead). Here,v9.9.10-rc.1installed with Latestv9.9.9passes this check, and the update installs v9.9.9, which is older code. That is the same "replace newer code with older code" problem the PR fixes for dev builds. main does the same, so this is not a regression. If the downgrade is intended for a manual update, because a user on an RC might runagentop updateto get back to stable, the comment could say so. Otherwise a test row for the RC-ahead case would pin the behavior down either way.
Problem
A build from
make dev-installreports its version asdev.agentop updatewith no--refskips the install only when the installed version is exactly the newest release.devnever matches, so update offers to install the newest release. A dev build can be newer than that release, so the offer can replace newer code with older code.The automatic update and the title-bar notice already leave a dev build alone. Only the manual
agentop updatedid not.Change
--ref,agentop updatestops when the installed agentop is not a release and not an RC. This covers adevbuild and a--ref=mainbuild (main-<sha>). It is the check that the automatic update uses. An empty version (no agentop) still installs. It prints the version and how to install a release, and exits 0. It does not read the newest release and does not write the update status file.--refstill installs that ref.Test
TestUpdateSkipsTheInstallerWhenCurrent: a dev build and amain-abc1234build with no--ref(the notice, exit 0), and a dev build with--ref=v9.9.9(the staged setup runs).scripts/dev/go-test-shards.sh -race cmd/agentop: 1163 tests pass (8 shards).Assisted-By: Claude (Anthropic AI) noreply@anthropic.com
Summary by CodeRabbit
agentop updateon a development build without specifying a release reference now reports that the build was not updated and exits successfully without checking for a release or starting an installer.