Repository navigation
fix: keep flat Context prompt and tools when the transcript has no system message - #38
Merged
Merged
Conversation
…stem message Fixes simonsmh#37 omp 18.12.3 exports the full pi-ai transcript toolkit to legacy extensions yet still calls `stream` with a flat Context, so `systemPrompt` and `tools` arrive unfolded. `hasTranscript` keyed off helper presence alone, so the transcript path ran, `getCurrentTools` found no system message to read `toolsAdded` from, and every request shipped `tools: []` — the model then answered with DSML text markup and the host dropped the turn as empty. Take the transcript path only when the collapsed transcript actually has a leading system message; otherwise keep the flat fields.
|
Just have ran into the same problem... My diagnose and fix is almost identical to yours. And it did worked. Respect. |
DuckSoft
approved these changes
Oct 20, 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.
Fixes #37
Problem
resolveRequestContextchose the transcript contract purely by helper presence. omp 18.12.3 exports the full pi-ai transcript toolkit to legacy extensions (oh-my-pi #16313) but still callsstreamwith a flatContext:systemPromptandtoolsare not folded into a leadingrole: "system"message.Consequences of taking the transcript path there:
getCurrentTools(messages)readstoolsAddedoff system messages, finds none, returns[]→ every Qoder request went out withtools: [].Verified at the plugin boundary on the same command:
ctxTools: 2, resolvedTools: 0on 18.12.3 vs2/2on 18.12.2.Change
The leading system message is the only proof that the host folded the prompt and tools into the transcript, so require it before replaying:
The doc comment now names the three contracts: folded transcript (pi ≥0.86), flat context with helpers exported (omp 18.12.x), flat context without helpers (pi ≤0.85).
Tests
Context+ full toolkit keepstoolsand the prompt (the regression).Contextwithout tools keeps the prompt and ships no tools.End-to-end
Built this branch and installed it over the plugin dir, then ran the stock omp 18.12.3 binary (the version that fails with 0.6.1):
Also still correct on omp 18.12.2.