fix(cli): show configured project in list when uncredentialed (#1003)#1010
fix(cli): show configured project in list when uncredentialed (#1003)#1010rudi193-cmd wants to merge 1 commit into
Conversation
…achines-co#1003) `bm project list` seeded its table rows only from live query results — the cloud query (skipped when no credentials are present) and the local query. `config.projects` was used only to enrich existing rows, never to create one, so a cloud-mode project with no cloud credentials on the machine was surfaced by neither query and rendered an empty table. Meanwhile `bm project add` reads the DB and reports the same project already exists, so the two commands disagreed about whether the project existed. Seed a local-keyed row from `config.projects` for any configured project not already surfaced, scoped to the local-inclusive view so a `--cloud` or `--workspace`-filtered listing stays deliberately narrow. Adds a regression test covering the cloud-mode-without-credentials case. Fixes basicmachines-co#1003 Signed-off-by: rudi193-cmd <rudi193@gmail.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59844d1224
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Constraint: only fill from config for the local-inclusive view. A pure | ||
| # --cloud listing (no local_result) or a --workspace-filtered view is | ||
| # deliberately scoped, so configured local projects must not leak into it. | ||
| if local_result is not None and not workspace_filter_requested: |
There was a problem hiding this comment.
Keep config fallback out of --local listings
When the user runs bm project list --local after a project has been switched to cloud mode, the forced local query can legitimately return no row because set-cloud removes the local DB entry. This branch still seeds the cloud-mode config entry because local_result is non-None, so the --local listing shows a project that the local API did not return and later labels its CLI route as local (flag), making the flag no longer mean “show the local project list.” Gate this fallback to the default no-flag path (the uncredentialed mixed view) rather than all local-inclusive calls.
Useful? React with 👍 / 👎.
Summary
bm project listrenders an empty table even when a project exists inconfig.jsonand the local DB, whilebm project addreports the same project already exists — the two commands disagree about whether the project exists (#1003).Root cause
In
src/basic_memory/cli/commands/project.py,list_projects()seeds its table rows (row_names_by_key) exclusively from live query results:_has_cloud_credentials(config)and skipped when no credentials are present, andmode: cloudproject.config.projectsis consulted only to enrich rows that already exist (configured_names_by_permalink), never to create one. So a cloud-mode project with no cloud credentials on the machine is surfaced by neither query → empty table. Meanwhilebm project addreads the DB, finds the project, and reports "already exists".Fix
Seed a local-keyed row from
config.projectsfor any configured project not already surfaced by a query. The existing row-building logic already derives the correct display (cloud CLI route, https MCP) from the config entry.The fallback is scoped to the local-inclusive view — it is skipped for a pure
--cloudlisting (nolocal_result) and for a--workspace-filtered view, since those are deliberately narrowed and configured local projects must not leak into them.Test
Adds
test_project_list_shows_configured_project_without_cloud_credentialstotests/cli/test_project_list_and_ls.py: a cloud-mode project in config with_has_cloud_credentialsfalse and an empty local list now renders the project instead of an empty table. Verified the test fails onmain(empty table →StopIteration) and passes with the fix.Verification
tests/cli/test_project_list_and_ls.py— 14 passedtests/cli(full) — 414 passedruff check+ruff format --check— cleanty checkon the changed file — cleanFixes #1003