fix(llmcore): use neutral default identity for native Claude sessions (closes #712) - #722
Open
Kailigithub wants to merge 1 commit into
Open
Conversation
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
The
NativeClaudeSession.raw_askdefault identity prompt was hard-coded toYou are Claude Code, Anthropic's official CLI for Claude.. On machineswhere
self.systemis empty (e.g. a freshly-copied portable directory thatfails to load
mykey.py), the model retained the Claude Code identity andintroduced itself as Claude Code.
This PR swaps the unconditional default for a neutral identity and only
emits the Claude Code framing when the user has explicitly opted into the
CC-protocol relay via
fake_cc_system_prompt=True. Existingfake_cc_system_prompt=Truesetups are preserved bit-for-bit.Fix
llmcore.pyline 778 — the literal string is replaced with a conditionalexpression:
The downstream branches (
if self.fake_cc_system_prompt: payload["system"].append(...)vselse: payload["system"] = [...]) already condition onfake_cc_system_prompt,so only the unconditional seed prompt needed gating.
Scope
llmcore.pytests/(the repo has no pytest suite); theregression harness lives at
/tmp/test_issue_712.pyand is documented below.Verification
/tmp/test_issue_712.pyexercisesNativeClaudeSession.raw_askwith astubbed
requests.postand asserts the outgoingsystempayload:system[0].textsystem[1].text(ifself.system)fake_cc_system_prompt=False,self.system=""fake_cc_system_prompt=True,self.system="Custom system prompt"Three-step dance (stash → test fails on main because the literal still
contains
You are Claude Code→ pop → test passes with the fix) confirmsthe harness catches the regression.
Backward compatibility
fake_cc_system_prompt=True(the documented path for CC relay channelsper
mykey_template.py) keeps emitting the original Claude Codeidentity text byte-for-byte.
self.systemis still prepended as before for CC relay channels, andused to override the default for the standard Anthropic path.
users who have not configured their own system prompt.
Refs
Closes #712