fix: Report initial status and terminal status message (if saved)#780
Merged
jirispilka merged 7 commits intomasterfrom May 5, 2026
Merged
fix: Report initial status and terminal status message (if saved)#780jirispilka merged 7 commits intomasterfrom
jirispilka merged 7 commits intomasterfrom
Conversation
- abortActorRun is awaited before callActorGetDataset returns, so a client notifications/cancelled actually aborts the run instead of fire-and-forget. - Initial actor run status is sent through the progress tracker before waitForFinish, so the first status update reaches the client without the polling delay. - PROGRESS_NOTIFICATION_INTERVAL_MS lowered 5s -> 2s for snappier progress. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves reliability of Actor-run progress and cancellation behavior so clients consistently receive early and terminal status updates and cancellations actually abort the run before returning.
Changes:
- Add terminal-aware Actor run status formatting and strengthen
ProgressTrackerto avoid duplicate emissions (seeded initial state, stopped guard, consecutive-message dedup). - Update
callActorGetDatasetto await abort requests on cancellation, emit an initial progress update immediately, and emit a final terminal update from a refreshed run snapshot. - Reduce progress polling interval from 5s to 2s and expand unit test coverage for the new behaviors.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/tools/core/actor_execution.ts |
Await abort on cancellation; emit initial + final progress messages; refresh run snapshot after completion. |
src/utils/progress.ts |
Introduce formatRunStatusMessage; add dedup/stopped protections; seed polling dedup state. |
src/const.ts |
Lower progress polling interval to 2 seconds. |
tests/unit/tools.actor_execution.test.ts |
Add coverage for cancellation awaiting abort and for initial/final progress emission behavior. |
tests/unit/utils.progress.test.ts |
Add coverage for dedup, seeded initial state, and stop-while-in-flight behavior; add formatter tests. |
tests/integration/suite.ts |
Update commentary to reference the polling interval constant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…for cancellation tests
…failures gracefully
MQ37
approved these changes
May 4, 2026
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
Make actor-run progress and abort notifications reliable end-to-end.
callActorGetDatasetawaits the abort API call before returning onnotifications/cancelled, so the run is aborted rather than fire-and-forget. The polling tracker is also stopped on the cancel path.waitForFinish, so clients don't wait for the polling interval to see the first update.waitForFinishresolves, the tracker is stopped and the run is re-fetched once (in parallel with dataset/build) to capture the actor's finalstatusMessage— the platform may write it just after the status flip. A terminal notification is then emitted explicitly so the client always seesSUCCEEDED/FAILED/etc., even if polling never ticked at terminal.formatRunStatusMessagealways leads with the run status (apify/foo: SUCCEEDED — Done). At terminal status, the actor'sstatusMessageis only appended when explicitly marked terminal (isStatusMessageTerminal === true); otherwise it's omitted to avoid showing stale in-progress text.stoppedflag inProgressTrackerprevents in-flight polling ticks from emitting afterstop()is called.updateProgressdedups consecutive identical messages, so a polling tick that catches the terminal state doesn't double up with the explicit final emit.PROGRESS_NOTIFICATION_INTERVAL_MSlowered 5s → 2s for snappier updates.All tests are passing now
🤖 Generated with Claude Code