You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question side chats ("Talk it through") miss the asker's prompt cache #428
While working on an extension that used side-chats, Ultimate pointed out to me that starting one from a question card would always cause a cache write, which can be expensive with a large context.
It looks like the side chat's first turn writes the asker's whole context again, and reads nothing from the cache. Once that first turn runs, the rest of the conversation is cached as normal.
What Ultimate reports back:
In a test instance, the first turn of a question side chat wrote every token and read none from the cache, in both runs.
Tab side chats don't have this problem, since they keep the asker's tools and prompt. One hit the cache 4.2 minutes after the asker's last call, and one missed at 6.5 minutes, which is expected with a 5-minute cache.
Ultimate found two causes after looking into it, and each one changes the cached prefix (tools come first, then the system prompt):
At the fork, openOnQuestion adds draft_answers to the copy's tools and modelTools.
The copy builds its system prompt from scratch, instead of reusing the asker's. In its test, the copy had 21 prompt sections to the asker's 20: a new lineage section, plus a newer automations section.
I saw this on Ultimate 454096bf, and the code is the same on main (dcc3a2e).
What needs to happen
Let a question side chat fill in the card without adding a tool to the fork.
Give the fork's first turn the exact system prompt from the asker's last call.
Acceptance criteria
A question side chat's first turn reads the asker's context from the cache, as long as that cache is still alive.
The side chat can still fill in the card, and still can't change anything else.
If you think this is a real bug, I'm happy to put up a PR to fix it :)
This issue was assisted by an agent (Ultimate), and I wrote the description.
Activity