Allow users to set custom codedb timeout via --timeout flag#244
Allow users to set custom codedb timeout via --timeout flag#244
Conversation
|
Hey @destroyer22719! This PR implements the custom timeout feature you requested in #243. You can now use: However, I also noticed your comment about the process not actually closing after the timeout. I investigated the idle watchdog code and found a potential issue: The Problem: The main MCP loop uses blocking I/O (mcpj.readLine() from stdin). When the watchdog detects idle timeout and calls stdin.close(), the blocking read may not always be interrupted properly depending on the OS and how the MCP client manages the pipe. Current flow:
This explains why you see the process still running. The timeout is being detected, but the main thread can't exit because it's blocked waiting for input that never comes. Potential fix: We'd need to either:
Should I create a separate issue to track the process exit problem? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58176ae88b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else => return err, | ||
| }; | ||
| if (explicit) |value| { | ||
| return .{ .value = value, .source = .env }; |
There was a problem hiding this comment.
Strip leading v from explicit update version
resolveTargetVersion returns CODEDB_VERSION verbatim, but the download/checksum URLs later hardcode a v prefix (.../download/v{s}/...). If a user sets CODEDB_VERSION=v0.2.57 (a common tag format), the updater requests vv0.2.57 URLs and fails to fetch the release. Normalizing explicit versions with trimVersionPrefix before storing ResolvedVersion.value avoids this breakage.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| pub fn commandTargetsBinary(command_line: []const u8, executable_path: []const u8) bool { | ||
| if (std.mem.indexOf(u8, command_line, executable_path) != null) return true; |
There was a problem hiding this comment.
Match nuke targets by executable path, not substring
commandTargetsBinary currently returns true whenever executable_path appears anywhere in the command line, which is broader than “this PID is running this binary.” In killOtherCodedbProcesses, that can terminate another codedb process from a different install if one of its arguments happens to contain this path. Restrict the match to the parsed executable path (argv[0], with normalization) to avoid killing unrelated processes.
Useful? React with 👍 / 👎.
Summary
Adds support for custom idle timeout in the MCP server via the flag.
Changes
idle_timeout_msfrom const to var inmcp.zigsetIdleTimeout()function to configure timeout at runtime--timeout=Nargument in main.zig for the mcp commandUsage
Users can now set a custom idle timeout (in minutes) like:
This addresses issue #243 where users needed longer timeouts for debugging sessions.
Closes #243