Project
cortex
Description
The update subsystem ignores CORTEX_HOME and uses HOME/.cortex for both persistent update files:
update_cache.json from the upgrade check path
update.json from the update config path
This creates split state. The CLI help explicitly documents CORTEX_HOME as the config directory override, but the update subsystem bypasses it and writes under ~/.cortex instead.
Error Message
No explicit error is shown. The bug is silent state being written to the wrong directory.
Debug Logs
HOME=/tmp/cortex-repro-home CORTEX_HOME=/tmp/cortex-repro-config /tmp/cortex-bin/Cortex upgrade --check --yes --channel stable
✓ You are already on the latest version (v0.0.7)
find /tmp/cortex-repro-home /tmp/cortex-repro-config -maxdepth 4 -type f -o -type d | sort
/tmp/cortex-repro-config
/tmp/cortex-repro-home
/tmp/cortex-repro-home/.cortex
/tmp/cortex-repro-home/.cortex/update_cache.json
System Information
macOS Darwin 25.x (Apple Silicon)
Cortex CLI v0.0.7
Rust toolchain: cargo 1.95.0 / rustc 1.95.0
Screenshots
Prepared evidence image showing both the runtime repro and the targeted update-config proof:
/tmp/cortex-cortexhome-bug-evidence-clean.png
Steps to Reproduce
- Set
HOME and CORTEX_HOME to different directories.
- Run:
HOME=/tmp/cortex-repro-home CORTEX_HOME=/tmp/cortex-repro-config cortex upgrade --check --yes --channel stable
- Inspect both directories.
- Observe that
update_cache.json is created under HOME/.cortex/update_cache.json and nothing is written under CORTEX_HOME.
- For the config-writing path, run the targeted proof:
cargo test -p cortex-update --test update_config_home_override -- --test-threads=1 --nocapture
- Observe the test passes only because
UpdateManager::skip_version() writes update.json under HOME/.cortex/update.json and not under CORTEX_HOME/update.json.
Expected Behavior
All update subsystem state should respect the active Cortex home override. If CORTEX_HOME is set, both:
update_cache.json
update.json
should be stored under that override rather than hardcoded HOME/.cortex.
Actual Behavior
The update subsystem uses dirs::home_dir().join(".cortex") directly:
UpdateConfig::load() / save() use HOME/.cortex/update.json
VersionCache uses HOME/.cortex/update_cache.json
As a result, update-related state is split away from the configured Cortex home.
Additional Context
Relevant source paths:
src/cortex-update/src/config.rs
UpdateConfig::load() uses dirs::home_dir().join(".cortex").join("update.json")
UpdateConfig::save() writes to dirs::home_dir().join(".cortex").join("update.json")
src/cortex-update/src/version.rs
VersionCache uses dirs::home_dir().join(".cortex").join("update_cache.json")
src/cortex-cli/src/upgrade_cmd.rs
UpgradeCli::run() creates config via UpdateConfig::load()
src/cortex-update/src/manager.rs
check_update_forced() writes the cache
skip_version() / clear_skip() write update.json
This is adjacent to, but not the same as, #51572 ("Config command ignores custom Cortex home path"). That issue is about the config command handler. This report is specifically about the cortex-update subsystem using its own hardcoded HOME/.cortex paths.
Project
cortex
Description
The update subsystem ignores
CORTEX_HOMEand usesHOME/.cortexfor both persistent update files:update_cache.jsonfrom the upgrade check pathupdate.jsonfrom the update config pathThis creates split state. The CLI help explicitly documents
CORTEX_HOMEas the config directory override, but the update subsystem bypasses it and writes under~/.cortexinstead.Error Message
Debug Logs
HOME=/tmp/cortex-repro-home CORTEX_HOME=/tmp/cortex-repro-config /tmp/cortex-bin/Cortex upgrade --check --yes --channel stable ✓ You are already on the latest version (v0.0.7) find /tmp/cortex-repro-home /tmp/cortex-repro-config -maxdepth 4 -type f -o -type d | sort /tmp/cortex-repro-config /tmp/cortex-repro-home /tmp/cortex-repro-home/.cortex /tmp/cortex-repro-home/.cortex/update_cache.jsonSystem Information
Screenshots
Prepared evidence image showing both the runtime repro and the targeted update-config proof:
/tmp/cortex-cortexhome-bug-evidence-clean.pngSteps to Reproduce
HOMEandCORTEX_HOMEto different directories.HOME=/tmp/cortex-repro-home CORTEX_HOME=/tmp/cortex-repro-config cortex upgrade --check --yes --channel stableupdate_cache.jsonis created underHOME/.cortex/update_cache.jsonand nothing is written underCORTEX_HOME.cargo test -p cortex-update --test update_config_home_override -- --test-threads=1 --nocaptureUpdateManager::skip_version()writesupdate.jsonunderHOME/.cortex/update.jsonand not underCORTEX_HOME/update.json.Expected Behavior
All update subsystem state should respect the active Cortex home override. If
CORTEX_HOMEis set, both:update_cache.jsonupdate.jsonshould be stored under that override rather than hardcoded
HOME/.cortex.Actual Behavior
The update subsystem uses
dirs::home_dir().join(".cortex")directly:UpdateConfig::load()/save()useHOME/.cortex/update.jsonVersionCacheusesHOME/.cortex/update_cache.jsonAs a result, update-related state is split away from the configured Cortex home.
Additional Context
Relevant source paths:
src/cortex-update/src/config.rsUpdateConfig::load()usesdirs::home_dir().join(".cortex").join("update.json")UpdateConfig::save()writes todirs::home_dir().join(".cortex").join("update.json")src/cortex-update/src/version.rsVersionCacheusesdirs::home_dir().join(".cortex").join("update_cache.json")src/cortex-cli/src/upgrade_cmd.rsUpgradeCli::run()creates config viaUpdateConfig::load()src/cortex-update/src/manager.rscheck_update_forced()writes the cacheskip_version()/clear_skip()writeupdate.jsonThis is adjacent to, but not the same as,
#51572("Config command ignores custom Cortex home path"). That issue is about theconfigcommand handler. This report is specifically about thecortex-updatesubsystem using its own hardcodedHOME/.cortexpaths.