Opening a long-finished session showed it "start talking again": dozens
of `已思考` bubbles streaming in, nothing rendered between them. Nothing
was actually re-run — the transcript stops at the moment the turn ended
and the trace holds only the original 13 API calls. The whole wall is a
replay of output that had already been rendered hours earlier.
The source is not in this server at all. `WebSocketTransport` (inherited
upstream, used for the CLI's `--sdk-url` connection) buffers every
outbound message that carries a uuid, and on every successful reconnect
replays that buffer from the start — `onBunOpen` passes an empty
`lastId`, which skips the branch that would evict already-confirmed
messages, and `replayBufferedMessages` deliberately does not clear the
buffer afterwards. It is safe to do that only because the code assumes
"The server deduplicates by UUID". We never implemented that contract:
`X-Last-Request-Id` appears nowhere outside the transport itself, and
the one uuid check in `handler.ts` only guards task-notification
persistence and forwards regardless. So each reconnect pushed the whole
window through untouched.
The transport also detects system sleep explicitly and keeps resetting
its reconnect budget, so a closed laptop guarantees the reconnect rather
than preventing it. The diagnostics for the reported session (pid 58975)
recorded 31 sleep detections and 31 replays of 858 messages each, spread
over the ten hours between the turn ending and the session being opened
— 13 thinking blocks re-delivered 31 times. Across this machine the same
event has fired 10811 times; it has been happening all along.
Only thinking showed it. Replayed user messages are idempotent, replayed
tool calls are upserted by `toolUseId`, replayed tool results are folded
into the tool card and stay invisible, and replayed reply text is caught
by the wake/reconnect guard added in 2a937c6cc. Thinking had nothing:
its UIMessage carries no `transcriptMessageId`, and one cannot be added
— the wire event is `{type, text}` and the hydrated id comes from a
transcript uuid minted at write time, so the two sides share no id.
Every earlier fix keyed on that field, which is why five of them missed
this. `handleSdkPayload` now skips uuids it has already processed, which
covers replayed partial-message stream events too — that is what the
wall was actually made of — and does so without touching the WS protocol
or the transcript shape.
The renderer keeps a second line of defence for whole-block replays that
might arrive by some other route: a thinking chunk equal to an existing
block is dropped, blank chunks no longer open an empty bubble, and
`appendAssistantTextMessage` also rejects text identical to a hydrated
reply. Equality, not substring — a streamed delta is a fragment and is
almost always a substring of some earlier reply, so a substring test
would swallow normal output. `tool_use_complete` now flushes pending
text the way the streaming path's `content_start` already does, so the
two paths stop disagreeing about where a reply ends.
The CLI's empty `lastId` is left alone; fixing it needs the server to
answer with `x-last-request-id`. Note that only the Bun branch replays —
the Node branch calls `replayBufferedMessages` inside a check for an
upgrade header that the `ws` package removed in v3, so it never fires.
Any regression test written under Node would pass without exercising it.
Tested: bun run check:server (232 files, 2492 tests)
Tested: bun run check:desktop (275 files, 3383 tests)
Tested: bun run check:chat-contract (183 tests)
Not-tested: real sleep/wake cycle against a packaged desktop build.
Claude Code Haha
English · 简体中文
Claude Code Haha is a desktop Claude Code workspace for macOS, Windows, and Linux: sessions, projects, branch / Worktree launch, workspace changes and diff review, permission approval, model setup, Computer Use, H5 remote access, IM integration, and scheduled tasks in one app.
Desktop Preview · Install · Highlights · More Docs · Sponsorship · User Group
Desktop Preview
The Claude Code Haha desktop app brings sessions, multi-project navigation, branch / Worktree controls, file changes, diff review, permission approval, model setup, and remote access into one graphical workspace for daily development beyond the terminal.
v0.5.0 shipped a full UI redesign — six colour themes that can follow your system's light/dark setting. All six shots below are from a real v0.5.0 build.
Install the Desktop App
- Download the macOS / Windows / Linux desktop installer from Releases.
- On first launch, configure your model provider, API key, and default model in Settings.
- 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.
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.
Desktop Highlights
- Multi-session workspace: tabs, project switching, terminal entry, and session history in one place, with a resizable sidebar.
- 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.
- 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.
- 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.
- Computer Use: let the agent take screenshots, click, type, and control desktop apps after authorization.
- 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.
- 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 |
| 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 |
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 |
|---|---|
|
|
Thanks to ShengSuanYun for sponsoring this project. ShengSuanYun is an industrial-grade AI task parallel execution platform for AI Native Teams, aggregating Claude, ChatGPT, Gemini, and other LLM, image, and video model capacity through direct, non-reverse-engineered access. Its platform SLA reaches 99.7%, with service status available online. It also supports dedicated enterprise gateways, cost and permission controls, smart routing, security protection, BYOK, usage-based billing, upcoming tokens plans, and invoicing. New users registering through this link can receive 10 yuan in model credits plus a 10% first top-up bonus. |
|
|
Thanks to TeamoRouter for sponsoring this project. TeamoRouter is an enterprise-grade Agentic LLM gateway for developers, AI teams, and businesses. Without any subscription, it lets you use Claude Code, Codex, Gemini CLI, and other popular AI agents through a single unified API, with API pricing at discounts of up to 90%. It aggregates hundreds of official model providers and trusted infrastructure partners — including OpenAI, Anthropic, Vertex, Azure, and AWS Bedrock — each verified for 100% Agent protocol compatibility, cache performance, and request traceability, delivering near-official TTFT, a 99.6% SLA, throughput up to 5,000 QPM, and industry-leading cache hit rates rather than reverse-engineered endpoints. It also offers centralized billing, team management, BYOK, smart routing, usage analytics, and dedicated support, and Teamo Desktop lets you use these AI agents with one-click setup. New users who register through this link receive 10% off their first top-up. |
📧 Contact: relakkes@gmail.com
User Group
Scan the QR code below to join the cc-haha user group on Feishu (Lark) — the conversation there is mostly in Chinese. For questions and bug reports in English, Issues is the better place.
☕ Buy Me a Coffee
If this project helps you, consider buying me a coffee — every bit of support keeps this project going ❤️
![]() WeChat Pay |
![]() Alipay |
Buy Me a Coffee |
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 |
Thanks
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.
⭐ Star History
If this project helps you, please support it with a ⭐ Star so more people can discover Claude Code Haha.









