Use llmgateway mode constants for direct/proxy modes - #5790
Merged
Merged
Conversation
The llmgateway package declares ModeDirect/ModeProxy as the single compiler-checked source of truth for gateway mode strings, and its doc comment says they exist "rather than carrying private string copies that can drift." ModeCredentialHelper already followed that; the direct/proxy client registrations and hasProxyMode still hand-typed the literals. Swap the remaining "direct"/"proxy" literals to the constants so a typo becomes a compile error instead of a silently-unmatched mode. Purely mechanical — no behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5790 +/- ##
==========================================
- Coverage 70.83% 70.76% -0.07%
==========================================
Files 684 684
Lines 69355 69355
==========================================
- Hits 49125 49081 -44
- Misses 16624 16685 +61
+ Partials 3606 3589 -17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Context: this originated from a review comment on #5789 (Codex LLM-gateway support), where the |
5 tasks
rdimitrov
approved these changes
Jul 14, 2026
1 task
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.
Summary
The
llmgatewaypackage declaresModeDirect/ModeProxy/ModeCredentialHelper/ModeCodexAuthas the single compiler-checked source of truth for gateway-mode strings. Its own doc comment states they exist so both packages "reference one compiler-checked set of values rather than carrying private string copies that can drift."ModeCredentialHelper(and, on the Codex branch,ModeCodexAuth) already follow this, but the direct/proxy client registrations andhasProxyModestill hand-typed the raw"direct"/"proxy"literals — the exact drift the constants were introduced to prevent. This was surfaced by a review comment on #5789 (Codex support); the fix there covered thewarnTLSSkipVerifyswitch it touched, and this PR sweeps the rest so main is consistent.Swapping the literals to the constants makes a typo a compile error instead of a silently-unmatched mode.
pkg/client/config.go: 6LLMGatewayMode: "proxy"/"direct"registrations →llmgateway.ModeProxy/ModeDirectpkg/llm/setup.go:hasProxyMode'st.Mode == "proxy"→llmgateway.ModeProxyPurely mechanical — no behaviour change.
Type of change
Test plan
task test— pkg/client, pkg/llm)golangci-lint— 0 issues)task build)Does this introduce a user-facing change?
No.
Special notes for reviewers
warnTLSSkipVerify's"direct"/"proxy"cases are deliberately not touched here — they're being converted in #5789, which actively modifies that switch. Kept separate to avoid a merge conflict between the two PRs.Generated with Claude Code