Skip to content

Keep AI summaries off by default without the llm package - #408

Open
dbosk wants to merge 1 commit into
masterfrom
fix/ai-default-without-llm
Open

Keep AI summaries off by default without the llm package#408
dbosk wants to merge 1 commit into
masterfrom
fix/ai-default-without-llm

Conversation

@dbosk

@dbosk dbosk commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Both --ai and --no-ai write to dest="ai", and argparse fills the
default from the first action registered for a destination. Since --ai is
only registered when import llm succeeds, installations without llm fell
through to --no-ai's default=True — AI summaries were enabled precisely
when the backend was absent, injecting error text about the missing package
into every generated report.

Both actions now declare default=False: the default follows the capability,
not the flag registration, so AI summaries are strictly opt-in via --ai
(which only exists when the backend does). Behavior with llm installed is
unchanged, verified with a stubbed llm module: default False, --ai → True,
--no-ai → False.

The AI-flag registration moved into its own <<AI summary options>> chunk
with a subsection explaining the shared-destination pitfall. Regression test
poisons sys.modules["llm"] to exercise the no-llm path deterministically;
proven load-bearing against the pre-fix tangled code. Full suite: 470 passed
(baseline 469).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pb27a9hf6eNoetEWryx2fj

Both --ai and --no-ai write to args.ai, and argparse takes the default
from the first action registered for that destination. Since --ai is
only registered when the optional llm package imports, installations
without llm got --no-ai's default=True: analyse ran with AI enabled
exactly when the backend was missing, injecting error messages into
every generated report. Both actions now declare default=False, so the
default follows the capability instead of the flag registration. The
flag pair moves into its own <<AI summary options>> chunk with prose
explaining the asymmetry, plus a regression test that poisons
sys.modules to force the no-llm path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pb27a9hf6eNoetEWryx2fj
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.

1 participant