Repository navigation
fix(chat): apply system prompts once per request - #3864
Conversation
Approve with suggestionsA custom system prompt was being applied twice — once by the SDK when it builds the request, once again by the provider client that held its own copy — and an updated prompt left the old persona in place. Dropping the provider-held copy is the right fix: the SDK is the only layer that sees per-request overrides, so it should be the only layer that inserts the prompt. The new tests are genuine regression tests (they fail against the old code) and cover all four send paths plus both update routes. One thing worth a look before merge, not a blocker: the fix is verified only against the local Lemonade path. For a library user running the SDK against Claude or OpenAI with a configured prompt, the prompt used to reach those services through their dedicated system-prompt channel; now it only survives as text inside the user message. It still reaches the model, so nothing breaks, but it's a quieter change than the PR describes and no test covers it. Worth either confirming that's intended or following up. Real-world evidenceNo evidence bundle was produced for this run (the automated stage didn't write one). The PR description reports a live Lemonade persona check returning ALPHA before the update and BETA after, which is exactly the right check for this change, but the transcript isn't pasted — consider inlining the two-line output so a reviewer can see it. The change touches the SDK/CLI surface, not the Agent UI, so no screenshot is expected. My verdict otherwise rests on static review plus reading the new tests; I could not execute them here (no pytest in this environment). 🔍 Technical details🟡 Cloud providers lose their native system channel on the
Note this does not affect agents: 🟢 Prompt-ownership note landed under the wrong heading ( The paragraph sits between (Apply this over the added paragraph plus the Strengths
|
|
Refreshed this branch against current The update was a clean merge: nothing was resolved by hand, and no commit on this branch was rewritten. CI now runs against an up-to-date base. |
main is broken: `test_chat_system_prompt_owner.py` (added by amd#3864) still imports `OpenAIProvider` directly, which amd#3899 deleted as an intentional API break. amd#3899's own validation command never ran this file, so the collision only showed up once both merged. Every non-Claude cloud model now goes through `LemonadeProvider` — its wire shape (system prompt folded into `messages[0]`) is exactly what this test needs to exercise, so the fix swaps the mock target from a raw OpenAI SDK client to `LemonadeProvider._backend` instead of reintroducing the deleted class. ## Test plan - [x] `python -m pytest tests/unit/test_chat_system_prompt_owner.py -q` — 16 passed - [x] `python -m pytest tests/unit/ -k "chat_sdk or system_prompt or lemonade_provider or test_claude_provider or test_removed_llm_providers"` — 134 passed - [x] `git grep` confirms no other references to the removed `OpenAIProvider`/`openai_provider` module remain Co-authored-by: f <f@f>
Custom system prompts no longer reach the model twice or retain the old persona after an update. The SDK owns per-request prompt assembly and preserves the native system-message channel for local and cloud providers.
Fixes #3510.
Test plan:
The full agent benchmark has not been rerun; live validation targets the changed SDK behavior.