Repository navigation
test(serve): wait for the approved write, not the busy flag, in the approval round trip - #543
Merged
Merged
Conversation
…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.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}/decisionreturns202 resuming, the test waited for the resumed turn by pollingGET /sessions/{sid}/statusuntilbusy != true. Right after the 202 the resume may not have setbusyyet, so the very first read says "not busy", the loop exits at once, the queue entry already readsapproved, and the file assertion runs before the replayedwrite_filehas 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
approval_allow_round_triprun 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).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 raceAn earlier CI failure suggested tests send
/quit\rbefore the turn is idle (the text would be queued as steering input instead of running as a command), and addingt.idle()before/quitlooked like the fix. I could not reproduce it: 23 runs of the oldtui_e2ebinary 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