Skip to content

test(cadente): wait for error log line before asserting - #55

Merged
CypherPotato merged 1 commit into
mainfrom
fix/test-error-log-race
Oct 16, 2026
Merged

CypherPotato merged 1 commit into
mainfrom
fix/test-error-log-race

Conversation

@CypherPotato

Copy link
Copy Markdown
Member

Summary

CadenteExceptionPropagationTests.RequestException_ReportsToHandlerAndErrorLog is flaky in CI (4 of the last 11 runs failed with String '' does not contain string 'Cadente probe exception.').

Cause

HttpServer calls handler.Exception(...) (HttpServer.Core.cs:510) before errorLogStream?.WriteLine(entry) (HttpServer.Core.cs:531), and LogStream writes to the TextWriter from a background consumer. The test read the StringWriter right after the handler signal, so it could win the race.

Change

Test only. After the handler signal, flush the error LogStream and poll the writer for up to 3 seconds before asserting. No changes under src/; the order of handler notification and logging is untouched.

Validation

  • Default and Cadente engines: pass.
  • 60 runs (30 per engine) with 12 busy-loop processes competing for CPU: 0 failures. Before the change: 1 failure in 60 runs under the same load.

The server notifies handlers via OnException before enqueuing the entry on the error LogStream, and LogStream writes to the TextWriter on a background consumer. Reading the StringWriter right after the handler signal could observe it empty. Flush the log stream and poll, up to 3 seconds, before asserting.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T18:16:37.051920Z b58ee43 PR opened
ℹ️ 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.

@CypherPotato
CypherPotato merged commit 6871708 into main Oct 16, 2026
5 checks passed
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