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

Bot cannot abort or resign after another bot challenged it and left #15318

Closed
greg-finley opened this issue May 16, 2024 · 12 comments
Closed

Bot cannot abort or resign after another bot challenged it and left #15318

greg-finley opened this issue May 16, 2024 · 12 comments
Labels

Comments

@greg-finley
Copy link
Contributor

Exact URL of where the bug happened

https://lichess.org/DJbIIQtieK1K

Steps to reproduce the bug

Another bot challenged mine and went offline.

What did you expect to happen?

Either the game aborts automatically, or I can manually abort it.

Using the bot's API key:

curl --location --request POST 'https://lichess.org/api/bot/game/DJbIIQti/abort'

{
    "error": "This game can no longer be aborted"
}

curl --location --request POST 'https://lichess.org/api/bot/game/DJbIIQti/resign'

{
    "error": "This game cannot be resigned"
}

What happened instead?

Now the game is hanging and using up a thread.

Operating system

n/a

Browser and version (or alternate access method)

bot API

Additional information

No response

@kelseyde
Copy link

kelseyde commented May 16, 2024

The same is happening for my bot, against the same opponent: https://lichess.org/jOFDwY6j

The lichess-bot say 400 Bad Request when trying to abort the game: https://lichess.org/api/bot/game/jOFDwY6j/abort

If I log in to my bot's Lichess account and try to resign the game via the UI, the orange 'resign' flag is unresponsive.

@greg-finley
Copy link
Contributor Author

Looks like the offending bot has 25 such open games

@tors42
Copy link
Contributor

tors42 commented May 16, 2024

It is possible to set rules for the game when sending the challenge,
https://lichess.org/api#tag/Challenges/operation/challengeCreate

If the challenge contains the rule noAbort,
that would currently lead to this behaviour...

So one way to avoid the problem,
is to decline / not accept the challenge if it contains the rule noAbort

And possibly it doesn't make sense for BOTs to play games with the rule noAbort,
so maybe that rule could be disabled for BOT challenges in some future update...

Example of incoming challenge with noAbort rule
{
  "type": "challenge",
  "challenge": {
    "id": "CmcSdfd6",
    "url": "http://localhost:8080/CmcSdfd6",
    "status": "created",
    "challenger": {
      "id": "ana",
      "name": "Ana",
      "rating": 1739,
      "title": null,
      "online": true,
      "lag": 4
    },
    "destUser": {
      "id": "bot0",
      "name": "Bot0",
      "rating": 1500,
      "title": "BOT",
      "provisional": true,
      "online": true
    },
    "variant": {
      "key": "standard",
      "name": "Standard",
      "short": "Std"
    },
    "rated": false,
    "speed": "rapid",
    "timeControl": {
      "type": "clock",
      "limit": 600,
      "increment": 5,
      "show": "10+5"
    },
    "color": "random",
    "finalColor": "white",
    "perf": {
      "icon": "",
      "name": "Rapid"
    },
    "rules": [
      "noAbort"
    ]
  },
  "compat": {
    "bot": true,
    "board": true
  }
}

@greg-finley
Copy link
Contributor Author

Thanks @tors42 I thought about this as well. I saw that the main wrapper to make Lichess bots doesn't seem to pass noAbort, but who knows what the person who made this bot used. It seems unlikely they would have known to toggle on that option if they wrote the code on their own.

Also it would be interesting to retrieve the game rules via the API for these stuck games, but I don't think there's a way?

@kelseyde
Copy link

Cheers @tors42, I will look into that option in the future.

Do you have an idea if there's any way to terminate this ongoing game? My bot is stuck now in a loop of trying to abort, and can't start any new games.

Thanks,
Dan

@tors42
Copy link
Contributor

tors42 commented May 17, 2024

Do you have an idea if there's any way to terminate this ongoing game?

I don't know of any ways to terminate the game...

My bot is stuck now in a loop of trying to abort, and can't start any new games.

If you have implemented the Lichess client yourself, you could add some mechanism to ignore this specific game id or user, I.e not try to abort it and not try to connect to it to play it.

If you are using some library, you could check if the library has support to ignore games by id or by user, or some other mechanism.

It is allowed to have multiple ongoing games.

@skycloudd
Copy link

This also happened to my bot. https://lichess.org/xrTxLW8i/black

It would be extremely helpful if these games could somehow be aborted anyway. I think it's clear that this is harmful behaviour from the bot in question by starting many games like this and never playing a move.

Torom added a commit to Torom/BotLi that referenced this issue May 17, 2024
Torom added a commit to Torom/BotLi that referenced this issue May 17, 2024
… been made yet

This helps with lichess-org/lila#15318 even if such a game has already been started, simply put the opponent on the blacklist and the game will be ignored at the next start.
@Torom
Copy link

Torom commented May 17, 2024

I think the best first step would be to ban https://lichess.org/@/HaBaGuBot. He's obviously doing it on purpose.
Ideally, his games would be cancelled when he's banned.

@kelseyde
Copy link

Agreed, they have 80+ active games now, all of which are abandoned...

@greg-finley
Copy link
Contributor Author

Hmm now my original link is 404'ing and I have a thread back available, so I guess it takes care of itself after a while? Or someone intervened?

@kelseyde
Copy link

I got a notification saying someone I reported was banned, so it seems someone at Lichess intervened!

@greg-finley
Copy link
Contributor Author

Nice, though I still see the bot having many games hanging still (though not with my bot). 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants