Skip to content

feat: warn about coding plan app allowlists#196

Merged
Sun-sunshine06 merged 4 commits intomainfrom
feat/coding-plan-compat-warning
Apr 23, 2026
Merged

feat: warn about coding plan app allowlists#196
Sun-sunshine06 merged 4 commits intomainfrom
feat/coding-plan-compat-warning

Conversation

@Sun-sunshine06
Copy link
Copy Markdown
Collaborator

Summary

Closes #195.

This PR adds clearer user-facing warnings for coding-plan / relay / protocol-conversion endpoints that may reject Open CoDesign because of app allowlists, even when they advertise an OpenAI-compatible API.

What changed

  • Added a compatibility notice next to the custom Base URL field in the Add Custom Provider modal.
  • Added an extra diagnostic hint for likely third-party gateways when connection failures look like app-allowlist / client-identity problems (400 / 401 / 403 / parse errors on non-official hosts).
  • Added locale strings for en, zh-CN, and pt-BR.
  • Added tests for the new compatibility warning and the gateway allowlist heuristic.

Why

Users often connect Open CoDesign to coding plans, Claude Code protocol relays, or other OpenAI-compatible gateways that only allow specific clients such as Claude Code, openclaw, or Hermes. When that happens, the visible error can look like a normal provider compatibility failure (for example issue #184), even though the real cause is an app allowlist on the service side.

This change does not try to work around those restrictions. It just makes the product more explicit about what users should check.

Validation

  • corepack pnpm --filter @open-codesign/desktop test -- AddCustomProviderModal ConnectionDiagnosticPanel
  • corepack pnpm --filter @open-codesign/desktop typecheck
  • git push pre-push checks passed (typecheck + biome check)

Notes

  • The repo still has an existing non-blocking Biome warning in apps/desktop/src/renderer/src/components/Settings.tsx about an extra hook dependency. This PR does not modify that file.

Sun-sunshine06 and others added 3 commits April 23, 2026 13:32
…#188)

Previously,  only enabled reasoning=true for official OpenAI
API when the modelId matched a reasoning pattern. This commit extends the
heuristic to also match reasoning-capable model IDs on any third-party
OpenAI-compatible proxy (univibe, OpenRouter custom endpoint, etc).

Fixes issue #188 where configured a proxy with OpenAI-compatible protocol
and a Claude 4 reasoning model would return 0 artifacts because the reasoning
flag was missing, causing the gateway to reject the request or return empty.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Sun-sunshine06 <Sun-sunshine06@users.noreply.github.com>
Signed-off-by: Sun-sunshine06 <Sun-sunshine06@users.noreply.github.com>
@github-actions github-actions Bot added area:desktop apps/desktop (Electron shell, renderer) area:providers packages/providers (pi-ai adapter, model calls) labels Apr 23, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Blocker] inferReasoning now enables reasoning for third-party openai-chat endpoints based only on model-id heuristics, which can reintroduce request-shape incompatibility for OpenAI-compatible gateways (the same file documents that reasoning: true changes role handling for openai-chat). Evidence packages/providers/src/index.ts:229 (and documented behavior at packages/providers/src/index.ts:174).
    Suggested fix:

    case 'openai-chat':
      // Keep third-party gateways on the safest default unless we have
      // explicit capability detection/opt-in.
      return isOpenAIOfficial(baseUrl) && isReasoningModelId(modelId);
  • [Major] New UI classes add hardcoded hex fallback colors (#d97706) instead of token-only values, violating the repo token constraint for UI values. Evidence apps/desktop/src/renderer/src/components/AddCustomProviderModal.tsx:330 and apps/desktop/src/renderer/src/components/ConnectionDiagnosticPanel.tsx:185.
    Suggested fix:

    <div className="... border-[var(--color-warning)] bg-[var(--color-warning-soft)] ...">
      <AlertCircle className="... text-[var(--color-warning)]" />
    </div>

Summary

  • Review mode: initial
  • 2 issues found (1 Blocker, 1 Major).
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs in this runner, so review used repo-available constraints and diff evidence only.

Testing

  • Not run (automation).
  • Added tests are helpful for new heuristics/UI rendering, but there is still no guard test that prevents third-party openai-chat from regressing into incompatible reasoning/request-role behavior.

open-codesign Bot

Comment thread packages/providers/src/index.ts Outdated
// For third-party OpenAI-compatible gateways, heuristically match
// common reasoning model IDs — many gateways still require the
// reasoning flag to get extended thinking output.
return REASONING_MODEL_ID_PATTERN.test(modelId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openai-chat now returns true for third-party hosts when model IDs match this heuristic. That conflicts with the safety rationale documented above (reasoning: true alters request role handling and can trigger 400s on many OpenAI-compatible gateways). Consider reverting to official-host-only reasoning unless you add explicit capability detection/opt-in.

case 'openai-chat':
  return isOpenAIOfficial(baseUrl) && isReasoningModelId(modelId);

disabled={lockEndpoint}
/>
{!lockEndpoint && (
<div className="mt-2 rounded-[var(--radius-md)] border border-[var(--color-warning,#d97706)] bg-[var(--color-warning-soft,var(--color-surface))] px-3 py-2 text-[var(--text-xs)] text-[var(--color-text-secondary)]">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces hardcoded fallback color #d97706 in UI classes. Project constraints require token-based UI values only. Please use a token (or add one in packages/ui) and remove literal fallback hex values.

<div className="... border-[var(--color-warning)] bg-[var(--color-warning-soft)] ...">
  <AlertCircle className="... text-[var(--color-warning)]" />
</div>

</p>
)}
{showGatewayAllowlistHint && (
<div className="mt-2 rounded-[var(--radius-md)] border border-[var(--color-warning,#d97706)] bg-[var(--color-warning-soft,var(--color-surface))] px-3 py-2">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same token-constraint issue here: #d97706 fallback is hardcoded in a UI value. Please switch to token-only color usage (and define missing token upstream if needed).

<div className="... border-[var(--color-warning)] bg-[var(--color-warning-soft)] ...">
  ...
</div>

@github-actions github-actions Bot removed the area:providers packages/providers (pi-ai adapter, model calls) label Apr 23, 2026
@Sun-sunshine06
Copy link
Copy Markdown
Collaborator Author

Addressed the bot feedback in the latest push:\n\n- Restored packages/providers/src/index.ts and packages/providers/src/index.test.ts to the safe main behavior so this PR no longer changes third-party openai-chat reasoning inference.\n- Replaced the warning UI hex fallbacks with token-only classes (--color-warning, --color-warning-soft).\n\nRe-validated with:\n- corepack pnpm --filter @open-codesign/desktop test -- AddCustomProviderModal ConnectionDiagnosticPanel\n- corepack pnpm --filter @open-codesign/providers test -- src/index.test.ts\n- git push pre-push checks ( ypecheck + �iome check)

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Major] Over-broad "official host" matching suppresses the new allowlist warning for many third-party gateways — amazonaws.com and azure.com are treated as universally official, so any relay hosted on those clouds will skip the hint even when app-allowlist rejection is the likely cause. Evidence apps/desktop/src/renderer/src/components/ConnectionDiagnosticPanel.tsx:25 and apps/desktop/src/renderer/src/components/ConnectionDiagnosticPanel.tsx:26.
    Suggested fix:
    // Replace broad cloud-domain suffixes with provider-specific endpoint patterns.
    const OFFICIAL_PROVIDER_HOST_PATTERNS = [
      /(^|\.)openai\.com$/i,
      /(^|\.)anthropic\.com$/i,
      /(^|\.)openrouter\.ai$/i,
      /(^|\.)deepseek\.com$/i,
      /(^|\.)mistral\.ai$/i,
      /(^|\.)groq\.com$/i,
      /(^|\.)cerebras\.ai$/i,
      /(^|\.)x\.ai$/i,
      /(^|\.)googleapis\.com$/i,
      /(^|\.)openai\.azure\.com$/i,
      /(^|\.)bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com$/i,
    ];

Summary

  • Review mode: follow-up after new commits
  • 1 issue found (Major).
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs in this runner.

Testing

  • Not run (automation).
  • Added tests cover helper behavior and modal visibility, but no case currently guards against false negatives for third-party gateways hosted on generic cloud domains.

open-codesign Bot

'groq.com',
'cerebras.ai',
'amazonaws.com',
'azure.com',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently includes broad cloud domains (, ). That suppresses this hint for many third-party relays hosted on AWS/Azure, creating false negatives for the exact allowlist problem this UI is trying to explain. Please narrow this to provider-specific official endpoint patterns instead of whole-cloud suffixes.\n\n

@Sun-sunshine06 Sun-sunshine06 merged commit 1b5f6be into main Apr 23, 2026
7 checks passed
@Sun-sunshine06 Sun-sunshine06 deleted the feat/coding-plan-compat-warning branch April 23, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 增加 Coding Plan 应用白名单兼容性提示

1 participant