Repository navigation
Coach: retry compatible jobs through the Responses API on protocol 400 - #387
Open
janviernine wants to merge 4 commits into
Open
janviernine wants to merge 4 commits into
janviernine wants to merge 4 commits into
Conversation
…ntos8#385) Gateways that demand routing/session headers (opencode Go's x-opencode-session) 400 every call without them. Adds an optional headers map to the compatible endpoint config: validated at write (max 8, token names, auth/transport names refused), merged under auth framing at send time on models, check, test and jobs. Admin card gains an Extra headers field (Name: value lines, empty clears); docs/AI_COACH.md notes it. Tests: wire-level adapter assertions, route accept/refuse/clear, textarea parse helpers.
Some gateways serve a model ONLY at /v1/responses (opencode Go's muse-spark-*-contributor answers the Chat shape with 400 Model does not support this protocol). The compatible adapter now retries once through a Responses shape: input array, json_schema text format, output_text parsing with refusal/truncation handling. Extra headers ride along on the second shape, so gateway routing still applies. List models is untouched.
This branch has not been deployed
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.
Includes #386's commits — merge that first, or review stacked; the new work is the top commit only (
58ef043).Some gateways serve a model ONLY at
/v1/responses: opencode Go'smuse-spark-*-contributoranswers the Chat shape with400 Model does not support this protocol(verified live). This retries once through a Responses shape, inside one invoke:api/coach/core/adapters/responses.js:inputarray (shared system prompt + user prompt),json_schematext format,output_textparsing with refusal-as-error and max-output truncation, same contract asopenai.js.http.js): the invoke loop now works through anactiveshape; on exactly that 400 it swaps shape and re-POSTs once. Extra headers ride along untouched. List models and check are unaffected.compatible.jsonly — minimal blast radius):spec.responsesFallback.docs/AI_COACH.md.Tests: retry fires once on the protocol 400 (URL, input shape, schema format, headers on both calls); any other 400 stays final; refusals read as errors; truncation fails as provider. File suite: 24/24 green; repo-wide baselines match the clean tree (pre-existing failures disclosed in #386).