Skip to content

fix: detect Codex boot marker format in PTY startup gate#600

Merged
khaliqgant merged 3 commits into
mainfrom
fix/codex-boot-marker
Mar 20, 2026
Merged

fix: detect Codex boot marker format in PTY startup gate#600
khaliqgant merged 3 commits into
mainfrom
fix/codex-boot-marker

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Mar 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds find_relaycast_boot_marker() to src/pty_worker.rs that matches both Claude and Codex MCP boot message formats
  • Claude: "booting mcp server: relaycast"
  • Codex: "Starting MCP servers (0/2): relay, relaycast"
  • Codex agents now pass the startup gate immediately instead of waiting for the 25s timeout fallback

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

  • Spawn a Codex agent — should pass startup gate in ~2-5s (not 25s)
  • Spawn a Claude agent — should still work (original marker still matched first)
  • cargo test passes

🤖 Generated with Claude Code


Open with Devin

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>
devin-ai-integration[bot]

This comment was marked as resolved.

khaliqgant and others added 2 commits March 20, 2026 12:46
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 xkonjin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

⚠️ Hardcoded search window of 200 chars

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_MARKER check first (Claude path), so no regression for working setups.
  • floor_char_boundary usage 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.

@khaliqgant khaliqgant merged commit 0c05f71 into main Mar 20, 2026
38 of 39 checks passed
@khaliqgant khaliqgant deleted the fix/codex-boot-marker branch March 20, 2026 12:25
khaliqgant added a commit that referenced this pull request Mar 25, 2026
* 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>
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