Skip to content

Codex/increase claude timeout - #1632

Merged
qdaxb merged 4 commits into
wecode-ai:mainfrom
FicoHu:codex/increase-claude-timeout
Jun 30, 2026
Merged

qdaxb merged 4 commits into
wecode-ai:mainfrom
FicoHu:codex/increase-claude-timeout

Conversation

@FicoHu

@FicoHu FicoHu commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Local Claude Code executions now support a configurable child-process timeout (default: 1 hour) via WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS.
  • Bug Fixes
    • Timeout handling is now applied consistently across streaming, retries, and deferred MCP flows during Claude Code runs.
    • Claude Code timeout settings no longer impact unrelated runtime paths; native Codex app-server timeout remains controlled separately.
  • Documentation
    • Added English and Chinese user-guide instructions, including an example to override the timeout.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d63f93ce-6a61-48b9-9d9e-4a52be44943b

📥 Commits

Reviewing files that changed from the base of the PR and between ccaf78f and 9bd00ef.

📒 Files selected for processing (6)
  • executor/src/agents/mod.rs
  • executor/src/process/mod.rs
  • executor/tests/claude_cancellation_contract.rs
  • executor/tests/local_backend_device_migration_contract.rs
  • executor/tests/process_engine_contract.rs
  • executor/tests/stream_process_engine_contract.rs
✅ Files skipped from review due to trivial changes (1)
  • executor/tests/stream_process_engine_contract.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • executor/tests/process_engine_contract.rs
  • executor/src/agents/mod.rs

📝 Walkthrough

Walkthrough

Process execution now uses per-engine timeouts, with a Claude Code-specific override and updated tests. Two frontend tests also switch from userEvent to fireEvent for form and toggle interactions.

Changes

Configurable process timeout and Claude-specific override

Layer / File(s) Summary
Process timeout is stored on engines and threaded through execution
executor/src/process/mod.rs
DEFAULT_PROCESS_TIMEOUT_SECONDS is 3600; ProcessEngine and StreamProcessEngine store timeout_seconds, constructors require a positive timeout, and run/retry/deferred MCP/streaming paths use the passed timeout while removing the global timeout helper.
Claude Code timeout override and agent wiring
executor/src/agents/mod.rs
Adds a Claude Code timeout default, parses WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS, builds StreamProcessEngine with the Claude-specific timeout for AgentKind::ClaudeCode, and adds unit tests for the environment-variable behavior.
Timeout contract tests and user guides
executor/tests/agent_process_engine_contract.rs, executor/tests/app_runtime_work_send_contract.rs, executor/tests/claude_cancellation_contract.rs, executor/tests/local_backend_device_migration_contract.rs, executor/tests/process_engine_contract.rs, executor/tests/stream_process_engine_contract.rs, docs/en/user-guide/ai-devices/local-device-support.md, docs/zh/user-guide/ai-devices/local-device-support.md
Executor contract tests now pass explicit timeouts into engine constructors or the Claude-specific env var, runtime-send tests wait for response.completed events, and English and Chinese user guides document the Claude Code execution timeout section and override.

Frontend test interaction fixes

Layer / File(s) Summary
Use fireEvent in MCP and diff-panel tests
wework/src/App.plugins.test.tsx, wework/src/components/chat/FileChangesReviewPanel.test.tsx
Both files import fireEvent and replace userEvent.type and userEvent.click with fireEvent.change and fireEvent.click in the affected tests.

Sequence Diagram(s)

sequenceDiagram
  participant AgentProcessEngine
  participant StreamProcessEngine
  participant ProcessEngine
  participant ProcessExecution
  AgentProcessEngine->>StreamProcessEngine: create with timeout_seconds
  StreamProcessEngine->>ProcessEngine: store timeout_seconds
  ProcessEngine->>ProcessExecution: run_command / run_command_output / run_streaming_command_output with timeout_seconds
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • qdaxb

Poem

🐇 Tick-tock, the timeout now has a seat,
Claude gets a key and engines keep the beat.
One hour by default, or tweak the shell,
Tests hop along, and docs explain it well.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and broadly matches the main change: increasing the Claude timeout in Codex-related executor behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/en/user-guide/ai-devices/local-device-support.md`:
- Around line 215-223: Adjust the heading level for the “Claude Code Execution
Timeout” subsection in the local-device-support docs so it uses `###` instead of
`####`, keeping the document hierarchy consistent with the allowed
`#`/`##`/`###` structure. Update the markdown heading in that subsection only,
and leave the surrounding content and code block unchanged.

In `@docs/zh/user-guide/ai-devices/local-device-support.md`:
- Around line 217-225: The “Claude Code 执行超时” subsection in the local device
support guide uses the wrong heading depth and should be changed from a
fourth-level heading to a third-level heading to match the docs hierarchy.
Update the markdown heading for this section to use `###` so it aligns with the
surrounding structure and the repository’s docs conventions, keeping the rest of
the content unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d73cf8f-9649-478b-ab8f-71bfae3d6fb2

📥 Commits

Reviewing files that changed from the base of the PR and between ea4c7cc and ccaf78f.

📒 Files selected for processing (10)
  • docs/en/user-guide/ai-devices/local-device-support.md
  • docs/zh/user-guide/ai-devices/local-device-support.md
  • executor/src/agents/mod.rs
  • executor/src/process/mod.rs
  • executor/tests/agent_process_engine_contract.rs
  • executor/tests/app_runtime_work_send_contract.rs
  • executor/tests/claude_cancellation_contract.rs
  • executor/tests/process_engine_contract.rs
  • wework/src/App.plugins.test.tsx
  • wework/src/components/chat/FileChangesReviewPanel.test.tsx

Comment on lines +215 to +223
#### Claude Code Execution Timeout

When the local executor starts a Claude Code child process, it waits up to 1 hour by default. Long-running code generation, dependency installation, or file processing tasks can continue within that window. To tune the limit for a specific environment, set `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS` before starting the executor. This setting only affects Claude Code child processes, not the native Codex app-server path; Codex RPC timeouts are controlled by `WEGENT_CODEX_RPC_TIMEOUT_SECONDS`.

```bash
export WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS=7200
wegent-executor
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use ### instead of #### for this subsection.

Line 215 breaks the repo’s required docs heading hierarchy; only #, ##, and ### are allowed here.

Suggested fix
-#### Claude Code Execution Timeout
+### Claude Code Execution Timeout

As per coding guidelines, docs/**/*.{md,mdx}: "Use a consistent heading hierarchy: # for title, ## for sections, and ### for subsections."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### Claude Code Execution Timeout
When the local executor starts a Claude Code child process, it waits up to 1 hour by default. Long-running code generation, dependency installation, or file processing tasks can continue within that window. To tune the limit for a specific environment, set `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS` before starting the executor. This setting only affects Claude Code child processes, not the native Codex app-server path; Codex RPC timeouts are controlled by `WEGENT_CODEX_RPC_TIMEOUT_SECONDS`.
```bash
export WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS=7200
wegent-executor
```
### Claude Code Execution Timeout
When the local executor starts a Claude Code child process, it waits up to 1 hour by default. Long-running code generation, dependency installation, or file processing tasks can continue within that window. To tune the limit for a specific environment, set `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS` before starting the executor. This setting only affects Claude Code child processes, not the native Codex app-server path; Codex RPC timeouts are controlled by `WEGENT_CODEX_RPC_TIMEOUT_SECONDS`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/en/user-guide/ai-devices/local-device-support.md` around lines 215 -
223, Adjust the heading level for the “Claude Code Execution Timeout” subsection
in the local-device-support docs so it uses `###` instead of `####`, keeping the
document hierarchy consistent with the allowed `#`/`##`/`###` structure. Update
the markdown heading in that subsection only, and leave the surrounding content
and code block unchanged.

Source: Coding guidelines

Comment on lines +217 to +225
#### Claude Code 执行超时

本地 executor 启动 Claude Code 子进程时,默认最长等待 1 小时。长时间代码生成、依赖安装或文件处理任务可以在这个时间内继续运行。若需要为特定环境调整该限制,可在启动 executor 前设置 `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS`。该配置只影响 Claude Code 子进程,不影响 native Codex app-server;Codex RPC 超时由 `WEGENT_CODEX_RPC_TIMEOUT_SECONDS` 控制。

```bash
export WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS=7200
wegent-executor
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use ### instead of #### for this subsection.

Line 217 breaks the repo’s required docs heading hierarchy; only #, ##, and ### are allowed here.

Suggested fix
-#### Claude Code 执行超时
+### Claude Code 执行超时

As per coding guidelines, docs/**/*.{md,mdx}: "Use a consistent heading hierarchy: # for title, ## for sections, and ### for subsections."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### Claude Code 执行超时
本地 executor 启动 Claude Code 子进程时,默认最长等待 1 小时。长时间代码生成、依赖安装或文件处理任务可以在这个时间内继续运行。若需要为特定环境调整该限制,可在启动 executor 前设置 `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS`。该配置只影响 Claude Code 子进程,不影响 native Codex app-server;Codex RPC 超时由 `WEGENT_CODEX_RPC_TIMEOUT_SECONDS` 控制。
```bash
export WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS=7200
wegent-executor
```
### Claude Code 执行超时
本地 executor 启动 Claude Code 子进程时,默认最长等待 1 小时。长时间代码生成、依赖安装或文件处理任务可以在这个时间内继续运行。若需要为特定环境调整该限制,可在启动 executor 前设置 `WEGENT_CLAUDE_CODE_PROCESS_TIMEOUT_SECONDS`。该配置只影响 Claude Code 子进程,不影响 native Codex app-server;Codex RPC 超时由 `WEGENT_CODEX_RPC_TIMEOUT_SECONDS` 控制。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/zh/user-guide/ai-devices/local-device-support.md` around lines 217 -
225, The “Claude Code 执行超时” subsection in the local device support guide uses
the wrong heading depth and should be changed from a fourth-level heading to a
third-level heading to match the docs hierarchy. Update the markdown heading for
this section to use `###` so it aligns with the surrounding structure and the
repository’s docs conventions, keeping the rest of the content unchanged.

Source: Coding guidelines

@qdaxb
qdaxb merged commit 38cb133 into wecode-ai:main Jun 30, 2026
27 checks passed
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