Skip to content

fix(claude): eliminate intercept integration port reservation race - #7174

Merged
lidge-jun merged 2 commits into
devfrom
fix/claude-intercept-port-race
Oct 15, 2026
Merged

lidge-jun merged 2 commits into
devfrom
fix/claude-intercept-port-race

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Remove the reserve/release/rebind race in claude-intercept-integration.test.ts: the public listener and real CONNECT proxies now bind directly on kernel-assigned ports. Forward the existing runtime binder seam through StartServerDeps instead of probing ports or mocking the transport.
  • Migrate stale, owned Claude settings only after a successful CONNECT bind, and publish the handle's actual port. Fixed production ports remain stable; an occupied port still reports port_in_use and leaves settings bytes unchanged.
  • Regression coverage holds the configured port throughout startup and verifies a real ephemeral proxy binds elsewhere and settings name its actual endpoint. The default-binder collision regression verifies unchanged settings. Update the runtime, Claude ownership docs, and public guide.
  • Investigated Linux test 1/4 in run 38698256962, reported on unrelated carry PR fix(claude): verify Desktop backup and optional metadata reads (carry #7084) #7129. No existing fix found on origin/dev (7640a942b) or the inspected open PRs; no matching failure in the other nine recent failed CI runs. The failing test itself used src/server/ports.ts, not a shared test helper. Shared helpers were inspected; unrelated reserve-ingress fixtures are outside this patch.

Verification

  • Before the fix: the occupied-port integration regression failed with EADDRINUSE and no intercept state; the default-binder regression failed because settings were rewritten despite the collision.
  • bun test tests/server/claude-intercept-integration.test.ts tests/claude-integration/claude-intercept-on-demand.test.ts: 18 pass, 0 fail.
  • bun test tests/server/claude-intercept-integration.test.ts, repeated in 20 fresh processes: 20/20 pass. Four further instances ran concurrently with bun test tests/server/ports.test.ts tests/server/startup-prompt.test.ts: all passed (28 neighboring tests).
  • bun test tests/claude-integration/claude-intercept-settings.test.ts tests/claude-integration/claude-intercept-proxy-auth.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts: 64 pass, 0 fail.
  • bun test tests/ci-workflows/file-size-ratchet.test.ts: 9 pass, 0 fail.
  • bun run typecheck, bun run privacy:scan, bun run structure:check, and git diff --check: passed.
  • cd docs-site && bun install --frozen-lockfile && bun run build: passed; 577 pages and 81,200 internal links checked.
  • Independent Codex review: no blockers; explicit scoped security review PASS (binding/publication ordering, ownership, CONNECT authentication, ingress and cleanup). Review also ran 37 adjacent settings/auth tests successfully.
  • bun run test:changed initially queued behind another worktree's shared user lock. Restarted only this lane's waiter as OCX_TEST_NO_QUEUE=1 bun run test:changed: 8,048 pass, 32 skip, 0 fail across 350 files (exit 0, 93.9 seconds).
  • Full bun run test deferred due concurrent worktree resource contention. Focused regressions and stress checks passed; remaining broad Linux/macOS/Windows coverage is assigned to manual ci.yml with lane=all. Manual lane=all run 38722308331 was dispatched on exact head e6cb171c9667b408dcd629e1842b3ba119be91e5 and is queued. PR remains draft pending broader exact-head evidence; no unrun suite is claimed as passing.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 15, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev (MAINTAINERS.md dev maintainer-integration policy; batch integration authorized by @lidge-jun on 2026-10-15).

  • Head: 3a4b9652c3f729cd20dbdf69a09f4c1ace2e3fc0 (tree be4fe2af6ea2ea7b07c31821d7bc05aaa64b996d) = this branch merged with origin/dev 37fcd2470a.
  • Exact-head evidence: GitHub-hosted Actions for this account have not been assigning runners since 2026-10-15 13:30 UTC, so by owner decision the evidence is a full bun run test (Bun 1.4.3 test runner, root and GUI dependencies installed, GUI built) of this exact tree on a maintainer host (Linux x86_64): exit 1, 7 min, 31 failing test(s), each also failing in the same host's baseline run of dev 60bf4c7 (environment-only): Codex shim install readiness > a refused install exits unsuccessfully and preserves its re, Codex shim install readiness > keeps install advisory when the Codex config cannot be read, Codex shim install readiness > the install command surfaces readiness warnings without lea, GUI pairing client > sends one bodyless origin-bound capability and redacts rejected bodie, Node launcher PATH fallback activation > broken bundle reaches validated PATH Bun, Node launcher PATH fallback activation > inspection bundle reaches validated PATH Bun, Node launcher PATH fallback activation > missing bundle reaches validated PATH Bun, a secondary ensure parent preserves shared Grok, Codex and Claude agent bytes, ….
  • Local gates on the same tree: bun run typecheck, file-size ratchet, test-layout and structure:check.
  • Hosted CI checks for this head may still be queued; they are not claimed as evidence.

@lidge-jun
lidge-jun marked this pull request as ready for review October 15, 2026 19:45
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 15, 2026 19:45
@lidge-jun
lidge-jun merged commit f089fdf into dev Oct 15, 2026
6 of 7 checks passed
@lidge-jun
lidge-jun deleted the fix/claude-intercept-port-race branch October 15, 2026 19:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T19:47:35.206579Z 3a4b965 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant