fix(weave): don't stall flush() on unpaired eager calls under calls_complete - #7216
Merged
Merged
Conversation
…omplete A mid-eval client.flush() cleared _eager_call_ids, so the eventual eager call-end no longer matched and parked in _pending_ends as a never-pairing orphan. The next flush then burned the full FLUSH_TIMEOUT_SECONDS (5 min) waiting on it. Keep eager tracking across a flush, exclude eager-unpaired ends from the pairing wait, and send them via the eager v2 endpoint immediately. Non-eager in-flight work keeps the full pairing budget. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The orphaned-eager-end stall is fixed entirely by not clearing _eager_call_ids on flush. _handle_end already routes eager ends, so the _flush_eager_unpaired_ends / _num_non_eager_pending helpers were unreachable; drop them and tighten the test to assert the no-stall regression directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gtarpenning
marked this pull request as ready for review
June 15, 2026 16:52
jtschoonhoven
approved these changes
Jun 15, 2026
Contributor
There was a problem hiding this comment.
Claude nit:
Lingering assertion in the renamed test is now misleading (239): you dropped "and clears state"/"clears caches" from the name and docstring but kept assert len(processor._eager_call_ids) == 0. That assertion still passes only because both items in that test are non-eager (enqueue(...) with eager_call_start=False), so no eager ids are ever created, not because anything clears them. It now reads like it's verifying clear-on-flush, which is exactly the behavior you removed. Either drop the line or add a comment noting it's just confirming no eager IDs leaked from non-eager calls.
The renamed test no longer verifies clear-on-flush, but kept assert len(_eager_call_ids) == 0 which only passed because both items are non-eager. Drop it; the pending-state asserts already cover drain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
client.flush()cleared_eager_call_ids, so the later eager call-end no longer matched and parked in_pending_endsas a never-pairing orphan; the next flush then waited the full 5-minFLUSH_TIMEOUT_SECONDSon it.Testing
new test asserts eager-unpaired flush returns fast while non-eager pending still consumes the full timeout.