Skip to content

EW-6888 Improve finishScheduled() outcome reporting#6606

Merged
fhanau merged 1 commit intomainfrom
felix/041726-outcome-reporting
Apr 29, 2026
Merged

EW-6888 Improve finishScheduled() outcome reporting#6606
fhanau merged 1 commit intomainfrom
felix/041726-outcome-reporting

Conversation

@fhanau
Copy link
Copy Markdown
Contributor

@fhanau fhanau commented Apr 17, 2026

Fixes a number of footguns that could lead to misleading event outcomes being reported for all events that use finishScheduled() (scheduled, queue, test etc.):

  • Exception outcomes in finishScheduled() could be converted into exceededCpu
  • Exception details were not being checked in finishScheduled()
  • IoContext::taskFailed() now properly handles exception details
  • Consolidate code used to get outcome from exception detail
  • Add a TODO for improving outcome reporting when the scheduled time limit is hit

For context, see the recent outcome related changes (#6668, #6589, #6542) as well as the corresponding downstream PRs.

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR changes finishScheduled() to return EventOutcome directly instead of the internal FinishScheduledResult enum, improving outcome reporting by propagating richer error information from outcomeFromException().

Issues found (ranked by severity):

  1. [HIGH] All three new DetailTypeId constants are placeholder 0x0ull — they collide with each other and will cause incorrect dispatching in outcomeFromException().
  2. [MEDIUM] Leftover commented-out code and bare // TODO comments appear to be debug artifacts that should not be merged.
  3. [LOW] The outcomeFromException function takes a non-const lvalue reference but doesn't modify the exception — should be const.

This review was generated by an AI assistant and may contain inaccuracies.

Comment thread src/workerd/io/io-context.c++ Outdated
Comment thread src/workerd/io/io-context.c++ Outdated
Comment thread src/workerd/api/queue.c++ Outdated
Comment thread src/workerd/io/io-context.c++ Outdated
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 17, 2026

Review posted on PR #6606 with 4 inline comments. Summary of findings:

  1. [HIGH] Three new DetailTypeId constants (SCRIPT_KILLED_DETAIL_ID, INACTIVE_WEBSOCKETS_DETAIL_ID, SCRIPT_NOT_FOUND_DETAIL_ID) are all 0x0ull — they collide with each other, making the branching logic in outcomeFromException() broken. All existing IDs in the codebase use unique random 64-bit values.

  2. [MEDIUM] Leftover debug artifacts — bare // TODO comments and a commented-out old code line (// if (result == IoContext_IncomingRequest::FinishScheduledResult::TIMEOUT)) in queue.c++:967.

  3. [LOW] outcomeFromException takes a mutable reference but doesn't modify the exception — should be const kj::Exception&.

github run

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 47.36842% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.58%. Comparing base (1f09441) to head (a7c34a1).

Files with missing lines Patch % Lines
src/workerd/io/observer.c++ 43.75% 4 Missing and 5 partials ⚠️
src/workerd/api/queue.c++ 33.33% 3 Missing and 1 partial ⚠️
src/workerd/io/io-context.c++ 50.00% 4 Missing ⚠️
src/workerd/io/worker-entrypoint.c++ 57.14% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6606      +/-   ##
==========================================
+ Coverage   66.55%   66.58%   +0.02%     
==========================================
  Files         402      402              
  Lines      115890   115858      -32     
  Branches    19405    19396       -9     
==========================================
+ Hits        77131    77142      +11     
+ Misses      27188    27143      -45     
- Partials    11571    11573       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fhanau fhanau force-pushed the felix/041726-outcome-reporting branch from e236918 to bdfac0b Compare April 18, 2026 02:10
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 18, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing felix/041726-outcome-reporting (a7c34a1) with main (1f09441)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@fhanau fhanau force-pushed the felix/041726-outcome-reporting branch from bdfac0b to 2224fd6 Compare April 28, 2026 17:35
@fhanau fhanau marked this pull request as ready for review April 28, 2026 19:16
@fhanau fhanau requested review from a team as code owners April 28, 2026 19:16
@fhanau fhanau force-pushed the felix/041726-outcome-reporting branch 2 times, most recently from 15e8a2d to 2b8e6ca Compare April 29, 2026 16:11
Comment thread src/workerd/io/observer.c++
@fhanau fhanau requested a review from a-robinson April 29, 2026 16:27
Comment thread src/workerd/api/queue.c++ Outdated
@fhanau fhanau force-pushed the felix/041726-outcome-reporting branch from 2b8e6ca to e85d996 Compare April 29, 2026 20:17
@fhanau fhanau force-pushed the felix/041726-outcome-reporting branch from e85d996 to a7c34a1 Compare April 29, 2026 21:22
@fhanau fhanau merged commit e8331e7 into main Apr 29, 2026
22 of 23 checks passed
@fhanau fhanau deleted the felix/041726-outcome-reporting branch April 29, 2026 21:53
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.

3 participants