Skip to content

fix(blueprint): wait for pty drain before restarting btop - #1095

Merged
i098 merged 2 commits into
mainfrom
fm/cf-main-ci-fix
Nov 1, 2026
Merged

i098 merged 2 commits into
mainfrom
fm/cf-main-ci-fix

Conversation

@i098

@i098 i098 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #1094

Summary

Main CI went red on 5e94086 (2026-10-31 21:02Z) when tests/test_btop_launcher.py failed with assert 2 == 1. The launcher restarted btop on a pty nobody was reading.

What changed and why

  • Remove stty "$(stty -g)" from blueprint/maintenance/btop.sh. It did not block on a full pty.
  • Write 8 KiB of NULs before the clear sequence. A full pty still accepts up to 4095 bytes in its last page, so the 7-byte clear sometimes did not block.
  • 8 KiB cannot fit, so the write blocks until a client reads. btop restarts only after the drain.

Test evidence

  • Pty experiment: on a full pty, a non-blocking write accepted 4095 bytes in 1 of 40 trials.
  • uv run pytest tests/test_btop_launcher.py: 3 of 3 passed after the fix, and 12 of 12 under CPU load.
  • The test also passed 15 of 15 before the fix, so the flake is rare. Remote CI on this PR is the proof.

Checklist

  • One concern in this PR.
  • The title uses the commit format, for example fix(provisions): check the digest before install.
  • Tests pass (uv run pytest).
  • Lint clean (uv run ruff check).
  • Ansible syntax clean (--syntax-check). Not applicable: no playbook changed.
  • Idempotent: launch → launch = changed=0 on the second run. Not applicable: no playbook changed.
  • A changelog fragment, changelog.d/<issue>.<type>.md (not a CHANGELOG.md edit), or the no changelog label. Not applicable: CI test fix, not user-facing.

@i098
i098 marked this pull request as draft November 1, 2026 12:55
@i098
i098 marked this pull request as ready for review November 1, 2026 13:51

@i098 i098 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Validation passed: the no-mistakes run checked the btop.sh clear-step fix (pads clear past the pty tail slack) and the changelog fragment; all 15 checks are green at ee3c35f and main's latest run is green. The base-script CI repro could not be shown locally; accepted because remote CI on this head is the proof. No open findings.

@i098
i098 merged commit 17ce9f7 into main Nov 1, 2026
15 checks passed
@i098
i098 deleted the fm/cf-main-ci-fix branch November 1, 2026 13:51
@github-project-automation github-project-automation Bot moved this from Todo to Done in Crewship roadmap Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Flaky btop launcher test turns main CI red

1 participant