Repository navigation
Conversation
Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
agentop service install now writes a second unit, the updater. It runs "agentop update --yes --auto". The proxy starts it once a day. - macOS: ~/Library/LaunchAgents/io.rossoctl.cortex.update.plist, with no RunAtLoad, KeepAlive or StartInterval. Install bootstraps it only when launchd does not have the label. Install never boots it out, because the updater job can be the process that runs the install. - Linux: ~/.config/systemd/user/cortex-update.service, Type=oneshot, with no [Install] section and no timer. - serviceIsCurrent is false when the updater file is missing or stale, so an older install gets the updater at the next install or setup. - Uninstall boots out and removes the updater. - The setup service step puts back the updater file on rollback. Part of rossoctl#1836. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration:
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. |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1836.
This is PR P2 of 2 in the plan
docs/superpowers/plans/2026-11-12-auto-update-1836.md. The plan title for P2 is "feat: Start the updater once a day from the laptop service". This branch has only task T3 of P2, so the title names only T3. The PR is a draft because tasks T4 and T8 failed and their work is not in this branch (see "Not in this PR").What changed
T3, the updater unit (
cmd/agentop):agentop service installwrites a second unit beside the service unit:~/Library/LaunchAgents/io.rossoctl.cortex.update.plist, labelio.rossoctl.cortex.update.~/.config/systemd/user/cortex-update.service,Type=oneshot, with no[Install]section and no timer.agentop update --yes --autoand writes its output to~/.cortex/update.log. In this PR,--autois only a string. P1 (feat: Update a laptop service install automatically #1838) adds the flag.serviceIsCurrentreturns false when the updater file is missing or different. So an install from before this change gets the updater at the nextagentop service installoragentop setup.TestSetupUpgradesAPreRenameSupervisedCortexfound a leftover updater plist after a rollback.The plan document is also in this PR.
How it was tested
New tests in
cmd/agentop/cmd_service_updater_test.go: render (darwin and linux), install writes the unit, install never boots out the updater, uninstall removes the unit, andserviceIsCurrentis false without the updater unit.The full plan gate passed on this branch tip (exit 0,
cmd/agentop: 1033 tests in 8 shards, 157s):The linux paths ran only with stubs on darwin.
TestServiceIsCurrentFalseWithoutUpdaterUnitcovers both GOOS values. The install and uninstall tests useruntime.GOOS, so the CI Linux job runs their linux branch.Size
Counted lines by file:
cmd_service.go+32/-7,cmd_service_platform.go+79,cmd_service_updater_test.go+238,cmd_service_test.go+9/-8,setup_step_service.go+7/-1, and 11 lines in three integration and GOOS test files.Not in this PR
These tasks failed. Their work is not in this branch:
cmd/cortex/update_trigger.go). The commit is 8061ad30 in theauto-update-1836-tT4worktree. Its gate run failed only inscripts/dev/go-test-shards.sh -race cmd/agentop, with timing failures (TestSetupReadyInLeavesOutThePrompt,TestStartUnsupervised,TestStartByHandRunsFromAShell) and one shard timeout, at a load average of 6 to 8.5. T4 changes no code incmd/agentop. The three tests passed alone with-race. A clean gate run on that commit is still necessary.docs/laptop-service.md,cmd/agentop/README.md,CONTRIBUTING.md). The commit is c24fa2e6. Its gate run failed for the same load-related timing reason.TestSetupReadyInLeavesOutThePromptalso failed 3 of 3 times on the PR base with no T8 change.Without T4, nothing starts the updater unit. Do not merge this PR as the last part of #1836.
Review findings not fixed (all minor)
updaterFile) has a reason, given above.cmd/agentop/cmd_service.gorunServiceInstall: whenloadServicefails, install removes the unit file but leaves the new updater file.agentop service uninstallthen prints "Nothing to do" and does not remove the updater file. On darwin the file is not loaded, and the next install writes it again, so the only effect is an orphan file. Oneos.Remove(p.updaterFile)beside the unit removal fixes it.cmd/agentop/cmd_service.goremoveServiceandcmd_uninstall.go(line ~886): an updater remove error goes intostampErr. So the message says "could not remove <proxy.sha256>: ...", and uninstall lists the stamp file inleft, not the updater file. The os error text still names the updater path. The plan's "no signature change" rule causes this.cmd/agentop/setup_step_service.goundo: on a first install, undo removes the updater file but does not boot out an updater thatloadUpdaterbootstrapped. So launchd keeps a loaded job with no plist. This is intentional, because setup can run inside the updater job. The next install sees the label is loaded and does not bootstrap it again. If the plist is different by then, the loaded definition stays old until uninstall. The plan accepts this shortcut.For a human after review
Needs T3, T4, T5 and T6 merged (both PRs).
-ldflags "-X main.version=v0.9.4", so that they read as a plain release older than Latest.agentop setup --from <dir>as a service install.launchctl kickstart gui/$(id -u)/io.rossoctl.cortex.update.update.jsonsaysupdated, and that an open TUI showsrestart agentop.Note: Latest must be more than 72 hours old for step 4; else expect
waiting.HTTPS_PROXY. Decide whether that needs a fix.Assisted-By: Claude (Anthropic AI) noreply@anthropic.com