fix(cli): prevent analytics thread from blocking command exit - #1342
Open
mikemikimike wants to merge 1 commit into
Open
fix(cli): prevent analytics thread from blocking command exit#1342mikemikimike wants to merge 1 commit into
mikemikimike wants to merge 1 commit into
Conversation
Signed-off-by: mikemikimike <13286568797@163.com>
mikemikimike
force-pushed
the
fix/1333-daemon-analytics
branch
from
August 27, 2026 07:15
652cc41 to
c7d3a09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 validatecould 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.pyuv run --frozen ruff format --check src/basic_memory/cli/analytics.py tests/cli/test_analytics.pygit diff --check