orca icon indicating copy to clipboard operation
orca copied to clipboard

fix: resolve 4 Windows agent bugs — DeepSeek missing, Hermes/Claude icon swap, missing Kimi/Qwen status, MiniMax .com quota (#8302)

Open sudoeren opened this issue 4 months ago • 1 comments

Summary

Fixes #8302 — 4 Windows agent bugs in one PR, each as a separate commit.


Commit 1: Add DeepSeek as a built-in agent

The Windows agent list was missing DeepSeek. Added deepseek to TuiAgent, AgentKind, TUI_AGENT_CONFIG, agent catalog, and icon/status mappings.

Commit 2: Fix Hermes/Claude icon swap on Windows

HERMES_AGENT_NAME_RE, DROID_AGENT_NAME_RE, and AGY_AGENT_NAME_RE lacked the Windows executable suffix (.exe, .cmd, .bat, .ps1). Terminal titles like hermes.exe or ⠋ hermes.exe failed to match, falling through to Claude's braille-spinner heuristic — causing Hermes sessions to show the Claude icon. Fixed by rebuilding the three regexes with the same WINDOWS_EXECUTABLE_SUFFIX_RE used by buildAgentNameRe().

Commit 3: Add Kimi and Qwen to title-based agent status detection

Kimi and Qwen showed no execution status indicators because their agent names were not in AGENT_NAMES and had no explicit checks in getAgentLabel(). Added both to AGENT_NAMES, added label checks before the Claude fallback in both getAgentLabel() copies, and added them to the TITLE_LABEL_TO_AGENT / TITLE_AGENT_LABEL_TO_TYPE maps.

Commit 4: Retry MiniMax quota fetch with .com endpoint for China users

China (.com) MiniMax accounts use platform.minimax.com instead of platform.minimax.io. Added MINIMAX_USAGE_ENDPOINT_COM and a retry: if the .io endpoint fails with a non-auth server error, the fetcher retries with .com.

Testing

  • pnpm lint: 0 warnings, 0 errors
  • pnpm typecheck: passing

No visual change

No visual change for users not affected by the specific bugs. Existing behavior is preserved.

AI Review Report

Cross-platform compatibility

  • DeepSeek addition: cross-platform, no platform-specific code
  • Windows exe suffix regex: the (?:\.(?:exe|cmd|bat|ps1))? pattern is a no-op on macOS/Linux — it simply never matches
  • Kimi/Qwen title detection: cross-platform, uses same titleHasAgentName pattern as all other agents
  • MiniMax endpoint retry: cross-platform, Electron fetch API

SSH/remote/local compatibility

  • All changes are in agent detection (title parsing) and rate-limit fetching — both run locally where the Orca process executes. No SSH-specific paths affected.
  • Agent title detection runs on terminal titles from any host (local, WSL, SSH). Regex changes apply uniformly.

Agent and integration compatibility

  • DeepSeek: new agent, no existing integrations affected
  • Hermes/Droid/Antigravity: regex fix only applies to Windows .exe titles; macOS/Linux behavior unchanged
  • Kimi/Qwen: newly detected agents, no existing integrations affected
  • MiniMax: retry logic is additive; .io users see no change

Performance risk

  • Agent title regexes are tested on every terminal title update (bounded by user typing speed). The added (?:...)? wrapper adds negligible overhead.
  • MiniMax retry adds at most one extra HTTP request only when the primary endpoint fails — rare in practice

UI quality

  • No UI changes

Basic security risk

  • MiniMax secondary endpoint uses the same HTTPS protocol and cookie authentication as the primary. No new credential exposure.
  • No new user input or shell execution paths

Security Audit

  • No new dependencies introduced
  • No new IPC or network listeners
  • No new file system access or shell execution
  • MiniMax cookie handling unchanged — same cookie sent to both endpoints with same HTTPS protection
  • All changes are in shared library code or renderer logic; no elevation of privilege

sudoeren avatar Jul 12 '26 10:07 sudoeren

Review Change Stack

📝 Walkthrough

Walkthrough

MiniMax rate-limit fetching now uses a shared request helper and retries non-authentication failures against a secondary .com endpoint. Agent detection now recognizes Kimi and Qwen terminal titles, including selected Windows executable forms. DeepSeek was added to shared agent types, telemetry mappings, launch configuration, renderer catalog data, labels, and icon eligibility.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address #8302: DeepSeek is added, Windows title/icon/status detection is expanded, and MiniMax falls back to .com on non-auth failures.
Out of Scope Changes check ✅ Passed All touched files align with #8302; no unrelated features, dependencies, or broad refactors appear.
Title check ✅ Passed The title clearly summarizes the four Windows-focused fixes, including DeepSeek, title detection, and MiniMax fallback.
Description check ✅ Passed The description covers the required summary, testing, AI review, and security sections, with only minor template formatting gaps.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 12 '26 10:07 coderabbitai[bot]

Taking a look!

OrcaWin avatar Jul 20 '26 19:07 OrcaWin

👋 We took this over to get it green and mergeable. All work is on our rebased branch OrcaWin/pr-8384-rebase (fork OrcaWin/orca, HEAD fa114c4e0) for a superseding PR — original 4 commits preserved, fixes added on top. Summary per bug:

Bug 1 — DeepSeek built-in (was a CI blocker):

  • Added auto.lib.agent.catalog.deepseek_label to all 5 locale catalogs via sync:localization-catalog → verify:localization-catalog passes.
  • Also added deepseek to TUI_AGENT_DISPLAY_NAMES (a Record<TuiAgent, string> that landed on main after this PR was opened) — without it typecheck:node failed exhaustiveness. That's a second CI blocker the rebase surfaced.
  • ⚠️ Unverified, needs your confirmation before merge: there's no official DeepSeek Code CLI that we could find; community CLIs use bare deepseek (interactive TUI) or -p/-q, not deepseek -i \"<prompt>\", and docs.deepseek.com/cli / pip install deepseek-code didn't check out. The wiring is correct, but please confirm the real binary + interactive flag or the agent may not launch. We kept it in rather than drop your feature.

Bug 2 — Windows .exe suffix (hermes/droid/agy): Verified correct. Added regression tests covering both parallel getAgentLabel copies: .exe/.cmd/.bat titles resolve; android.exe and path fragments correctly don't.

Bug 3 — Kimi/Qwen title detection: Verified correct. Added regression tests (both copies) asserting Kimi/Qwen resolve before the Claude braille fallback and token-match to avoid false positives.

Bug 4 — MiniMax .com fallback (was a CI blocker + likely inert): Reworked. The original retry (a) fired on every non-auth failure — a second 15s fetch for all .io users on any transient/app error, which regressed 6 fetcher tests; and (b) excluded 401/403, the exact status a .com-account token gets on .io, so it never fired for its target users. It also couldn't have worked: cookies were pinned to the .io origin and never sent to .com. Fixes:

  • Scope the session cookie jar + Referer to the endpoint's origin so the .com retry actually carries credentials.
  • Retry .com only on HTTP/transport failures (stale-token/server/network — covers 401/403 and a GFW-blocked .io), never on payload-level errors where .io already answered; retry once; adopt .com only if it succeeds, else surface the original .io error.
  • Removed the misleading SECONDARY_ENDPOINT indirection + redundant re-normalize; tidied comments per AGENTS.md.
  • Added 6 tests (retry-succeeds, .com-scoped cookies/Referer, no-retry-on-payload-error, original-error-preserved, no self-retry).

CI evidence on the rebased branch: typecheck (node+web+cli) ✅, oxlint (changed dirs) ✅, verify:localization-catalog + coverage ✅, minimax-fetcher.test.ts 40/40 ✅, terminal-title-agent-type.test.ts 22/22 ✅. Note: service.test.ts has 7 failing tests on this branch, but they're in files untouched by these 4 commits and stem from the branch being rebased on an older main than current origin/main (current main advanced service.ts/service.test.ts). They'll clear on a fresh rebase onto current main.

Split recommendation — still yes, lightly. The bundle now passes its own CI, but bugs 2 & 3 are unconditionally solid, whereas bug 1 needs you to confirm the DeepSeek launch invocation and bug 4 ideally wants a sanity check against a real .com account. Splitting 2 & 3 out lets them land immediately without waiting on those two confirmations.

Thanks for the fixes — the core diagnoses (Windows .exe titles, missing Kimi/Qwen, .com origin) were all spot on. 🙏

OrcaWin avatar Jul 21 '26 18:07 OrcaWin