Conversation
There was a problem hiding this comment.
Pull request overview
Fixes MiniMax CN (minimax-cn) authentication failures and Pi connection test timeouts by correcting provider routing/aliasing and introducing a faster direct HTTP connection test for Anthropic-compatible Pi providers.
Changes:
- Remove incorrect
minimax-cn → minimaxaliasing and addminimax-cndisplay name support. - Hide MiniMax presets in Anthropic API Key mode where Pi SDK-based authentication is required.
- Add a lightweight Anthropic-compatible
/v1/messagesHTTP connection test path for Pi providers, falling back to the existing subprocess-based test when not applicable.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/agent/backend/internal/drivers/pi.ts | Adds direct HTTP connection test for anthropic-messages Pi providers to avoid subprocess startup timeouts. |
| packages/shared/src/agent/backend/internal/driver-types.ts | Updates testConnection driver contract to allow “decline to handle” via null. |
| packages/shared/src/agent/backend/factory.ts | Handles null driver results by falling through to the generic subprocess connection test. |
| packages/server-core/src/domain/connection-setup-logic.ts | Adds display name mapping for minimax-cn. |
| apps/electron/src/renderer/components/apisetup/submit-helpers.ts | Fixes Pi auth provider aliasing so minimax-cn passes through as its own provider key. |
| apps/electron/src/renderer/components/apisetup/ApiKeyInput.tsx | Filters out MiniMax presets in Anthropic API Key mode; keeps them for Pi API Key flow. |
Comments suppressed due to low confidence (1)
apps/electron/src/renderer/components/apisetup/submit-helpers.ts:27
resolvePiAuthProviderForSubmitbehavior changed for MiniMax variants (onlyminimax-globalis now aliased;minimax-cnshould pass through). There are existing bun tests for this helper (ApiKeyInput.test.ts), but they don’t cover these MiniMax cases—please add assertions forminimax-global → minimaxandminimax-cn → minimax-cnto prevent regressions.
export function resolvePiAuthProviderForSubmit(
activePreset: PresetKey,
lastNonCustomPreset: PresetKey | null
): string | undefined {
if (activePreset === 'custom') {
// Pi SDK needs a provider hint for auth header formatting even when
// the URL is user-provided — default to anthropic as the safest baseline.
const resolved = lastNonCustomPreset && lastNonCustomPreset !== 'custom'
? lastNonCustomPreset
: 'anthropic'
return PI_AUTH_PROVIDER_ALIASES[resolved] ?? resolved
}
return PI_AUTH_PROVIDER_ALIASES[activePreset] ?? activePreset
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
args.model may arrive as 'pi/<id>' but Pi SDK model registry uses bare IDs. Without stripping the prefix, find() always misses and falls back to models[0], potentially using the wrong model's API type and baseUrl. Addresses Copilot review comment on PR craft-ai-agents#396. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three issues fixed: 1. PI_AUTH_PROVIDER_ALIASES incorrectly mapped 'minimax-cn' → 'minimax', causing Pi SDK to use the Global endpoint (api.minimax.io) for CN keys, resulting in 401 authentication errors. Removed the alias so 'minimax-cn' maps 1:1 to the Pi SDK provider. 2. MiniMax presets (minimax-global/cn) were visible in Anthropic API Key mode where they can't work (wrong auth flow). Added PI_ONLY_PRESET_KEYS filter to hide them; they remain available in Pi API Key mode. 3. Pi test connection spawned a full subprocess + SDK initialization that exceeded the 20s timeout. Added a lightweight direct HTTP test path for providers using the anthropic-messages API (like MiniMax), bypassing the heavy subprocess startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
args.model may arrive as 'pi/<id>' but Pi SDK model registry uses bare IDs. Without stripping the prefix, find() always misses and falls back to models[0], potentially using the wrong model's API type and baseUrl. Addresses Copilot review comment on PR craft-ai-agents#396. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Was my bad, sorey fixing it on main. |
MiniMax CN API (api.minimaxi.com) rejects model names with the 'MiniMax-' prefix (e.g. MiniMax-M2.5-highspeed → 500) but accepts bare names (M2.5-highspeed → 200). Strip the prefix in the Pi driver testConnection path when piAuthProvider is 'minimax-cn'. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…path MiniMax CN API rejects prefixed model IDs (e.g. MiniMax-M2.5-highspeed → 500). Strip the prefix in resolvePiModel() when piAuthProvider is 'minimax-cn' so the Pi SDK sends bare model names to the CN endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
029b157 to
6d45464
Compare
|
Hi @rjulius23, I've rebased onto v0.7.4, all fixes apply cleanly. Heads up on a new issue I found: MiniMax CN API (api.minimaxi.com) rejects model IDs with the I added a 3-line fix in two places (guarded by piAuthProvider === 'minimax-cn', zero impact on
Happy to close if you'd rather fix on main — just flagging since it needs a CN API key to |
|
Yes sorry was an oversight from my side fixing the minimax-cn in todays release and introduce webhooks as well. |
|
Thanks for the heads up! Closing this PR then. Looking forward to the webhooks 🎉 |
# v0.7.5 — Network Proxy, Webhooks & Community Fixes --- ## Features - **Network proxy support** — configure HTTP/HTTPS proxies with bypass rules directly from App Settings. The proxy engine routes traffic through `undici` ProxyAgent instances, respects `NO_PROXY` rules, and configures both Node and Electron browser sessions. (46049d2, 0ed01c4, 81d1b1c, 0da3f26) - **Webhook actions for automations** — automations can now fire HTTP webhooks with configurable auth, form payloads, response capture, replay, and persistent retry with exponential backoff. (993c75c, 588aab6) - **Gemini 3.1 Flash Lite** — added to Google AI Studio preferred defaults. Thanks to [@naishyadav](https://github.com/naishyadav) for the suggestion in [#357](#357). (e36e9a2) - **Dismiss working directory history items** — hover-visible X button on each recent directory entry to remove it from history. Thanks to [@jjjrmy](https://github.com/jjjrmy) ([#346](#346)) and [@jonzhan](https://github.com/jonzhan) ([#391](#391)) for requesting this. (3bd55d6) ## Improvements - **History truncation** — consolidated all history field truncation to a single `HISTORY_FIELD_MAX_LENGTH` constant instead of scattered hardcoded limits (8689a1d) - **Craft source docs** — added Collections section to guide with emphasis on the nested title + properties item format (0837afa) ## Bug Fixes - **MiniMax CN authentication** — removed incorrect `minimax-cn → minimax` alias, added lightweight direct HTTP test for Pi providers, and stripped MiniMax-prefix for CN API compatibility. Thanks to [@Kathie-yu](https://github.com/Kathie-yu) ([#396](#396)) and [@RimuruW](https://github.com/RimuruW) ([#386](#386)) for reporting. Fixes [#396](#396). (612c0e7) - **Inline code in messages** — text between inline badges (sources, skills, files) now renders through the Markdown component, restoring inline code, bold, italic, and links. Thanks to [@linusrogge](https://github.com/linusrogge) for reporting [#378](#378). Fixes [#378](#378). (e7f88a3) - **Zod/JSON Schema passthrough** — default Zod object schemas to `.passthrough()` to match JSON Schema semantics where `additionalProperties` defaults to `true`. Also preserved `additionalProperties` in MCP proxy tool schema round-trip. Fixes tools with loosely-typed schemas silently losing fields. (cf4b6ac, 42c173c) - **Self-signed TLS certificates** — accept self-signed certificates for the configured remote server origin, fixing `ERR_CERT_AUTHORITY_INVALID` on `wss://` connections (7148ebe) - **File attachment in thin client mode** — paperclip button now uses browser-native `FileReader` API instead of server-side `fs.readFile()`, fixing silent failures when client and server filesystems differ (680cd19) - **URL linkification** — strip trailing markdown characters (`**`, etc.) from linkified URLs that were producing broken links (24385e7, 65b8f35) - **Automation action badges** — sidebar now shows correct "Prompt" / "Webhook" badges based on actual action types instead of hardcoding "Prompt" (dc42257) - **Packaged server path fallback** — added `dist/resources` fallback for builds where `extraResources` output layout differs (edc5f61) - **`$CRAFT_EVENT_DATA` missing labels** — all automation event payloads now include the session's current `labels` array, so webhooks and scripts can access label data. Fixes [#406](#406). (0f98f09) - **Multi-select non-adjacent sessions** — Cmd-click now always toggles selection (standard OS behavior); opening in a new panel moves to Cmd-Shift-click. Fixes [#404](#404). (d4d7aff) - **@ mention autocomplete with spaces** — spaces are now allowed in file mention queries (e.g. `@app availability.md`). The menu auto-closes Slack-style when a space produces no matches. Thanks to [@alexzadeh](https://github.com/alexzadeh) for reporting [#398](#398). Fixes [#398](#398). (1d06317) ---
Summary
Fix MiniMax CN (
minimax-cn) authentication failure and connection test timeout in Pi API Key mode. This serves as a follow-up fix to the MiniMax split introduced in v0.7.3 (Issue #386), addressing underlying SDK routing and timeout issues.Changes
minimax-cn → minimaxmapping inPI_AUTH_PROVIDER_ALIASES— Pi SDK treats them as separate providers with distinct endpoints (api.minimax.io vs api.minimaxi.com).PI_ONLY_PRESET_KEYSfilter so MiniMax presets only appear in Pi API Key mode where they can actually authenticate.minimax-cnentry toPI_AUTH_PROVIDER_DISPLAY_NAMES.Testing
tsc --noEmit✅