Skip to content

fix(cli): prevent analytics thread from blocking command exit - #1342

Open
mikemikimike wants to merge 1 commit into
basicmachines-co:mainfrom
mikemikimike:fix/1333-daemon-analytics
Open

fix(cli): prevent analytics thread from blocking command exit#1342
mikemikimike wants to merge 1 commit into
basicmachines-co:mainfrom
mikemikimike:fix/1333-daemon-analytics

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Fixes #1333

Summary

The CLI analytics helper starts a background request thread for the cloud promo path. Because the thread was non-daemon, one-shot commands such as bm schema validate could finish their work and output while Python interpreter shutdown waited indefinitely for the analytics request.

This change makes the best-effort analytics thread daemonized, so analytics cannot keep the CLI process alive. The existing request timeout and silent failure behavior are unchanged. A regression assertion verifies the thread is created as a daemon.

Tests

  • uv run --frozen pytest tests/cli/test_analytics.py tests/cli/test_cli_schema.py -q --no-cov (28 passed)
  • uv run --frozen ruff check src/basic_memory/cli/analytics.py tests/cli/test_analytics.py
  • uv run --frozen ruff format --check src/basic_memory/cli/analytics.py tests/cli/test_analytics.py
  • git diff --check

Signed-off-by: mikemikimike <13286568797@163.com>
@mikemikimike
mikemikimike force-pushed the fix/1333-daemon-analytics branch from 652cc41 to c7d3a09 Compare August 27, 2026 07:15
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.

[BUG] bm schema validate <type> prints its result then never exits — interpreter shutdown blocks on a lingering thread

1 participant