Skip to content

test(serve): wait for the approved write, not the busy flag, in the approval round trip - #543

Merged
ajianaz merged 1 commit into
developfrom
test/flaky-serve-approvals-tui-quit
Nov 10, 2026
Merged

ajianaz merged 1 commit into
developfrom
test/flaky-serve-approvals-tui-quit

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the flaky serve_approvals::approval_allow_round_trip_executes_the_work (it failed on CI for #539 and #542, both times unrelated to the PR's diff).

Why

After POST /approvals/{id}/decision returns 202 resuming, the test waited for the resumed turn by polling GET /sessions/{sid}/status until busy != true. Right after the 202 the resume may not have set busy yet, so the very first read says "not busy", the loop exits at once, the queue entry already reads approved, and the file assertion runs before the replayed write_file has landed ("the approved write must have executed"). A "not busy" read proves nothing at that moment.

Changes

  • crates/tole-cli/tests/serve_approvals.rs: poll for the effect itself (approved.txt, up to 10 s), then keep the existing wait for the session to settle. No production code and no assertion weakened: the same checks run, after the condition they depend on.

Testing

  • Reproduced under CPU load (6 busy loops on 4 cores), approval_allow_round_trip run 25 times in a row: old code failed 9/25, the fix 0/25.
  • cargo fmt --check, cargo clippy -p tole-cli --all-targets -D warnings, cargo test -p tole-cli --test serve_approvals (3 passed).
  • Local cora review --staged: not run (cora is not installed in this environment); the CI Cora Review job is the verdict.

Not included: the tui_e2e /quit race

An earlier CI failure suggested tests send /quit\r before the turn is idle (the text would be queued as steering input instead of running as a command), and adding t.idle() before /quit looked like the fix. I could not reproduce it: 23 runs of the old tui_e2e binary under heavier load (8 busy loops, 8 test threads) all passed, so that change is not in this PR. It should be revisited if it fails on CI again, with the failing test name in hand.

Related Issues

Related to #539 and #542 (CI failures that were not theirs).


Generated by Claude Code

…pproval round trip

After the 202 the resumed turn may not have set busy yet, so a not-busy read proved nothing and the assertion could run before approved.txt existed. Poll for the file, then for the settle.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit cc91477 into develop Nov 10, 2026
15 of 16 checks passed
@ajianaz
ajianaz deleted the test/flaky-serve-approvals-tui-quit branch November 11, 2026 04:10
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.

2 participants