Repository navigation
Coach: extra static headers for OpenAI-compatible endpoints - #386
Merged
DuarteSantos8 merged 1 commit intoOct 9, 2026
Merged
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.
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 #385.
Some OpenAI-compatible gateways refuse every call without extra headers — opencode Go 400s without
x-opencode-session(docs). This adds an optionalheadersmap to the compatible endpoint config:api/coach/routes.js+validateHeadersinapi/coach/core/providers.js): max 8 entries, token-shaped names, values ≤500 chars;authorization/content-type/hostand friends refused. Stored plaintext next tobaseUrl(routing aids, not credentials); empty clears. Same fixed-endpoint gate asbaseUrl; combined baseUrl+headers POST keeps both.api/coach/core/adapters/http.js): merged under auth framing on models, check, test and job calls; reserved names re-filtered at send time so a stored map can never override auth.Name: valuelines, parsed client-side, empty clears).docs/AI_COACH.md.Tests: wire-level adapter assertions (headers ride on models+invoke, auth wins over a smuggled map), route accept/refuse/clear+persist, textarea parse round-trip. All green; full-file suites match clean-tree baselines exactly (the 1 routes + 16 jobs/coach failures reproduce on unmodified main — pre-existing/environmental).
Out of scope: Responses-API protocol support — separate feature.