Repository navigation
Let a runner send earlier prompts' context by its label alone - #68
Merged
Merged
Conversation
ChatRunner.SupersedesEarlierContext takes a function over a prompt's context. When it is set, the latest prompt that carries a context the function accepts, and every prompt after it, send their context in full; each context of an earlier prompt goes to the model as its label with a note that it is not repeated. The history, SaveHistory and the views keep every context's text, and nothing changes when it is not set.
jeff377
enabled auto-merge (squash)
December 1, 2026 14:11
|
This was referenced Dec 1, 2026
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.



Closes #67.
What
ChatRunner.SupersedesEarlierContext(Func<PromptContext, bool>?, defaultnull):PromptContextthe function accepts, and every prompt after it, send their context in full.<context label="…">with a short note ("Sent with this earlier prompt and not repeated; a later prompt carries the current text.") in place of its text, so the model still knows what the prompt was about.SaveHistory,LoadHistoryand the views keep every context's text. The function is read for each request, including the one sent after the user approves a tool call.Polhem MD's need ("keep the latest prompt that carries the document or a selection, and every prompt after it") is
context => isDocument(context.Label); "the latest prompt that has any context" is_ => true. Once this ships, polhem-dev/polhem-md can drop itsEarlierContextChatClientwrapper.Tests
EarlierContextTests: earlier context goes by label and the chosen prompt keeps it in full; context after the chosen prompt stays in full; nothing accepted sends everything in full; option not set behaves as before; a shortened prompt keeps its files;SaveHistoryround-trips every copy.Local:
dotnet build(Release, 0 warnings),dotnet test(all three test projects), the Blazor script tests andcheck-md-links.shall pass.Downstream
New public API only (
PublicAPI.Unshipped.txtupdated); the Polhem framework sees no change unless it sets the property.