Skip to content

fix(provider): enforce connection protocol contracts / 系统修复模型连接协议与错误恢复 - #9942

Merged
SivanCola merged 1 commit into
esengine:main-v2from
SivanCola:fix/provider-connection-contract
Sep 8, 2026
Merged

fix(provider): enforce connection protocol contracts / 系统修复模型连接协议与错误恢复#9942
SivanCola merged 1 commit into
esengine:main-v2from
SivanCola:fix/provider-connection-contract

Conversation

@SivanCola

@SivanCola SivanCola commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

Changing a saved provider connection's API format could keep a provider-specific route prefix and append a different protocol suffix. A DeepSeek Anthropic route could therefore become /anthropic/v1/chat/completions, return HTTP 404, expose the opaque internal provider ID, and later reload as a generic interrupted turn.

Fix

  • Add optional catalog identity to installed ProviderView records while keeping ProviderEntry.Name, saved provider/model references, cache keys, and session references stable.
  • Register DeepSeek's documented Chat, Responses, and Anthropic bases and resolve exact official protocol switches from that registry.
  • Preserve custom gateways, query-bearing URLs, and unknown paths; reject high-confidence protocol suffix conflicts in the editor, save path, and runtime with a recommended endpoint.
  • Carry safe structured failure diagnostics with provider ID, display name, protocol, HTTP status, category, and a sanitized request path.
  • Show the connection display name and API format in the primary error while keeping the internal ID and request path in diagnostic details.
  • Persist failed versus interrupted terminal display metadata so provider failures reload as their original HTTP/protocol error and user cancellation remains an interruption.

Compatibility and cache behavior

  • No provider ID or model-reference migration is required; deepseek-anthropic remains the stable connection ID.
  • New Wails and persisted JSON fields are optional. Legacy connections and sessions retain their previous fallback behavior, and older readers ignore the additional fields.
  • The provider-visible interrupted-turn recovery summary is byte-identical with and without the local display metadata, preserving prompt-cache behavior.
  • Existing custom endpoints are never silently rewritten.

Impact declarations

Cache-impact: low - local recovery display metadata and typed error diagnostics change, while provider-visible request and recovery-summary bytes remain unchanged.

Cache-guard: go test ./internal/agent -run TestInterruptedRecoveryDisplayMetadataDoesNotChangeProviderBlock -count=1 verifies byte-identical provider-visible recovery content.

System-prompt-review: SivanCola reviewed the internal/boot endpoint-validation wiring; it does not change system-prompt content, ordering, or serialization.

Documentation-impact: updated - the English and Chinese provider endpoint registries now document the DeepSeek Anthropic base alongside Chat and Responses routes.

Related PRs

Validation

  • go test ./... -count=1 -p 1
  • go test ./internal/config ./internal/provider/... ./internal/agent ./internal/boot ./internal/control -count=1 -p 1 after rebasing onto 218033719
  • (cd desktop && go test . -count=1)
  • focused frontend endpoint, provider editor, and controller metadata tests
  • (cd desktop/frontend && pnpm build) including TypeScript, lint, architecture, CSS, theme, and bundle-budget checks
  • git diff --check origin/main-v2...HEAD

The default parallel root suite intermittently timed out TestGoalTurnRunsPastTheOldRoundCeiling at its five-second wait boundary under local cross-package load. The same test passed 10/10 in isolation, the owning package passed normally, and the complete root suite passed with package concurrency disabled.

@SivanCola
SivanCola requested a review from esengine as a code owner September 8, 2026 06:39
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) provider Model providers & selection (internal/provider) labels Sep 8, 2026
Problem: protocol changes could combine a provider-specific base path with the wrong request suffix, surface opaque internal IDs, and reload provider failures as generic interruptions.

Root cause: provider identity, protocol routes, endpoint validation, and terminal display metadata were owned by separate layers without one shared contract.

Fix: attach catalog identity to saved connections, resolve official protocol routes from the documented registry, validate mismatches in the editor, save path, and runtime, carry safe display diagnostics, and persist failed versus interrupted terminal status without changing provider-visible recovery bytes.

Verification: root and Desktop Go suites, focused frontend tests, TypeScript and lint checks, production bundle budgets, compatibility guards, and git diff checks pass.
@SivanCola
SivanCola force-pushed the fix/provider-connection-contract branch from 0391f33 to 1453afb Compare September 8, 2026 07:22
@SivanCola
SivanCola merged commit 4ff06eb into esengine:main-v2 Sep 8, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) desktop Wails desktop app (desktop/**) provider Model providers & selection (internal/provider) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant