Skip to content

Conversation

MichalKalita
Copy link
Contributor

@MichalKalita MichalKalita commented Aug 20, 2025

Closes: #160

Tested in:

I tried to write a test using manually sending a cancel notification, but I need a request ID, and I don't know where to find it because it's managed internally in the MCP client.

@MichalKalita MichalKalita requested a review from MQ37 August 20, 2025 09:59
@MichalKalita MichalKalita self-assigned this Aug 20, 2025
@MichalKalita
Copy link
Contributor Author

We could add a test to check that cancelled requests don't send any response. Now is only tested than request is cancelled.

Copy link
Contributor

@MQ37 MQ37 left a comment

Choose a reason for hiding this comment

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

As I already menitoned in person, please change the Actor in tests to either apify/python-example or apify/rag-web-browser. These are already on staging and I would prefer to not add a new Actor there to our testing suite. If that is not possible we can include this Actor (if truly needed). Otherwise LGTM, thank you 👍

Copy link
Collaborator

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

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

I agree with @MQ37. I also left a couple of comments that should be taken care of.

It should also be possible to send the cancel/notification to actor-mcp, but let’s not complicate this issue with that.

Please create a new issue so we don’t forget.

// Start the actor run but don't wait for completion
// Check if already aborted
if (abortSignal?.aborted) {
throw new Error('Operation cancelled');
Copy link
Collaborator

Choose a reason for hiding this comment

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

you are throwing exception that is caugth locally

// Create abort promise that handles both API abort and race rejection
const abortPromise = async () => new Promise<never>((_, reject) => {
abortSignal?.addEventListener('abort', async () => {
// Abort the actor run via API
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the spec: Both parties SHOULD log cancellation reasons for debugging

So should we add an INFO log here: MCP client requested cancellation, actorName ....

@MichalKalita
Copy link
Contributor Author

I also need to check if the Actorized MCP server receives a cancel notification. I could try to make some tests, but it can be hard/impossible with actual source code.

@github-actions github-actions bot added the t-ai Issues owned by the AI team. label Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-ai Issues owned by the AI team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Abort Actor run on notifications/cancelled
3 participants