Skip to content

feat(desktop): align connection tests with the generate invoke contract - #2

Closed
Lxr-max wants to merge 1 commit into
mainfrom
cursor/connection-test-invoke-parity-15f0
Closed

Lxr-max wants to merge 1 commit into
mainfrom
cursor/connection-test-invoke-parity-15f0

Conversation

@Lxr-max

@Lxr-max Lxr-max commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

Connection testing was a separate /models probe, so it could pass when generate would fail (wrong wire/auth/baseUrl) or fail when generate would work (/models missing). This PR extracts a shared effective invoke contract and makes connection:v1:test-active / connection:v1:test-provider a low-cost validation of that same contract.

  • test-active uses resolveActiveModel() (including snap-to-canonical-active) plus resolveCredentialForProvider() — the same path as generate, including ChatGPT Codex getValidAccessToken() refresh.
  • test-provider resolves the named provider with the same auth, header, canonical baseUrl, wire, and keyless rules.
  • GET /models is defined as optional discovery. Runtime generate never calls it. Missing /models + working inference is degraded / degraded-discovery. /models success + failed inference is ok: false with compatibility: "diverges" so the renderer can tell “reachable but not the real invoke path”.
  • Generate, memory, and complete() now canonicalize baseUrl with the same helper the connection test uses.

Type of change

  • Bug fix
  • New feature
  • Refactor (no behavior change)
  • Documentation
  • Build / CI / tooling
  • Breaking change

Linked issue

Fixes OpenCoworkAI#216

Refs OpenCoworkAI#214

Does not implement sibling OpenCoworkAI#213 (capability-aware diagnostics beyond invoke-parity).

Checklist

  • I checked the linked issue / relevant context before starting
  • pnpm lint && pnpm typecheck && pnpm test passes locally (pre-push hook: typecheck + lint + full unit suite)
  • Added/updated tests for the change
  • Added a changeset (pnpm changeset) if user-visible
  • Updated docs if behavior changed (i18n strings for the new toast states)

Principles 5b

  • Compatible: existing IPC ok / probeMethod / compatibility fields remain; new invokeParity, invokeContract, and diverges are additive.
  • Upgradeable: schemaVersion-bearing config is unchanged; connection-test payloads stay v1.
  • Lean: no new shipped dependencies; one shared contract module instead of a second probe stack.
  • Elegant: one resolveEffectiveInvokeContract + inferenceEndpointUrl instead of parallel credential/URL logic.

Tests

Regression coverage includes:

  1. test-pass / runtime-fail: /models 200 with a dead invoke URL (including openai-responses vs chat-only gateway) reports compatibility: "diverges" instead of Connection OK.
  2. test-fail / runtime-pass: /models 404 with working /chat/completions still reports degraded success (degraded-discovery).
  3. Parity: ChatGPT Codex OAuth (getValidAccessToken, no /models HTTP probe), keyless proxy (empty bearer), OpenAI-compatible gateway (canonical /v1 + Bearer).

Screenshots / recordings (UI changes)

Settings now uses structured toasts: success, degraded-info, and a distinct “reachable but generate would fail” error. No layout change; not verified in Electron (no desktop session in this environment) — covered by connection-test-toast.test.ts.

Open in Web Open in Cursor 

Make connection:v1:test-active and test-provider share active-provider
resolution, auth/headers, canonical baseUrl, wire, and keyless/OAuth
rules with generate. Probe the real inference endpoint and treat GET
/models as optional discovery, with structured diverges results when
the host is reachable but invoke would fail.

Fixes OpenCoworkAI#216

Signed-off-by: Xuanrui Li <xuanrui.li@se24.qmul.ac.uk>
@Lxr-max

Lxr-max commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR: OpenCoworkAI#421 (Fixes #216). Closing this fork-local PR so review happens on OpenCoworkAI/open-codesign.

@Lxr-max Lxr-max closed this Sep 14, 2026
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.

[Feature]: 对齐“测试连接”和“实际调用”链路 / Ensure connection-test and actual-invocation parity

1 participant