Add error_generator test worker and handle_error decorator#136
Add error_generator test worker and handle_error decorator#136arjunrajlab wants to merge 2 commits intomasterfrom
Conversation
Add a new test worker that generates various error conditions (warnings, errors, HTTP 500/503/504, OOM, crashes) via checkboxes for testing frontend error reporting. Add a @handle_error decorator to annotation_utilities that catches unhandled exceptions and sends user-friendly sendError() messages before re-raising. See #135 for adding this to all workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 994b852823
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sendProgress(step / total_steps * 0.9, 'Error Generator', | ||
| f'Simulating HTTP 500 ({step}/{total_steps})') | ||
| # Show some progress first, like a real worker would | ||
| for i in range(3): | ||
| frac = 0.05 * (i + 1) |
There was a problem hiding this comment.
Use monotonic progress values for HTTP simulations
This branch emits sendProgress(step / total_steps * 0.9, ...) and then immediately emits smaller fixed fractions (0.05, 0.10, 0.15), so with common inputs (e.g., only Simulate HTTP 500 selected) progress jumps from 90% back down to 5%. That regression can confuse frontend progress handling and makes error-flow testing noisy; the same pattern is repeated in the 503/504 branches as well.
Useful? React with 👍 / 👎.
Summary
error_generatortest worker with checkbox options to trigger various error conditions:sendWarning,sendError, HTTP 500/503/504 crashes, OOM, immediate crash, and crash-after-progress. Used for developing/testing frontend error reporting.@handle_errordecorator inannotation_utilities/progress.pythat catches unhandled exceptions and sends user-friendlysendError()messages before re-raising (e.g. "Servers busy. Try again in a few minutes." for 503/504, "Out of memory. Check logs for details." for MemoryError).Test plan
docker compose build test-worker-base && ./build_test_workers.sh error_generator🤖 Generated with Claude Code