@@ -5608,6 +5608,47 @@ describe("update-cli", () => {
56085608 expect ( runDaemonRestart ) . not . toHaveBeenCalled ( ) ;
56095609 expect ( defaultRuntime . exit ) . not . toHaveBeenCalledWith ( 1 ) ;
56105610 } ) ;
5611+
5612+ it ( "routes a stored dev channel from a package install to the git update flow" , async ( ) => {
5613+ const packageRoot = createCaseDir ( "openclaw-update-package-root" ) ;
5614+ mockPackageInstallStatus ( packageRoot ) ;
5615+ const config = { update : { channel : "dev" } } as OpenClawConfig ;
5616+ vi . mocked ( readConfigFileSnapshot ) . mockResolvedValue ( {
5617+ ...baseSnapshot ,
5618+ parsed : config ,
5619+ resolved : config ,
5620+ sourceConfig : config ,
5621+ runtimeConfig : config ,
5622+ config,
5623+ } ) ;
5624+ await updateCommand ( { dryRun : true , json : true , restart : false } ) ;
5625+
5626+ const preview = lastWriteJsonCall ( ) as
5627+ | { updateInstallKind ?: string ; switchToGit ?: boolean }
5628+ | undefined ;
5629+ expect ( preview ?. updateInstallKind ) . toBe ( "git" ) ;
5630+ expect ( preview ?. switchToGit ) . toBe ( true ) ;
5631+ expect ( packageInstallCommandCall ( ) ) . toBeUndefined ( ) ;
5632+ } ) ;
5633+
5634+ it ( "keeps a stored-dev package install on the package path for a one-off tag" , async ( ) => {
5635+ const packageRoot = createCaseDir ( "openclaw-update-package-root" ) ;
5636+ mockPackageInstallStatus ( packageRoot ) ;
5637+ const config = { update : { channel : "dev" } } as OpenClawConfig ;
5638+ vi . mocked ( readConfigFileSnapshot ) . mockResolvedValue ( {
5639+ ...baseSnapshot ,
5640+ parsed : config ,
5641+ resolved : config ,
5642+ sourceConfig : config ,
5643+ runtimeConfig : config ,
5644+ config,
5645+ } ) ;
5646+
5647+ await updateCommand ( { tag : "latest" , yes : true , restart : false } ) ;
5648+
5649+ expect ( runGatewayUpdate ) . not . toHaveBeenCalled ( ) ;
5650+ expectPackageInstallSpec ( "openclaw@latest" ) ;
5651+ } ) ;
56115652 it ( "explains why git updates cannot run with edited files" , async ( ) => {
56125653 vi . mocked ( defaultRuntime . log ) . mockClear ( ) ;
56135654 vi . mocked ( defaultRuntime . error ) . mockClear ( ) ;
0 commit comments