Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lichess-bot issues new challenges before cancelling old ones, allowing too many concurrent games, which time out #991

Closed
JimViebke opened this issue Jul 21, 2024 · 3 comments · Fixed by #992

Comments

@JimViebke
Copy link

JimViebke commented Jul 21, 2024

Describe the bug

lichess-bot seems to issue new challenges before cancelling old ones. This allows one opponent to accept a newer challenge, starting a game. While this game is in progress, another opponent can accept the older challenge, creating a second game that appears to be (correctly) ignored by lichess-bot. While the existing game is played, the new game eventually times out and is aborted.

Observed behavior: lichess-bot allows more games to start than it will play.
Expected behavior: lichess-bot limits open challenges to concurrency + 1.

config.yml currently has concurrency: 0 and allow_during_games: false.

(side suggestion: in future configs, change:
concurrency: 0 # Number of games to play simultaneously.
to:
concurrency: 1 # Maximum number of games to play at once. The min is 1.)

The timeline, per recent.log (attached):

  • 18:53: lichess-bot challenges ai-con (game osCQjeIm).
  • 18:54: lichess-bot challenges StockSquidV2 (game 5Sz1P70f). The game starts at 18:54 and completes at 19:00.
  • 19:01: lichess-bot challenges The_Marcus (game CdRG6Obm).
  • 19:01: Game with The_Marcus starts.
  • 19:02: Game with ai-con starts.
  • 19:03: Game with ai-con times out per abort_time: 30 in config.yaml ("Game aborted" on lichess.org).
  • 19:06: Game with The_Marcus completes.
  • 19:06: lichess-bot prepares to play the game with ai-con, and notices that it has aborted.

It may be a separate issue, but lichess-bot seems to stop receiving or accepting challenges at this point, and just idles until it is restarted.

Logs
recent.log

Desktop:

  • OS: Windows 10
  • Python Version: Python 3.12.4
  • Terminal: PowerShell (using venv\Scripts\activate, py lichess-bot.py)
@MarkZH
Copy link
Collaborator

MarkZH commented Jul 21, 2024

I think both issues are related to the ERROR lines in your logs. Due to a change in the response format from Lichess to challenges, the game ID of the matchmaking challenge is not being extracted correctly. This has two effects:

  1. The challenge cannot be cancelled because there's no record of the game id--hence why the game with ai-con started nine minutes after the challenge was sent.
  2. Every bot that gets challenged gets put on a block list because challenging them resulted in an error. So lichess-bot eventually stops challenging any bots since they are all on a block list.

I've filed an issue with the Lichess developers. Let's see if fixing that fixes this.

MarkZH added a commit to MarkZH/lichess-bot that referenced this issue Jul 21, 2024
The Lichess API was updated so that the JSON response to creating a
challenge is no longer nested under a single `challenge` heading. All
information has been moved to the top level. This commit aligns
lichess-bot with the API change.

Closes lichess-bot-devs#991.
@MarkZH
Copy link
Collaborator

MarkZH commented Jul 21, 2024

I've created a PR (#992) to address this issue. Please try it and let me know if it fixes the problem.

AttackingOrDefending pushed a commit that referenced this issue Jul 22, 2024
The Lichess API was updated so that the JSON response to creating a
challenge is no longer nested under a single `challenge` heading. All
information has been moved to the top level. This commit aligns
lichess-bot with the API change.

Closes #991.
@MarkZH
Copy link
Collaborator

MarkZH commented Jul 22, 2024

Please reopen if this issue persists.

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 a pull request may close this issue.

2 participants