Skip to content

feat(cli): make the 250ms top-level tool-call queue delay configurable (HAPPY_TOOL_CALL_DELAY_MS) - #1753

Open
taiyiops wants to merge 1 commit into
slopus:mainfrom
taiyiops:feat/tool-call-delay-env
Open

feat(cli): make the 250ms top-level tool-call queue delay configurable (HAPPY_TOOL_CALL_DELAY_MS)#1753
taiyiops wants to merge 1 commit into
slopus:mainfrom
taiyiops:feat/tool-call-delay-env

Conversation

@taiyiops

@taiyiops taiyiops commented Sep 4, 2026

Copy link
Copy Markdown

Summary

In claudeRemoteLauncher.ts every top-level tool_use message is enqueued with a fixed delay: 250 so that a fast tool result can be released together with it (nice UX for sub-250ms tools). On slower setups (self-hosted server behind a jumpbox + phone client) that quarter second is added to every single tool call and is a noticeable part of the "why is it slow" feeling. This PR makes the delay configurable via HAPPY_TOOL_CALL_DELAY_MS:

  • unset / empty → 250 (exactly today's behavior)
  • 0 → tool_use is sent immediately (skips the delayed enqueue path entirely)
  • invalid / negative → falls back to 250

Nothing changes for anyone who doesn't set the variable.

Proof

Before: with the stock CLI, tool_use messages for top-level tools are always held up to 250ms (see the existing messageQueue.enqueue(logMessage, { delay: 250, toolCallIds }) branch).

After, on my machine (HAPPY_TOOL_CALL_DELAY_MS=0 exported before happy daemon start, happy-cli built from this branch, self-hosted server):

$ happy daemon status
✓ Daemon is running
  Version: 1.2.2
$ happy daemon list
[ { "startedBy": "happy directly - likely by user from terminal", ... } ]

Sessions spawned from the phone app run normally; tool calls show up in the app without the 250ms hold, and with the variable unset the queue behaves exactly as before (the delay: 250 path is taken). tsc --noEmit clean; existing unit tests pass (acpAgentConfig suite 8/8 as a smoke check of the package).

I'm happy to add a debug log line on the enqueue path if you'd like a more explicit trace in the PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QBfUsLSj8DBVvVmHSqCDqZ

Top-level tool_use messages are held for 250ms so a fast tool result can be
released together with them. On slow relays (self-hosted server + phone) that
fixed delay is pure latency on every tool call. This reads
HAPPY_TOOL_CALL_DELAY_MS (default 250, unchanged behavior; 0 = send immediately;
invalid values fall back to 250). No change for users who don't set it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QBfUsLSj8DBVvVmHSqCDqZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants