fix(reviewer): match the submission instruction to the backend's mechanism #84
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gllm-prompt-output-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every system prompt closed with "Submit ... using the tool.", hard
coded into the constant. That sentence was correct for Anthropic and
vLLM, which force a named tool call, and wrong for gllm, which has no
tool support at all — it drops tools/tool_choice at JSON decode, so all
four gllm passes shipped an instruction naming a mechanism the request
never carried. A model told to call a tool it has not been given cannot
comply, and improvises: prose, a fenced JSON blob, or a hallucinated
tool-call transcript, none of which decode.
Introduce OutputMode (OutputTools, OutputJSONSchema) and add it to the
Backend interface. The five prompt constants now hold body text only;
the closing instruction is appended per mode. Tool mode reproduces the
original sentences byte for byte, so nothing changes for Anthropic or
vLLM. JSON mode instead points the model at the schema by name and
forbids anything outside the object.
The schema name in the instruction is the same string the gllm backend
passes to response_format, so the prompt and the constraint cannot name
different things. The JSON-schema constraint itself was already in place
on all four gllm passes; what was missing was a prompt that agreed with
it.
The runner resolves the prompt for persistence through the same mode as
the backend it dispatches to, so prompt_system on the event row stays
identical to what was sent.
A config's SystemPromptOverride is still sent verbatim in both modes. It
replaces the prompt wholesale by contract, and appending our closing
line could contradict one the admin wrote deliberately.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Automated review by pr-reviewer v0.41.1 | Safety Check | Claude Sonnet 5 | tracking id
r-6682a2-33f8dbThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — Clean, well-tested refactor with no behavior change for existing tool-based backends and a targeted fix for the gllm prompt mismatch; nothing alarming found.
Reviewed the diff: this is a well-scoped refactor that adds an
OutputModeconcept to theBackendinterface and threads it through the prompt-building functions so gllm (JSON-schema mode, no tool support) no longer gets an instruction to "use the X tool."Checks:
Backend.OutputMode()) is implemented on all three backends (Anthropic, vLLM, gllm) plus the test doubles (fakeBackend,stubBackend), so nothing should fail to compile.TestToolModePromptsUnchanged, matching the stated goal of no behavior change for Anthropic/vLLM.response_formatin the actual request body — good regression coverage.SystemPromptOverrideis still passed through verbatim in both modes, matching stated intent, and there's a test for it.outputModeForfalls back toOutputToolsfor unregistered providers; that's cosmetically wrong for JSON-schema providers but harmless sincerunOneerrors out for that config anyway before this matters.Nothing here looks unsafe or like it shouldn't have been pushed.
f5aa7fd454f85830faa2