fix: fail reporter worker when final result flush cannot send results - #354
Merged
Conversation
…ails BenchmarkReporter.flush catches send errors and leaves the unsent batch in pending, but finish would call completeWorker anyway if the final flush did not throw. This could mark a worker (and therefore the run) completed before all of its task results reached the platform. Track flushFailed on the reporter. finish now calls failWorker when the final flush leaves pending results or any batch failed to send, and only calls completeWorker when every result was accepted. Refs the investigation in https://app.devin.ai/sessions/06813b4b9fb64b60b1f47bd8e1e8f152 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor License AgreementAll contributors are covered by a CLA. |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
BenchmarkReporter.flush catches send errors and leaves the unsent batch in pending, but finish would call completeWorker anyway if the final flush did not throw. This could mark a worker (and therefore the run) completed before all of its task results reached the platform. The reporter implementation has moved to @benchsdk/worker; apply the fix there. Track flushFailed on the reporter, and have finish call failWorker when the final flush leaves pending results or any batch failed to send. Only call completeWorker when every result was accepted. Refs the investigation in https://app.devin.ai/sessions/06813b4b9fb64b60b1f47bd8e1e8f152 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.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 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.
Summary
BenchmarkReporter.flushcatchessendTaskResultserrors and leaves unsent records inthis.pending, butfinishstill calledcompleteWorkerifflush(true)did not throw. This allowed a worker (and therefore the run) to be marked complete before all of its task results reached the platform, which could also make a run appear complete sooner than it actually was.Changes:
flushFailedon the reporter and set it when any batch fails to send.finishnow checksflushFailedandpending.lengthafter the final flush. If any result remains unsent, it callsfailWorkerinstead ofcompleteWorker.completeWorkerwhen the final flush has accepted every pending result.Prevents a worker from reporting success when its result batch could not be delivered.
Link to Devin session: https://app.devin.ai/sessions/06813b4b9fb64b60b1f47bd8e1e8f152
Requested by: @dtice25