Skip to content

pulling updates to lichess bot code#1

Open
berty38 wants to merge 978 commits into
berty38:masterfrom
lichess-bot-devs:master
Open

pulling updates to lichess bot code#1
berty38 wants to merge 978 commits into
berty38:masterfrom
lichess-bot-devs:master

Conversation

@berty38

@berty38 berty38 commented Oct 15, 2021

Copy link
Copy Markdown
Owner

No description provided.

MarkZH and others added 30 commits October 13, 2024 14:51
* Catch PGN writing error so queue doesn't stop

* Make sure task_done() is called consistently

* Delete extra task_done() call
* Delay downloading engines until needed

Also,

- Since the Sjeng site seems unreliable recently, skip the test if the
download fails.
- Use a local logger instead of the one from lichess_bot.

* Delay downloading the opening book until needed

* Use exceptions for engine download errors

* Skip tests when engine dowloads fail

* Spacing

* Skip tests that can't be run

* Add time for downloading engines

* Download stockfish in test_homemade()

In case the tests are run in a different order.

* Download stockfish in lichess_org_simulator()

Since stockfish is used as the opponent in all engine tests, make sure
it exists in case the tests are run in a different order.
Bumps [mypy](https://github.com/python/mypy) from 1.11.2 to 1.12.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.11.2...v1.12.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [types-requests](https://github.com/python/typeshed) from 2.32.0.20240914 to 2.32.0.20241016.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [mypy](https://github.com/python/mypy) from 1.12.0 to 1.12.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.12.0...v1.12.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [rich](https://github.com/Textualize/rich) from 13.9.2 to 13.9.3.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](Textualize/rich@v13.9.2...v13.9.3)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [mypy](https://github.com/python/mypy) from 1.12.1 to 1.13.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.12.1...v1.13.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [rich](https://github.com/Textualize/rich) from 13.9.3 to 13.9.4.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](Textualize/rich@v13.9.3...v13.9.4)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix a copy-paste error.
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 8.3.4.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@8.3.3...8.3.4)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [flake8-markdown](https://github.com/johnfraney/flake8-markdown) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/johnfraney/flake8-markdown/releases)
- [Commits](johnfraney/flake8-markdown@v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: flake8-markdown
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
actions-user and others added 30 commits March 24, 2026 02:32
Updates the requirements on [requests](https://github.com/psf/requests) to permit the latest version.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.0...v2.33.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [types-requests](https://github.com/python/typeshed) to permit the latest version.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-version: 2.33.0.20260327
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.19.0...v1.20.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 1.20.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [rich](https://github.com/Textualize/rich) to permit the latest version.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](Textualize/rich@v14.3.0...v15.0.0)

---
updated-dependencies:
- dependency-name: rich
  dependency-version: 15.0.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.20.0...v2.1.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 2.1.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [requests](https://github.com/psf/requests) to permit the latest version.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.33.0...v2.34.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.34.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

* Reconnect control stream on network errors instead of terminating

When watch_control_stream catches an exception (e.g. read timeout or
TCP CLOSE_WAIT without clean EOF), it previously broke out of the
reconnect loop and sent a "terminated" event, triggering a full
10-second bot restart. Any transient network error therefore took the
bot offline for 10+ seconds.

Now the exception is logged at WARNING level and the loop continues
immediately (with a 1-second backoff), so the control stream reconnects
without interrupting active games or requiring a process restart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove unused variable in watch_control_stream

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Address review: drop redundant terminated check and unused error field

The `if stop.terminated: break` inside the except branch is redundant —
the surrounding `while not stop.terminated` already exits on the next
iteration. Remove it.

The `error` field in the "terminated" message is always None now that
exceptions are handled by reconnecting, so drop the field and the
matching `logger.debug` that read it.

---------

Co-authored-by: Tobias Brendler <tbrendler@icloud.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
Return immediately when matchmaking cannot pick an opponent, avoiding the misleading 'Will challenge None' log line.

Validation: python3 -m py_compile lichess-bot/lib/matchmaking.py
Treat generic 429 responses from the challenge endpoint as bot rate limits, honoring Retry-After when present and otherwise using bounded exponential backoff. Also prevent expired outgoing challenges from bypassing the local challenge rate-limit timer.

Validation:
- python3 -m py_compile lib/lichess.py lib/matchmaking.py test_bot/test_lichess.py test_bot/test_matchmaking.py
- python -m ruff check lib/lichess.py lib/matchmaking.py test_bot/test_lichess.py test_bot/test_matchmaking.py
- python -m pytest test_bot/test_lichess.py::test_challenge_429_without_ratelimit_body_sets_bot_rate_limit test_bot/test_lichess.py::test_challenge_429_without_retry_after_uses_exponential_backoff test_bot/test_matchmaking.py::test_should_create_challenge_respects_rate_limit_when_previous_challenge_expired
… list (#1215)

I and some other engine devs got caught out by this - setting
include_challenge_block_list but still having engines make challenges to
blocked bots.
Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@9.0.0...9.1.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.1.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.