test: make lean_coding no-preamble test actually pin the guarantee#1648
Merged
ohdearquant merged 1 commit intoJul 3, 2026
Merged
Conversation
test_system_message_no_lion_preamble compared a hardcoded string literal against build_system_message() output, but build_system_message() never includes the LION preamble regardless of lion_system — the preamble is only prepended inside create_agent(). The test always passed whether or not the factory-level guard actually worked. Replace it with test_lean_coding_no_lion_preamble_at_runtime, which drives a lean_coding spec through create_agent() (load_settings=False) and asserts the rendered system message excludes LION_SYSTEM_MESSAGE. Verified red by temporarily forcing the preamble branch in factory.py locally, then reverting once the failure was observed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
test_system_message_no_lion_preamble(added on this branch, PR #1545) was vacuously true: it compared the variable name"LION_SYSTEM_MESSAGE"(a string literal) againstbuild_system_message()output, andbuild_system_message()never includes the LION preamble regardless oflion_systemanyway — the preamble is only prepended insidecreate_agent()(lionagi/agent/factory.py). The test would pass unconditionally, whether or not the factory-level guard actually worked.test_lean_coding_no_lion_preamble_at_runtime, which drives alean_codingspec throughcreate_agent(spec, load_settings=False)(same pattern already used bytest_create_agent_system_prompt_without_lion_systemintests/agent/test_factory.py) and asserts the rendered system message excludesLION_SYSTEM_MESSAGE.create_agentcheckingspec.lion_systembefore prepending) was already correct; only the test was broken.Base is
feat/agent-lean-coding-profile(PR #1545, draft) since that's whereAgentSpec.lean_coding()and this test currently live —lean_codingis not yet onmain.Closes #1554
Test plan
pytest tests/agent/test_spec.py— 62 passedpytest tests/agent/(full directory) — 197 passedruff check— cleanfactory.pylocally (if spec.lion_system:→if True:) — new test failed as expected; reverted, confirmed green again. Change never committed.🤖 Generated with Claude Code