lean-ctx icon indicating copy to clipboard operation
lean-ctx copied to clipboard

bug: Migration seems fundamentally broken (`~/.lean-ctx` still used as primary data directory)

Open teadatuntud opened this issue 5 months ago • 2 comments

lean-ctx version: lean-ctx 3.8.7 (official, https://github.com/yvgude/lean-ctx)

OS: Linux

AI tool: Claude Code

What happened: The migration seems to be fundamentally broken. I started a new session in a project I'm using lean-ctx in and all files are written to ~/.lean-ctx instead of the appropriate XDG directories. So while the files were correctly moved by lean-ctx doctor --fix, nothing is actually using them later. What am I missing?

P.S. This may be connected to #434, #436 etc.

What you expected: lean-ctx to actually use the updated XDG directories post-migration.

Steps to reproduce:

  1. Migrate via lean-ctx doctor --fix
  2. Start a new Claude Code session in lean-ctx indexed project directory
  3. Observe that every previously migrated directory is re-created in ~/.lean-ctx and files are saved into them

Relevant output: N/A

teadatuntud avatar Jun 16 '26 09:06 teadatuntud

Same root cause as #434/#436, not a separate bug.

The data-dir resolver used to adopt ~/.lean-ctx whenever it merely existed, so after doctor --fix moved your data the resolver kept pointing at the old (now marker-free) dir and a new session re-created the whole tree there. Fixed on main in 65a4ce080c: the legacy decision now requires actual data markers (single_dir_override), so once split, data/config/state/cache all flip to $XDG_*.

A handful of feature-specific writers also hard-coded ~/.lean-ctx and re-created it regardless of the resolver. Migrated in 05fd7a443b to the typed data_dir() resolver (the same category doctor --fix moves them to):

  • multi-agent shared_knowledge.json (core::agents)
  • Jira OAuth credentials (core::providers::jira_oauth)
  • personal-cloud cache/knowledge (cloud_client / cloud_sync)

The one remaining hard-coded writer is the background auto-updater's log path; it's pinned by a source-level firewall test (rust/tests/legacy_path_firewall.rs) and will follow. Will close with the next release.

yvgude avatar Jun 16 '26 14:06 yvgude

Fixed in v3.8.8. The data resolver no longer re-adopts a marker-free legacy ~/.lean-ctx, and every remaining direct writer (multi-agent knowledge, Jira OAuth, cloud cache, LaunchAgent/update logs, the A2A task store, the ctxpkg signing key, …) now routes through the typed data_dir()/state_dir() resolvers. A cross-category contract test plus a source-level legacy-path firewall lock the invariant in. Thanks for the report!

Release: https://github.com/yvgude/lean-ctx/releases/tag/v3.8.8

yvgude avatar Jun 17 '26 00:06 yvgude