程序员阿江-Relakkes fd42b0ca05 fix(agent-teams): keep long-running teams recoverable (#1426)
Long Agent Teams runs lost members for good: a truncated provider stream
ended a member's turn with nobody to wake it, the desktop Stop button and
every lead restart killed all members and marked the plan interrupted,
mail sent to a stopped member landed in an inbox nothing read, and a lead
kept inside one long turn never saw member reports. Aligned with the
official CLI 2.1.284 and verified with DeepSeek Flash through a
fault-injecting proxy.

Stream recovery
- Re-send a stream that breaks before any tool ran (proxy truncation,
  transport errors), with the existing retry budget and backoff; the
  desktop drops the discarded attempt's tool cards and todo update.

Desktop team runtime (teamPlanRuntime)
- The server supervises members: a stopped member restarts from its own
  transcript when messaged; transient failures continue automatically
  (15s/45s/2m/5m/10m) and only exhausted retries reach the lead; ready
  dependent tasks wake their owner; a crash-loop guard ignores user stops.
- Stop pauses the team instead of ending it; the lead's next user message
  is followed by a notice listing the stopped members and their open
  tasks. Lead restarts (model/permission switch, crash) keep members;
  server restarts re-own the team. Teams end on /clear or session delete.
- Approving a plan no longer races a concurrent plan read into
  "Launch ownership was lost".

Mailbox and messaging
- Atomic inbox writes, identity-based read marking, read history files,
  idle notifications with result/failureReason, and write failures
  reported instead of "Message sent". External builds keep the official
  between-turn delivery to the lead.
- SendMessage resumes non-running in-process teammates from their
  transcript, notes restarting desktop members, queues mail for members
  of a plan awaiting approval, and rejects unknown names.

CLI in-process teammates
- Compaction uses the teammate's own controller and real history and no
  longer kills it on error; failed turns are classified and continued;
  the turn-end mailbox drains as one batch; one durable transcript per
  teammate.

Lead behaviour
- An unmet /goal ends the lead turn while members work, so member reports
  arrive; WaitSessions on own team members returns immediately.

Desktop UI
- Member states for stopped, auto-retrying and failed, with reason,
  countdown and recovery hint in all five locales.

Tests and tooling
- Regression tests for every behaviour above; module mocks in four test
  files are restored after use so the single-process coverage run is not
  polluted; the desktop smoke asserts the new Stop semantics.
2026-10-03 17:07:30 +08:00
2026-10-02 02:45:29 +08:00
2026-04-01 10:30:17 +08:00
2026-07-29 09:23:05 +08:00

cc-haha

cc-haha — Open-source desktop for Claude Code

GitHub Stars GitHub Forks GitHub Issues GitHub Pull Requests License English 中文 Docs

简体中文 · English

cc-haha is a desktop Claude Code workspace for macOS, Windows, and Linux: multi-session workspaces, global search, branch / Worktree launch, diff review, built-in browser preview, GUI permission approval, any model — Claude, ChatGPT, Grok, presets, or local endpoints — image generation, visual MCP & SubAgent managers, an Agent Teams workbench, dynamic Workflow orchestration, model trace, Computer Use, skill marketplace, colour themes, desktop pets, H5 remote access, IM integration, and scheduled tasks, all in one app. On macOS, Computer Use can operate other apps without taking over your physical mouse or keyboard.

Desktop Preview · Install · Highlights · More Docs · Sponsorship · User Group


Desktop Preview

Download Desktop

The top row covers getting started and daily work: sessions, permissions, changes, and Computer Use. The second shows extensions: models, skills, scheduled tasks, and IM. These screenshots show the real project in the Chinese interface. Click a thumbnail to see the full screen.

New session with project, permission, and model choices
01 · Start a session
Pick a project and permissions
Choose one of five permission modes in a real project session
02 · Set permissions
Control what each task can do
Review a code diff file by file in the workspace
03 · Review changes
Inspect each file's diff
macOS Computer Use settings with enabled status and Accessibility and Screen Recording permissions
04 · Computer Use
Keep your Mac mouse and keyboard free
Add a model provider using a preset and endpoint URL
05 · Connect models
Use presets or local endpoints
Browse skills and inspect their sources
06 · Add skills
Install what a task needs
Create a scheduled task in its own session
07 · Schedule tasks
Automate recurring work
Configure Slack in the IM access settings
08 · Work remotely
Continue through IM

Start here: install the app → connect a model → run your first session → explore settings → try real workflows. For hands-free cross-app work on macOS, follow the Computer Use guide.


Sponsorship & Partnership

This project is maintained in the author's spare time. Corporate or individual sponsorships are welcome to support ongoing development. Custom features, integrations, and business partnerships are also open for discussion.

Sponsor Description
AruHub Thanks to AruHub for sponsoring this project! AruHub focuses on providing developers with a stable, long-term primary API upstream service. Built for high-frequency AI coding workflows such as Codex and Claude Code, it offers official GPT API access through enterprise groups and stable Claude enterprise groups for sustained use, with support for leading models including GPT and Claude. Image 2 / 2.5 is available around the clock, starting at CNY 0.04 per image. Pay-as-you-go billing supports high-volume enterprise usage, invoicing, and refunds. Register through the exclusive link to receive US$1 in credit usable across all models, with no model restrictions.
Atlas Cloud Atlas Cloud Thanks to Atlas Cloud for sponsoring this project. Atlas Cloud is a full-modal AI inference platform that gives developers a single AI API to access video generation, image generation, and LLM APIs. Instead of managing multiple vendor integrations, you connect once and get unified access to 300+ curated models across all modalities. Atlas Cloud is already built into the cc-haha provider list, so you can pick it in settings and start using it with just an API key. Check out Atlas Cloud's new coding plan promotion for more budget-friendly API access.
ApiSmart Thanks to ApiSmart for sponsoring this project. ApiSmart provides unified access to leading AI models through a single API. Use one API key to connect with LLM, image, and video models through an OpenAI-compatible interface. Easily switch between models, simplify billing, and improve reliability with intelligent routing and automatic failover.

📧 Contact: relakkes@gmail.com


Install the Desktop App

  1. Download the macOS / Windows / Linux desktop installer from Releases.
  2. On first launch, configure your model provider, API key, and default model in Settings.
  3. Public macOS releases require signing and notarization. Draft or unsigned temporary builds may still need one-time manual approval. Unsigned Windows installers may show SmartScreen; click "More info" -> "Run anyway". See the desktop installation guide.

Release trust and privacy: Code signing policy · Privacy and network access

Run the CLI from Source

For users who want to debug the underlying CLI, server, or local development flow:

bun install
cp .env.example .env
./bin/claude-haha

See environment variables and CLI setup for more configuration options.


User Group

Scan the QR code below to join the cc-haha user group on WeCom (WeChat Work) — the conversation there is mostly in Chinese. For questions and bug reports in English, Issues is the better place. For enterprise deployment, customization, or Agent development needs, contact the author NanmiCoder.

cc-haha WeCom user group QR code


☕ Buy Me a Coffee

If this project helps you, consider buying me a coffee — every bit of support keeps this project going ❤️

WeChat Pay
WeChat Pay
Alipay
Alipay
Buy Me a Coffee
Buy Me a Coffee

Desktop Highlights

  • Multi-session workspace: tabs, project switching, terminal entry, and session history in one place, with a resizable sidebar.
  • Global search: press Cmd+K to search across every session and jump to the match.
  • Branch / Worktree launch: choose a repository branch and decide whether to use the current working tree or an isolated Worktree.
  • Review edits file by file: the workspace lists this turn's changes; open any file for a syntax-highlighted diff, or undo the whole turn.
  • Built-in browser preview: the page your agent just edited renders right inside the app, cookies and login state included.
  • Five permission modes: from "ask every time" to "skip permissions" — risky commands, tool calls, and follow-up questions are all approved in the GUI.
  • Bring your own model: sign in to Claude, ChatGPT, or Grok; use presets for DeepSeek, Kimi, Zhipu GLM and others; or point it at LM Studio and Ollama running locally.
  • Image generation: generate and edit images right in the chat — sign in with ChatGPT or Grok for instant use, or plug in any OpenAI-compatible Images API.
  • Visual MCP manager: add and edit MCP servers in a GUI — STDIO / Streamable HTTP / SSE, with project, shared, or global scope.
  • Six colour themes: white, paper, warm classic, celadon, ink night, and ink blue — optionally following your system's light/dark setting.
  • Skill marketplace: discover, preview, and install third-party skills from ClawHub / SkillHub, with source and safety status shown up front.
  • Session activity panel: track task progress, background tasks, SubAgents, and sources in one side panel.
  • Visual SubAgent manager: create and tune SubAgents in a GUI — model, tools, and permission mode.
  • Agent Teams workbench: visualize multi-agent collaboration in the GUI — members, tasks, a communication feed, and a dependency-lane canvas.
  • Dynamic Workflow orchestration: the model writes and runs orchestration scripts on the fly, driving subagents concurrently or in pipelines, with phase views, interrupts, and resume.
  • Model trace: every model request is logged locally with status and timing — search and filter to diagnose stuck or failed calls.
  • Computer Use: let the agent take screenshots, click, type, and control desktop apps after authorization; the native macOS runtime does not take over your physical mouse or keyboard.
  • Desktop pets: Dada, Huhu, Bubu, and Huihui change what they do with the task at hand — or raise one of your own (off by default).
  • H5 remote access: scan a QR code to continue the session in your phone browser; locking the screen won't kill a running task.
  • IM integration: chat, switch projects, and approve actions through Telegram / Feishu / WeChat / DingTalk / WhatsApp / WeCom / QQ / Slack.
  • Scheduled tasks and usage stats: run planned tasks in their own sessions and track local token usage trends.

More Documentation

Full documentation site: https://cchaha.ai

Section Documents
Getting started What this is · Download and install · Connect a model provider · Your first session · Troubleshooting
Desktop features Feature overview · Computer Use · Desktop pets · Phone H5 and IM relay
IM integrations Overview and pairing · Feishu · Telegram · WeChat · DingTalk · WhatsApp · WeCom · QQ · Slack
CLI Install and run · Command reference · Environment variables
Internals Desktop architecture · Multi-agent system · Skills system · Memory system · Computer Use architecture · Local server and API · Channel system · Project structure · Contributing and quality gates

Tech Stack

Category Technology
Language TypeScript
Desktop app Electron
Desktop UI React + Vite
Local runtime Bun
Terminal UI React + Ink
CLI parsing Commander.js
API Anthropic SDK
Protocols MCP, LSP

Acknowledgements

Thanks to the following open-source projects and community practices for reference and inspiration:

  • React: frontend engineering and component-based UI ecosystem.
  • Electron: cross-platform desktop app capabilities and engineering practices.
  • cc-switch: reference for model provider configuration.
  • LINUX DO: a new ideal developer community.

⭐ Star History

If this project helps you, please support it with a ⭐ Star so more people can discover cc-haha.

Star History Chart
S
Description
No description provided
Readme MIT 596 MiB
Languages
TypeScript 96.3%
Swift 2.3%
CSS 0.3%
Python 0.3%
JavaScript 0.2%
Other 0.5%