Skip to content

refactor(probe): remove client probe methods, dispatch through real-traffic paths - #1138

Merged
0x0079 merged 3 commits into
mainfrom
refactor/probe-client-cleanup
Jun 5, 2026
Merged

refactor(probe): remove client probe methods, dispatch through real-traffic paths#1138
0x0079 merged 3 commits into
mainfrom
refactor/probe-client-cleanup

Conversation

@0x0079

@0x0079 0x0079 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Pure structural refactor of the probe subsystem — no behavioral changes.

  • Remove all probe-specific methods from the client package: deleted Probe, ProbeStream, ProbeChatEndpoint, ProbeResponsesEndpoint, ProbeModelsEndpoint, ProbeOptionsEndpoint and friends from OpenAIClient, AnthropicClient, ClaudeClient, KimiClient, CodexClient, GoogleClient (~1370 lines removed)
  • Dispatch probes through real-traffic methods: new internal/probe/sdkprobe.go constructs minimal requests and calls the same ChatCompletionsNew, ResponsesNew, MessagesNew, GenerateContent methods used by production traffic — provider-specific quirks (Kimi model-name normalization, Codex Responses-only + forced streaming, Claude Code thinking-disable/beta headers via Guard) apply automatically with zero drift
  • Relocate probe types: ProbeResult / ProbeToolCall and tool definitions moved from internal/client into internal/probe (result.go, probetools.go)

Motivation

The duplicated probe methods in every client type caused dual-stack drift: provider quirks had to be maintained in both probe and production paths. Routing probes through the same methods as real traffic eliminates this class of bug entirely.

Key files

File Change
internal/probe/sdkprobe.go New: SDK probe dispatchers (probeOpenAIChat, probeAnthropicMessages, etc.)
internal/probe/result.go New: relocated ProbeResult / ProbeToolCall
internal/probe/probetools.go New: relocated tool definitions (unexported)
internal/probe/e2e.go ProbeProviderWithSDK rewritten to dispatch via SDK methods
internal/probe/lightweight.go Simplified to use SDK dispatchers
internal/client/*.go Removed probe methods (~1370 lines)
internal/client/probe.go, probe_tools.go Deleted (relocated to probe package)

Verification

  • go build ./... passes
  • go test ./internal/probe/... passes
  • Client test package compiles cleanly apart from a pre-existing unrelated failure in logging_roundtripper_test.go (present on main)
  • Code review (correctness): no confirmed or plausible bugs. The "no drift" claim verified against the actual client implementations:
    • Kimi: KimiClient.ChatCompletionsNewnormalizeChatRequeststripKimiPrefix, so the raw model name is normalized before hitting the wire
    • Claude Code: ClaudeClient overrides both MessagesNew and MessagesNewStreaming; both route through Guard (thinking-disable + session injection + provider client options), so simple-mode probes are covered too
    • Codex: CodexClient.ResponsesNew assembles a non-streaming result from ResponsesNewStreaming with Codex defaults, preserving the old forced-streaming behavior
    • ProbeModelsEndpoint was never used by lightweight.go (it uses ListModels + IsModelsEndpointNotSupported), so its removal is inert

@0x0079
0x0079 force-pushed the feat/endpoint-mode-auto branch from ac6e0f2 to a6e89ca Compare June 5, 2026 06:55
@0x0079
0x0079 force-pushed the refactor/probe-client-cleanup branch 2 times, most recently from f682735 to 037ff05 Compare June 5, 2026 08:31
claude added 3 commits June 5, 2026 08:40
Add probe/sdkprobe.go with minimal-request builders that call the
client's production methods (ChatCompletionsNew, ResponsesNew,
MessagesNew, GenerateContent) instead of dedicated client Probe* APIs.
Routing probes through the real path means provider quirks (Kimi model
normalization, Codex Responses handling) apply identically and cannot
drift. Rewire E2E and lightweight services onto these builders; the
auto-fallback now lives entirely in the probe module. Client Probe*
methods are now unused and removed in a follow-up commit.

https://claude.ai/code/session_01N9JnUTVt41NcGxYyj3xewf
Delete the now-unused Probe/ProbeStream/ProbeChatEndpoint/
ProbeResponsesEndpoint/ProbeModelsEndpoint/ProbeOptionsEndpoint methods
and the bespoke Codex ChatGPT-backend probe from every client, along
with the Prober/EndpointProber interfaces and the probe entries on
OpenAIClientInterface/AnthropicClientInterface. Probing now lives in the
probe module and dispatches through the clients' real-traffic methods.
Trim obsolete client probe tests to the surviving timeout/ListModels
coverage.

https://claude.ai/code/session_01N9JnUTVt41NcGxYyj3xewf
Move ProbeResult/ProbeToolCall, the probe-tool builders, and the
result helper from internal/client into internal/probe, and fold the
probe test-mode enum into the existing E2EMode. The client package no
longer carries any probe vocabulary; E2EData now aliases the local
ProbeResult. Drop the dead ProbeUsage type.

https://claude.ai/code/session_01N9JnUTVt41NcGxYyj3xewf
@0x0079
0x0079 force-pushed the refactor/probe-client-cleanup branch from 037ff05 to 21bfe94 Compare June 5, 2026 08:44
@0x0079
0x0079 changed the base branch from feat/endpoint-mode-auto to main June 5, 2026 08:45
@0x0079
0x0079 merged commit 6ffdf2f into main Jun 5, 2026
@0x0079
0x0079 deleted the refactor/probe-client-cleanup branch June 5, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants