Skip to content

fix: resolve every uteke home path through uteke_home() - #830

Merged
ajianaz merged 1 commit into
codecoradev:developfrom
themiguelamador:fix/mcp-server-reads-legacy-store-path
Aug 3, 2026
Merged

ajianaz merged 1 commit into
codecoradev:developfrom
themiguelamador:fix/mcp-server-reads-legacy-store-path

Conversation

@themiguelamador

@themiguelamador themiguelamador commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Four call sites hardcode ~/.uteke instead of calling uteke_core::uteke_home() — the resolver that handles the UTEKE_HOME override, the current ~/.codecora/uteke default, and legacy-path auto-migration. The store moved to ~/.codecora/uteke; these were never updated. (chore/migrate-default-data-dir doesn't touch them either.)

Two of them cause real, silent misbehavior.

1. uteke-mcp/src/main.rs:31 — the MCP server opens a different store from the CLI

Everything written via uteke remember, uteke import, or the HTTP server is invisible to uteke_recall, and everything written through MCP is invisible to the CLI. The server also creates an empty store at ~/.uteke on first run. The path isn't configurable, so there's no flag or env var to work around it.

The failure is completely silent. initialize and tools/list succeed, uteke_recall returns a well-formed "No results found.", and uteke stats reports a healthy store the whole time. An agent looks correctly wired while its memory is permanently empty — you only catch it by comparing uteke_stats against uteke stats and noticing the DB byte counts differ.

I hit this after importing 67 memories via the CLI and finding MCP recall returning nothing:

uteke stats --namespace demo                     → Total memories: 67 | DB: 1421312 bytes
MCP uteke_stats {"namespace":"demo"}             → Total: 0 | Tags: 0 | DB: 253952 bytes

Repro:

uteke remember "canary" --namespace demo
uteke stats --namespace demo          # Total memories: 1
# via MCP: {"name":"uteke_stats","arguments":{"namespace":"demo"}}
#   → "Total: 0 | Tags: 0"

2. config.rs set_default_namespace — uteke namespace switch is a no-op

It writes ~/.uteke/uteke.toml, but Config::load reads global_config_path(), which already resolves via uteke_home(). So the command reports success and changes nothing:

$ uteke namespace switch canary
✓ Default namespace set to 'canary'

~/.codecora/uteke/uteke.toml  → namespace = "default"   # what load() reads
~/.uteke/uteke.toml           → namespace = "canary"    # what nothing reads

3 & 4. logging.rs and config.rs ensure_dirs / migrate_legacy_global

These write the log file, models/, and a default uteke.toml to the legacy path — recreating ~/.uteke on every CLI run and leaving a plausible-looking config file that nothing consults, which is its own debugging trap. logging.rs already documented itself as writing to {uteke_home}/uteke.log.

Not changed

  • The project-scoped ./.uteke/uteke.toml lookups in config.rs:419 and uteke-server/src/main.rs:521 — that's the documented per-project config and correct as-is.
  • uteke_home()'s own reference to ~/.uteke, which is the migration source.

Verification

Against an isolated HOME, before and after: namespace switch now writes the file load() reads, logs land in ~/.codecora/uteke/, ~/.uteke is no longer created on CLI runs, and CLI and MCP report the same store.

Users with existing memories at ~/.uteke get them auto-migrated by uteke_home() on next start, same as the CLI already does.

cargo fmt --check and cargo clippy --workspace --all-targets -- -D warnings both clean.

Four call sites hardcode `~/.uteke` instead of calling `uteke_core::uteke_home()`,
the resolver that handles the `UTEKE_HOME` override, the current
`~/.codecora/uteke` default, and legacy-path auto-migration. The store moved to
`~/.codecora/uteke`; these were never updated. Two of them cause real,
silent misbehavior.

1. uteke-mcp/src/main.rs — the MCP server opens a DIFFERENT STORE from the CLI

Everything written via `uteke remember`, `uteke import`, or the HTTP server is
invisible to `uteke_recall`, and everything written through MCP is invisible to
the CLI. The server also creates an empty store at `~/.uteke` on first run. The
path is not configurable, so there is no flag or env var to work around it.

The failure is silent: `initialize` and `tools/list` succeed, `uteke_recall`
returns a well-formed "No results found.", and `uteke stats` reports a healthy
store the whole time — so an agent looks correctly wired while its memory is
permanently empty.

    uteke remember "canary" --namespace demo
    uteke stats --namespace demo          # Total memories: 1
    # via MCP: {"name":"uteke_stats","arguments":{"namespace":"demo"}}
    #   → "Total: 0 | Tags: 0"

2. config.rs set_default_namespace — `namespace switch` is a no-op

It writes `~/.uteke/uteke.toml`, but `Config::load` reads `global_config_path()`,
which already resolves via `uteke_home()`. The command reports success and
changes nothing:

    $ uteke namespace switch canary
    ✓ Default namespace set to 'canary'
    ~/.codecora/uteke/uteke.toml  → namespace = "default"   # what load() reads
    ~/.uteke/uteke.toml           → namespace = "canary"    # what nothing reads

3/4. logging.rs and config.rs ensure_dirs/migrate_legacy_global — these write the
log file, `models/`, and a default `uteke.toml` to the legacy path, recreating
`~/.uteke` on every CLI run and leaving a plausible-looking config file that
nothing consults. logging.rs already documented itself as `{uteke_home}/uteke.log`.

Left alone: the project-scoped `./.uteke/uteke.toml` lookups in `config.rs` and
`uteke-server/src/main.rs`, which are the documented per-project config, and
`uteke_home()`'s own reference to the legacy path, which is the migration source.

Verified against an isolated HOME before and after: `namespace switch` now writes
the file `load()` reads, logs land in `~/.codecora/uteke/`, `~/.uteke` is no
longer created, and CLI and MCP report the same store.
@themiguelamador
themiguelamador force-pushed the fix/mcp-server-reads-legacy-store-path branch from ac2e9a4 to b0559d4 Compare August 3, 2026 00:13
@themiguelamador themiguelamador changed the title fix(mcp): open the canonical store, not the legacy ~/.uteke path fix: resolve every uteke home path through uteke_home() Aug 3, 2026

@ajianaz ajianaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. MCP server was hardcoded to legacy ~/.uteke path — this correctly routes through uteke_home() for all 3 call sites. The migration_legacy_global fix is also correct. The comments explaining why are excellent.

@ajianaz
ajianaz merged commit e53676d into codecoradev:develop Aug 3, 2026
9 checks passed
ajianaz added a commit that referenced this pull request Aug 5, 2026
- v0.12.0: add @KazamiHazaki (Windows installer #779) + @dependabot
- v0.11.0: add @themiguelamador (#830 #831) + @tomatotomata (#829)
- v0.12.0: add install.ps1 to Added section

Co-authored-by: ajianaz <[email protected]>
ajianaz added a commit that referenced this pull request Aug 13, 2026
- v0.12.0: add @KazamiHazaki (Windows installer #779) + @dependabot
- v0.11.0: add @themiguelamador (#830 #831) + @tomatotomata (#829)
- v0.12.0: add install.ps1 to Added section

Co-authored-by: ajianaz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants