Skip to content

feat: Make Claude CLI timeout configurable, increase default, and bump version to 1.11.0#26

Open
steipete wants to merge 7 commits intomainfrom
chore/update-tool-description-1.10.13
Open

feat: Make Claude CLI timeout configurable, increase default, and bump version to 1.11.0#26
steipete wants to merge 7 commits intomainfrom
chore/update-tool-description-1.10.13

Conversation

@steipete
Copy link
Copy Markdown
Owner

@steipete steipete commented May 20, 2025

This PR introduces a configurable timeout for the Claude CLI via the CLAUDE_CLI_TIMEOUT_SECONDS environment variable, defaulting to 3600 seconds (60 minutes). It also updates the README and CHANGELOG accordingly. Version bumped to 1.11.0.


Note

Highlights

  • Configurable Claude CLI timeout via CLAUDE_CLI_TIMEOUT_SECONDS (default 3600s); default increased from 30m to 60m
  • Tool description now dynamically includes Claude CLI and MCP server versions; formatting/escaping improvements
  • Removed first-use version print; server.run now logs startup normally

Code refactor

  • Extracted constants.ts, utils.ts (with findClaudeCli, spawnAsync, debugLog), and types.ts; server.ts now injects utils and improves error handling/timeouts
  • Improved error messages (ENOENT, timeouts, stderr/stdout propagation)

Tests/build

  • Overhauled unit tests with local/global SDK Server mocks, added setupTests.ts, updated vitest.config.unit.ts; removed legacy version-print test
  • Updated scripts (vitest run), added which and types, bumped version to 1.11.0

Docs

  • README/CHANGELOG updated to document timeout env var and dynamic version display
  • LICENSE year updated

Written by Cursor Bugbot for commit 5ded913. This will update automatically on new commits. Configure here.

@steipete steipete changed the title Chore: Update Claude tool description and bump version to 1.10.13 feat: Make Claude CLI timeout configurable and increase default to 60min May 24, 2025
@steipete steipete changed the title feat: Make Claude CLI timeout configurable and increase default to 60min feat: Make Claude CLI timeout configurable, increase default, and bump version to 1.11.0 May 24, 2025
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pseudotensor
Copy link
Copy Markdown

Looks like a good change, any reason why not merged?

@steipete
Copy link
Copy Markdown
Owner Author

Mostly because I'm not using this anymore - buuuut I'll add that to my list and craft a new release soon, thanks for the ping!

@pseudotensor
Copy link
Copy Markdown

I see, is there an alternative to this repo in terms of built-in aspects of claude code? I couldn't find any other way to avoid the permissions issues while allowing (say) claude code or some other MCP client to use claude code itself as MCP server.

@steipete
Copy link
Copy Markdown
Owner Author

run claude with --dangerously-skip-permissions?

@pseudotensor
Copy link
Copy Markdown

For background, the existing sub agents or tasks cannot themselves run tasks. Yet I and others want this feature. maybe it's coming, but one never knows.

To solve this, I tried running

claude mcp add claude_code_unrestricted_server -- claude mcp serve

(claude mcp serve has no permissions options) including with settings.json changes for allowing everything.

The idea is then separate claude talking to this MCP can run full claude that also allows tasks inside.

This works, but fails due to permissions when that every is encountered, regardless of how one runs claude with --dangerously-skip-permissions or allowing all tools in settings.json or whatever.

Only your package was able to be used in this way.

I'm not even clear how people using cursor use the normal claude mcp server since it would be asking for permissions constantly.

MIT License

Copyright (c) 2025 Peter Steinberger
\g<1>2026 Peter Steinberger
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LICENSE file corrupted by malformed regex replacement

The copyright line in the LICENSE file contains \g<1>2026 Peter Steinberger instead of Copyright (c) 2026 Peter Steinberger. This appears to be a regex replacement pattern (Python-style backreference syntax) that was accidentally left in the file during a find-and-replace operation. This corrupts the legal copyright notice, which could have implications for the project's licensing.

Fix in Cursor Fix in Web

1. Be concise, explicit & step-by-step for complex tasks. No need for niceties, this is a tool to get things done.
2. For multi-line text, write it to a temporary file in the project root, use that file, then delete it.
3. If you get a timeout, split the task into smaller steps.
4. **Seeking a second opinion/analysis**: If you\\'re stuck or want advice, you can ask \\\`claude_code\\\` to analyze a problem and suggest solutions. Clearly state in your prompt that you are looking for analysis only and no actual file modifications should be made.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escaped apostrophe causes visible backslash in tool description

In the tool description template, \\'re will produce \'re in the output string (with a visible backslash before the apostrophe). In JavaScript template literals, single quotes don't need escaping, so \\' produces a literal backslash followed by an apostrophe. The text "If you're stuck" will be displayed to users instead of the intended "If you're stuck". The apostrophe should simply be ' without any escaping.

Fix in Cursor Fix in Web

err.stderr = stderr.trim();
err.exitCode = code;
reject(err);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout detection fails due to missing signal/code properties

When Node.js spawn times out, the process is killed and the close event fires with code: null. The error object created in spawnAsync sets exitCode, stdout, and stderr but does not set signal or code properties. However, the timeout detection in the CallToolRequest handler checks for error.signal === 'SIGTERM' or error.code === 'ETIMEDOUT'. Since these properties are never set by spawnAsync, timeout errors are not properly detected, causing users to receive a generic "Claude CLI execution failed" message instead of the timeout-specific message. The tests pass because they mock spawnAsync to reject with the expected properties.

Additional Locations (1)

Fix in Cursor Fix in Web

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