Skip to content

fix(status): wire CLI status() to get_all_metadata() fast path (#2153) - #2154

Open
javapacr wants to merge 2 commits into
MemPalace:developfrom
javapacr:fix/2152-cli-status-qdrant-get-all-metadata
Open

fix(status): wire CLI status() to get_all_metadata() fast path (#2153)#2154
javapacr wants to merge 2 commits into
MemPalace:developfrom
javapacr:fix/2152-cli-status-qdrant-get-all-metadata

Conversation

@javapacr

@javapacr javapacr commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #2153.

miner.status() now delegates to get_all_metadata() when the collection exposes it (same pattern as mcp_server._fetch_all_metadata(), #1796), before falling back to the existing offset loop.

Before: 1m46s (O(n²) — 32 full-collection re-fetches on Qdrant)
After: 3.4s (single _scroll_all() pass)
Palace: 159,601 drawers, Qdrant backend

@javapacr
javapacr force-pushed the fix/2152-cli-status-qdrant-get-all-metadata branch 2 times, most recently from 8973b42 to c4ef4f0 Compare August 4, 2026 16:16
…lace#2153)

CLI `mempalace status` (`miner.py:status()`) still used an O(n²)
offset-paginated loop even after the MCP server path was fixed in
MemPalace#1796/MemPalace#1836. For Qdrant, each `col.get(offset=N)` call materializes the
entire collection via `_scroll_all()` then slices — so ~32 full re-fetches
for a 159k-drawer palace.

Fix: after the chroma sqlite fast path returns None and the collection is
opened, check `getattr(col, "get_all_metadata", None)`. If callable,
fetch all metadata in one pass, tally wing/room counts, and return. The
existing offset loop remains as fallback for backends that don't expose
the contract method.

This mirrors the delegation pattern already used by
`mcp_server._fetch_all_metadata()` (MemPalace#1796).

Before: 1m46s on 159,601-drawer Qdrant palace
After:   3.4s (31x speedup)

Test: `tests/test_cli_status_fast_path.py` asserts status() uses
get_all_metadata() when available and does NOT call the offset loop,
plus fallback coverage for legacy collections.
@javapacr
javapacr force-pushed the fix/2152-cli-status-qdrant-get-all-metadata branch from c4ef4f0 to b86982d Compare August 4, 2026 16:17
Unblocks the lint check in MemPalace#2154 (ruff format --check was the only
failing CI job). No functional changes.
@javapacr

Copy link
Copy Markdown
Author

Pushed 83cd3c0: applied ruff format to tests/test_cli_status_fast_path.py — the only failing check was the format gate (1 file would be reformatted). All 6 tests pass locally on Python 3.13. CI for the new commit is awaiting maintainer approval (action_required) — could someone approve the workflow runs when convenient? 🙏

@igorls igorls added bug Something isn't working area/cli CLI commands labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI mempalace status still uses O(n²) offset loop on Qdrant — not wired to get_all_metadata()

2 participants