janhq / cortex.cpp

Run and customize Local LLMs.
https://cortex.so
Apache License 2.0
1.92k stars 106 forks source link

bug: `cortex update` stdouts "Update cortex sucessfully" even when update failed #1257

Open 0xSage opened 1 day ago

0xSage commented 1 day ago

Cortex version

v65->v67

Describe the Bug

  1. User doesn't have permissions into some fs
  2. User runs cortex update
  3. Even though update fails, we still log "Update cortex successfully"
  4. But none of the commands then work
  5. Expected: stdout that the update failed, missing permissions, etc.
❯ cortex-nightly -v
v0.5.0-65

A new release of cortex is available: v0.5.0-65 -> v0.5.0-67
To upgrade, run: cortex-nightly update
❯ cortex-nightly update
Server is running. Stopping server before updating!
HTTP error: Failed to read connection
Validating download items, please wait..
Start downloading: cortex-nightly.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.6M  100 11.6M    0     0  41.8M      0 --:--:-- --:--:-- --:--:-- 42.0M
Update cortex sucessfully
❯ cortex-nightly
libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in create_directories: Permission denied ["/Users/nicolezhu/cortexcpp-nightly/models"]
[1]    10434 abort      cortex-nightly

How I fixed it:

  1. I just ran sudo cortex update
  2. And everything worked fine
❯ sudo cortex-nightly update
Password:
Validating download items, please wait..
Start downloading: cortex-nightly.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.6M  100 11.6M    0     0  40.2M      0 --:--:-- --:--:-- --:--:-- 40.3M
Update cortex sucessfully
❯ cortex-nightly
Cortex.cpp CLI
cortex-nightly [OPTIONS] [SUBCOMMAND]

Options:
  -h,--help                   Print this help message and exit
  --verbose                   Verbose logging

Steps to Reproduce

No response

Screenshots / Logs

No response

What is your OS?

What engine are you running?

hiento09 commented 1 day ago

Add @vansangpfiev here to help modify the update message to the user. Change from cortex-nightly update to sudo cortex-nightly update since cortex-nightly is in /usr/local/bin, which requires root permission to replace.