Skip to content

fix(code-intel): order transport failure publication - #161

Merged
Qiyuanqiii merged 1 commit into
mainfrom
codex/fix-codeintel-diagnostic-crash-race
Aug 24, 2026
Merged

Qiyuanqiii merged 1 commit into
mainfrom
codex/fix-codeintel-diagnostic-crash-race

Conversation

@Qiyuanqiii

Copy link
Copy Markdown
Member

Summary

  • publish the terminal transport signal before releasing pending LSP requests with the same failure
  • prevent a diagnostic transport crash from racing into the push-diagnostics fallback as a successful empty result
  • add a deterministic ordering regression test for the transport lifecycle contract

Root cause

transport.setFailure marked the transport closed, but then delivered errors to pending request channels before closing transport.done. A released request could resume in that interval. queryDiagnostics uses done to distinguish a terminal transport failure from an ordinary pull-diagnostics RPC error, so the process-exit error could be misclassified and converted into a successful push fallback.

The test helper deliberately exits during textDocument/diagnostic. Under the race detector the affected request occasionally returned nil, leaving the crash masked. The same unchanged code alternated between pass and failure on the #159 head and its merge commit.

This change closes done before publishing pending request errors. Every released waiter therefore observes the terminal state. The new unbuffered-channel test makes that ordering contract deterministic and fails against the previous implementation.

This is a pre-existing Code Intel lifecycle race introduced with #119. It is unrelated to the CSS-only changes in #158 and to the Command Runtime changes in #159.

Validation

  • reproduced before the fix: go test -race -count=100 -timeout 10m ./internal/codeintel -run '^TestDiagnosticsDoesNotMaskTransportCrashAsPushFallback$'
  • fixed scenario, 1000 consecutive race-detector runs
  • complete Code Intel race/fault suite: go test -race -count=1 -timeout 5m ./internal/codeintel
  • complete Code Intel package: go test -count=1 -timeout 5m ./internal/codeintel
  • go vet ./internal/codeintel
  • git diff --check

Repairs the failure observed on main@b42eccd in CI run 32749900859.

@Qiyuanqiii
Qiyuanqiii merged commit 6419e60 into main Aug 24, 2026
9 checks passed
@Qiyuanqiii
Qiyuanqiii deleted the codex/fix-codeintel-diagnostic-crash-race branch August 24, 2026 19:14
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.

1 participant