Skip to content

fix: Do not replace a dev build with the newest release - #1999

Merged
huang195 merged 2 commits into
rossoctl:mainfrom
huang195:fix/update-dev-build
Nov 19, 2026
Merged

huang195 merged 2 commits into
rossoctl:mainfrom
huang195:fix/update-dev-build

Conversation

@huang195

@huang195 huang195 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Problem

A build from make dev-install reports its version as dev. agentop update with no --ref skips the install only when the installed version is exactly the newest release. dev never 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 update did not.

Change

  • With no --ref, agentop update stops when the installed agentop is not a release and not an RC. This covers a dev build and a --ref=main build (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.
  • An explicit --ref still installs that ref.
  • The usage text and the exit-status line say this.

Test

  • Three new rows in TestUpdateSkipsTheInstallerWhenCurrent: a dev build and a main-abc1234 build 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

  • Behavior Changes
    • Running agentop update on 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.
    • Specifying a release reference still allows the build to be replaced.
    • Updated command usage text clarifies how development builds affect downloads and exit status.

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>
@huang195
huang195 requested a review from a team as a code owner November 19, 2026 16:19
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When no --ref is specified and the installed version is dev, agentop update reports that it did not update and exits successfully. When --ref is specified, the command continues through the update flow.

Changes: Dev-build update handling

Layer / File(s) Summary
Dev-build update behavior
cmd/agentop/cmd_update.go, cmd/agentop/cmd_update_test.go
The command checks the installed version before checking releases when no --ref is specified. It reports a notice for an installed dev build and exits successfully. Tests cover the no-ref case and the pinned update case. The usage text describes this behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • rossoctl/cortex#1993: Changes how dev builds are treated in the update flow. This PR addresses the related no---ref behavior in the manual agentop update path.
  • rossoctl/cortex#1676: Adds the agentop update command. This PR changes the no---ref behavior that PR introduced.

Suggested reviewers: evaline-ju, clawgenti

Merge Risk: Minimal · up to 56a1e

agentop update on a dev build no longer replaces it with the newest release unless --ref is given. Tests cover both the skip and the explicit-ref install. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: agentop update no longer replaces a dev build with the newest release when no --ref is given. The raw summary confirms this behavior change in cmd/agentop/cmd_upda…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: agentop update no longer replaces a dev build with the newest release when no --ref is given. The raw summary confirms this behavior change in cmd/agentop/cmd_update.go, and the objectives describe the same intent. The title is specific, concise, and uses the fix: prefix as a conventional commit type.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d070186b-120f-4d56-b514-0cceb8d5d9de
Commits

Reviewing files that changed from the base of the PR and between 542eb59 and 56a1ef1.

Files selected for processing: 2

  • cmd/agentop/cmd_update.go
  • cmd/agentop/cmd_update_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions github-actions Bot added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 19, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/agentop/cmd_update.go Outdated

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a dev or main-<sha> install. ... agentop update by hand installs the newest release, and automatic updates start again from there." For dev, this is now false. A manual update prints the notice, and you need --ref=vX.Y.Z to get back onto releases.
  • cmd/agentop/README.md L35: "agentop update installs 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.

Comment thread cmd/agentop/cmd_update.go Outdated
}
// 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" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@huang195 huang195 closed this Nov 19, 2026
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 19, 2026
@huang195 huang195 reopened this Nov 19, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread cmd/agentop/cmd_update.go
// 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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The comment above says "The automatic update makes the same check", but autoUpdate does two more things here.

  1. It requires both binaries to be updatable (!updatable(agentop) || !updatable(cortex)). This check reads only agentop. With a release agentop and a dev cortex, the manual update still replaces the dev cortex with the newest release. I confirmed that on the head: the probe exits 7 with staged setup. make dev-install installs both binaries together, so this is an edge case. Adding installedVersion(filepath.Join(env.binDir, proxyBinary)) to the condition would give the parity the comment claims.
  2. It treats an RC that is ahead of Latest as current (rcAhead). Here, v9.9.10-rc.1 installed with Latest v9.9.9 passes 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 run agentop update to 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.

@huang195
huang195 merged commit 374a428 into rossoctl:main Nov 19, 2026
74 of 75 checks passed
@huang195
huang195 deleted the fix/update-dev-build branch November 19, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants