Commit 6e99277
fix(telegram): seed system prompt into chat history (IDENTITY.md was ignored)
handleChatMessage ran the agent via RunWithMessages(cs.Messages), but
RunWithMessages — unlike Run — does not inject the engine's system message, and
the per-chat session was seeded with only the user message. So the system prompt
(IDENTITY.md, the default, and the Telegram Quick Facts) was computed and set on
the agent but never sent to the model: fresh chats reached the LLM with no system
prompt and the agent answered as the provider's base identity (e.g. "I am
Claude"). The run/continue commands already prepend the system message before
RunWithMessages; Telegram did not.
Add seedSystemMessage() and call it before appending the user turn: prepend the
prompt for new/system-less histories, refresh messages[0] for resumed ones so
IDENTITY.md / prompt changes take effect on the next turn. Covers all message
types (text, voice, photo, commands) since they all funnel through
handleChatMessage. Add a regression test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent aaf6ff2 commit 6e99277
2 files changed
Lines changed: 69 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
934 | 952 | | |
935 | 953 | | |
936 | 954 | | |
| |||
996 | 1014 | | |
997 | 1015 | | |
998 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
999 | 1020 | | |
1000 | 1021 | | |
1001 | 1022 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments