Skip to content

test: read through an empty log-tail stream when resuming - #312

Merged
ffroliva merged 3 commits into
mainfrom
fix/log-tail-resume-flake
Nov 24, 2026
Merged

ffroliva merged 3 commits into
mainfrom
fix/log-tail-resume-flake

Conversation

@ffroliva

Copy link
Copy Markdown
Owner

Summary

tests/fastapi/test_log_tail_api.py::test_resume_after_id[loaded-loop] failed on main (CI run 45296913127, test shard (ubuntu-latest, 3.12, 2/4)): assert [] == ['106f5a517989d97f-3'].

The stream ends after stream_max_seconds (0.05 s in these tests), and on a loaded runner it can end before its first frame. The _ids helper, which reads ids the way EventSource does, treated one empty stream as the end of the replay and stopped. EventSource reconnects in that case.

_ids now stops only after three consecutive streams bring no line (EMPTY_STREAMS). The production stream and the assertions are unchanged. A replay that is really complete costs two extra 0.05 s streams.

Verification

  • ruff check, ruff format --check.
  • pytest -n 4 tests/fastapi/test_log_tail_api.py five times in a row: 33 passed each time.
  • The empty-first-stream condition depends on runner load and is not reproduced deterministically here; the change only removes the helper's assumption that it cannot happen.

Contribution Checklist

  • Every non-merge commit carries Signed-off-by.
  • No AI attribution.
  • Changes adhere to AGENTS.md.

@ffroliva
ffroliva merged commit 61f3568 into main Nov 24, 2026
102 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