fix: detect Codex boot marker format in PTY startup gate#600
Conversation
The PTY startup gate only matched Claude's boot message format
("booting mcp server: relaycast") but Codex outputs a different
format ("Starting MCP servers (0/2): relay, relaycast"). This caused
Codex agents to fall through to the 25s timeout fallback every time.
Add find_relaycast_boot_marker() that matches both formats, so Codex
agents pass the startup gate immediately when their MCP server loads.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add blank line before "Returns" paragraph in doc comment to satisfy clippy::doc_lazy_continuation lint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xkonjin
left a comment
There was a problem hiding this comment.
Code Review
Summary: Adds detection for the Codex-style MCP boot marker format ("Starting MCP servers (0/2): relay, relaycast") alongside the existing Claude-style marker. This unblocks the PTY startup gate for Codex sessions.
Issues Found
let search_end = floor_char_boundary(lower_output, (idx + 200).min(lower_output.len()));The 200-char window assumes "relaycast" appears close to "starting mcp server" in the output. This is reasonable for the current Codex format but fragile if future output includes more MCP servers in the list (e.g., 10+ servers with long names). Consider either:
- Making the window configurable, or
- Searching to end-of-line (
\n) instead of a fixed byte count
✅ Strengths
- Clean extraction into a dedicated
find_relaycast_boot_marker()function with clear doc comment. - Returns byte offset of the end of the marker, maintaining the existing contract.
- Falls through to existing
RELAYCAST_BOOT_MARKERcheck first (Claude path), so no regression for working setups. floor_char_boundaryusage is correct for safe UTF-8 slicing.
Missing: No test coverage
This function is pure and testable. A unit test with both Claude-style and Codex-style input strings would catch regressions if the marker formats change again. Something like:
#[test]
fn test_find_relaycast_boot_marker_codex() {
let input = "starting mcp servers (0/2): relay, relaycast\n";
assert!(find_relaycast_boot_marker(input).is_some());
}Verdict
Correct fix for a real compatibility issue. Ship-ready, but adding a unit test for the new function would be valuable.
* fix: detect Codex boot marker format in PTY startup gate
The PTY startup gate only matched Claude's boot message format
("booting mcp server: relaycast") but Codex outputs a different
format ("Starting MCP servers (0/2): relay, relaycast"). This caused
Codex agents to fall through to the 25s timeout fallback every time.
Add find_relaycast_boot_marker() that matches both formats, so Codex
agents pass the startup gate immediately when their MCP server loads.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: use floor_char_boundary to prevent panic on non-ASCII PTY output
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: resolve clippy doc_lazy_continuation warning in pty_worker
Add blank line before "Returns" paragraph in doc comment to satisfy
clippy::doc_lazy_continuation lint.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
find_relaycast_boot_marker()tosrc/pty_worker.rsthat matches both Claude and Codex MCP boot message formats"booting mcp server: relaycast""Starting MCP servers (0/2): relay, relaycast"Context
This is the pre-existing boot marker mismatch identified during the Codex spawn regression investigation. While PR #597 fixes the registration timeout (the acute regression from #591), this PR fixes the underlying reason Codex agents always hit the 25s startup timeout.
Test plan
cargo testpasses🤖 Generated with Claude Code