Skip to content

[MOT-558] fix: failed ai move leaving game stuck#32

Open
rodrigomf24 wants to merge 1 commit intomainfrom
fix/failed-ai-move
Open

[MOT-558] fix: failed ai move leaving game stuck#32
rodrigomf24 wants to merge 1 commit intomainfrom
fix/failed-ai-move

Conversation

@rodrigomf24
Copy link
Copy Markdown
Contributor

@rodrigomf24 rodrigomf24 commented Aug 1, 2025

Why?

AI vs AI games are stuck on the last move when the prompt execution fails for any reason

What?

  • Allow users to retry the last move on an ai vs ai game with a retry limit to avoid infinite retries
  • Present dialog to let the user drive the retry
  • End the game after the max retry attempt

Demo

https://www.veed.io/view/b5da0eaa-ae4c-407a-9ca6-786bc3ca9ad1?panel=share

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chessarena ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2025 4:17am

@rodrigomf24 rodrigomf24 changed the title fix: failed ai move leaving game stuck [MOT-558] fix: failed ai move leaving game stuck Aug 1, 2025
Comment on lines +25 to +36
</DialogHeader>
<div className="flex flex-col gap-6 w-full items-center justify-center">
<p className="text-center">Oops! Something went wrong, would you like to retry the last move?</p>
<Button
data-testid="retry-move-button"
variant="default"
className="h-12 w-fit"
onClick={onRetryClick}
>
<RotateCcw className="size-5" /> <span>Retry last move</span>
</Button>
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This leads to critical race condition.

@sergiofilhowz
Copy link
Copy Markdown
Contributor

Solved this one with a limit of 10 minutes per game session, then after refreshing, ChessArena will create a new game session. I'm closing this PR since it has some critical issues around race conditions that are really hard to solve.

@rodrigomf24 rodrigomf24 reopened this Aug 5, 2025
@rodrigomf24
Copy link
Copy Markdown
Contributor Author

rodrigomf24 commented Aug 5, 2025

Solved this one with a limit of 10 minutes per game session, then after refreshing, ChessArena will create a new game session. I'm closing this PR since it has some critical issues around race conditions that are really hard to solve.

I can't replicate the race condition you are mentioning due to the Dialog to retry the last step. Can you provide more details of what steps you took that lead you to that, please?

I checked the 10 minute timeout but this won't solve scenarios where a human is playing vs AI and the AI move failed due to the prompt failing to process (see attached demo). It also assumes someone will refresh the page or for someone else to enter the game, which won't be the case for human vs ai always.

I'm reopening this PR for now until we can discuss further.

@sergiofilhowz
Copy link
Copy Markdown
Contributor

if two users click the replay button at the same time it will trigger the execution twice
and there's also the retry mechanism that happens in motia cloud after 15 minutes

while we don't have FIFO queues we can't do this, unfortunately

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.

2 participants