Skip to content

fix(update): honor stored dev channel for package installs - #123121

Closed
MoerAI wants to merge 2 commits into
openclaw:mainfrom
MoerAI:fix/dev-update-package-manager
Closed

MoerAI wants to merge 2 commits into
openclaw:mainfrom
MoerAI:fix/dev-update-package-manager

Conversation

@MoerAI

@MoerAI MoerAI commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #123073

What Problem This Solves

After a package-installed user switched to the dev channel, a later no-flag openclaw update --yes loaded the persisted update.channel: dev but kept the package install mode. The updater then tried to resolve the nonexistent npm dev tag instead of continuing through the configured git checkout.

Why This Change Was Made

The explicit --channel dev path already switches package installs to git. The stored channel is the same effective user choice, so install-mode selection now follows selectedChannel rather than only the current invocation's requestedChannel.

Scope

  • Route a package install with stored dev and no --channel through the existing git update path.
  • Preserve explicit --channel dev, stable, extended-stable, beta, and existing git-install behavior.
  • Do not change package-manager bootstrap logic; current main already resolves/bootstrap pnpm for git worktrees.

Evidence

Real Behavior Proof

Built and packaged this branch with the repository's self-contained package path, installed the resulting openclaw-2026.8.1.tgz into an isolated npm prefix, and configured an isolated state directory:

$ openclaw config set update.channel dev
Updated update.channel. Restart the gateway to apply.

The installed package CLI then received no --channel:

$ openclaw update --dry-run --json
{
  "installKind": "package",
  "mode": "git",
  "updateInstallKind": "git",
  "switchToGit": true,
  "requestedChannel": null,
  "storedChannel": "dev",
  "effectiveChannel": "dev",
  "actions": [
    "Switch install mode from package to git checkout (dev channel)"
  ]
}

A non-dry-run invocation of the same installed CLI entered the real git updater: it cloned the isolated target checkout, created the candidate preflight worktree, and invoked pnpm install --ignore-scripts there. This proves the package-to-git dispatch without touching the operator's real OpenClaw state or service.

Failing-First Regression Proof

New test: uses the stored dev channel to continue a package-to-git update

Before the production change on current main:

AssertionError: expected "vi.fn()" to be called with arguments:
[ ObjectContaining {"channel": "dev"} ]

Number of calls: 0
Tests  1 failed | 240 skipped

After the change:

Tests  1 passed | 240 skipped

The focused adjacent update-routing set also passes, including the review-found --tag latest override case, which remains on the package path while stored-dev no-flag updates use git.

Validation

  • named failing-first test — pass
  • focused explicit-dev, stored-dev, one-off-tag, and dirty-git routing cases — pass
  • pnpm tsgo:core — pass
  • pnpm tsgo:core:test — pass
  • targeted oxfmt --check — pass
  • git diff --check — pass
  • pnpm build — pass
  • self-contained package integrity check — pass

The full update CLI file has 42 pre-existing Windows-host failures on both this branch and a pristine detached current-main worktree; this branch adds one passing test (199 passed vs 198 passed), with the same 42 failures in both runs.

Risk and Rollback

Risk is limited to no-tag install-mode selection when the effective channel is dev; explicit one-off tags remain on the package path. Rollback is the one-line condition change plus its regression test/changelog entry.

Thanks @galli-personal for the report and the secondary no-flag routing reproduction.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7bd6db054

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/update-cli/update-command.ts Resolved
Comment thread CHANGELOG.md Resolved
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 13, 2026, 6:23 AM ET / 10:23 UTC.

ClawSweeper review

What this changes

The PR makes a package installation with a persisted dev update channel select the git updater even when the command has no explicit --channel option.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

Keep this PR open for a small repair: it fixes the real stored-dev routing defect, but it would silently discard documented one-off package tags on stored-dev installs and also edits the release-owned changelog.

Priority: P1
Reviewed head: f7bd6db0546bdb785fe7604f096ab1f195e19cc0

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real package-path proof is strong, but the patch needs a small compatibility correction before it is merge-ready.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.
Evidence reviewed 7 items Current routing defect: Current main derives selectedChannel from requested and stored channels, but its package-to-git conversion still checks only requestedChannel; a stored dev channel therefore remains on the package path.
Current-main surface check: The checkout’s sole commit behind origin/main changes only release-verifier script files, so the inspected update-routing source is unchanged on current origin/main.
One-off tag contract: Docs define --tag as a one-run package-target override that does not persist a channel, including --tag main; git installs are the path that ignores tags.
Findings 2 actionable findings [P1] Preserve one-off tags before switching stored-dev installs
[P2] Remove the release-owned changelog entry
Security None None.

How this fits together

The update CLI combines explicit flags and the persisted update channel to choose either a package-manager update or a git-checkout update. That decision controls target resolution, installation, and post-update recovery.

flowchart LR
A[Update command] --> B[Stored channel preference]
A --> C[One-off package tag]
B --> D[Install-mode decision]
C --> D
D --> E[Package update]
D --> F[Git update]
E --> G[Installed release]
F --> G
Loading

Before merge

  • Preserve one-off tags before switching stored-dev installs (P1) - A package install with persisted update.channel: dev and --tag <version/spec> now switches to git before the tag is parsed. The git flow ignores --tag, so a documented one-off package override instead updates moving main; parse the tag first and retain package mode for this sibling path.
  • Remove the release-owned changelog entry (P2) - Normal PRs must leave CHANGELOG.md to release generation, and this PR body already contains the relevant user-facing release context. Remove this entry to avoid prematurely curating a release note.
  • Resolve merge risk (P1) - Merging the current condition makes a package-installed user with stored dev and --tag <version/spec> update moving git main instead of the requested one-off package target.

Findings

  • [P1] Preserve one-off tags before switching stored-dev installs — src/cli/update-cli/update-command.ts:261
  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:71
Agent review details

Security

None.

PR surface

Source 0, Tests +26, Docs +1. Total +27 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 26 0 +26
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 28 1 +27

Review metrics

Metric Value Why it matters
Production vs test LOC production +1/-1 (net 0); tests +26; release-owned changelog +1 The runtime fix is net-neutral, while the new test needs one sibling case to protect the documented tag override.

Merge-risk options

Maintainer options:

  1. Keep one-off tags on the package path (recommended)
    Parse the tag before install-mode selection, retain package mode for stored-dev plus --tag, add focused coverage, and remove the release-owned changelog entry.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Parse the explicit tag before install-mode selection; preserve package mode for stored dev plus --tag; add the sibling regression; remove the CHANGELOG.md edit.

Technical review

Best possible solution:

Parse the explicit tag before choosing install mode, auto-switch stored-dev package installs only when no tag is present, cover that sibling contract, and leave release notes in the PR body.

Do we have a high-confidence way to reproduce the issue?

Yes. Current source proves that stored dev does not switch a package install today, and the PR body supplies a focused failing-first test and isolated package-install evidence.

Is this the best way to solve the issue?

No. Using the effective channel is the right owner boundary for no-flag updates, but the condition must preserve the documented explicit-tag override before selecting git mode.

Full review comments:

  • [P1] Preserve one-off tags before switching stored-dev installs — src/cli/update-cli/update-command.ts:261
    A package install with persisted update.channel: dev and --tag <version/spec> now switches to git before the tag is parsed. The git flow ignores --tag, so a documented one-off package override instead updates moving main; parse the tag first and retain package mode for this sibling path.
    Confidence: 0.98
  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:71
    Normal PRs must leave CHANGELOG.md to release generation, and this PR body already contains the relevant user-facing release context. Remove this entry to avoid prematurely curating a release note.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9794a4a49c1f.

Labels

Label changes:

  • add P1: The PR fixes an active updater regression but currently introduces a user-visible one-off update compatibility break.
  • add merge-risk: 🚨 compatibility: Stored dev plus an explicit package tag would change from installing the requested package target to ignoring that tag and updating git main.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.

Label justifications:

  • P1: The PR fixes an active updater regression but currently introduces a user-visible one-off update compatibility break.
  • merge-risk: 🚨 compatibility: Stored dev plus an explicit package tag would change from installing the requested package target to ignoring that tag and updating git main.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from an isolated installed package and describes observed entry into the real git updater without using the operator’s state.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/cli/update-cli.test.ts -t "stored dev|tag".
  • [P1] pnpm tsgo:core.
  • [P1] pnpm tsgo:core:test.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • joshavant: Current blame attributes the selected-channel and install-mode block to this commit. (role: current routing-block author; confidence: medium; commits: 13750feff339; files: src/cli/update-cli/update-command.ts)
  • Peter Steinberger: Feature-history shortlog shows extensive contribution to the central update command. (role: frequent updater contributor; confidence: medium; files: src/cli/update-cli/update-command.ts)
  • Vincent Koc: Feature-history shortlog shows sustained work on the central update command and install-switch lifecycle. (role: frequent updater contributor; confidence: medium; files: src/cli/update-cli/update-command.ts, src/cli/update-cli/update-command-git.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Keep stored-dev plus --tag on the package path and add the focused regression.
  • Remove the release-owned CHANGELOG.md edit.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc vincentkoc added dedupe:child Duplicate issue/PR child in dedupe cluster close:superseded PR close reason labels Aug 13, 2026
@vincentkoc vincentkoc self-assigned this Aug 13, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Thanks @MoerAI. Closing this in favor of #123083, which was opened earlier from the claimed issue lane and contains the same owner-boundary repair with tighter table-driven coverage, net-negative production code, real package-launcher proof, and green exact-head CI. I compared heads f7bd6db0546b and 69c3827e5933; there is no unique production behavior or regression coverage to preserve. The additional changelog line is release-only and should not be folded into a normal repair. Thanks for the independent reproduction and validation.

@vincentkoc vincentkoc closed this Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(update): honor stored dev channel for package installs This is item 2/3 in the current shard. Shard 7/19.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@MoerAI

MoerAI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both findings in 6c8a4cba0a3: stored-dev auto-switching is now limited to invocations without an explicit one-off tag, with a regression case proving --tag latest stays on the package path; the release-owned CHANGELOG entry is removed. Focused routing tests are 3/3, core/core-test tsgo pass, and formatting/diff checks pass. @clawsweeper re-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes close:superseded PR close reason dedupe:child Duplicate issue/PR child in dedupe cluster merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev-channel update fails: EUNSUPPORTEDPROTOCOL on workspace:* (updater uses npm, repo requires pnpm)

2 participants