Repository navigation
Apply workspace instructions to rewrites and summaries - #11
Merged
Merged
Conversation
The instructions field reached reply drafts and copilot, but not the rewrite actions or conversation summaries, so a style rule stored there applied to some AI text and not the rest. Tag suggestions stay without them: that prompt must return only JSON. Tell the rewrite prompt to keep the draft's language and to add no facts. The framing had neither rule.
|
Thanks for opening your first pull request in Libredesk. Please give CONTRIBUTING.md a read if you haven't already, it covers the setup, code style and the checks this PR needs to pass. A maintainer will review this soon. |
The client ignored finish_reason, so a reply cut off at the limit came back as a normal result. A long rewrite then replaced the agent's draft with text that stopped in the middle of a link. Treat finish_reason "length" as an error and tell the agent to raise Max tokens or shorten the text.
malpou
marked this pull request as ready for review
November 3, 2026 16:48
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.
What
instructionsfield to rewrites and summaries. It already reached reply drafts and copilot. Tag suggestions stay without it, because that prompt must return only JSON. Customer-facing assistants keep their own per-assistant instructions.max_tokens. The client ignoredfinish_reason, so a cut-off reply came back as a normal result.Testing
TestAppendInstructionscovers the prompt assembly.TestChatCompletionRejectsTruncatedReplyfails with the check removed.go test ./internal/ai ./internal/aiagentpasses.A live run against Sonnet 5.5 with synthetic Danish text covered all six rewrites, a summary and a reply draft with tools. With
max_tokens=1024, a 4416 character draft was cut off at 2033 characters. With 4096 it came back whole. That run predates thefinish_reasoncheck, and it did not confirm whatfinish_reasonSonnet 5.5 returns at the limit through the OpenAI-compatible endpoint.