Skip to content

fix: preserve replacement session waiter on cleanup - #10166

Open
iuiu-py wants to merge 1 commit into
AstrBotDevs:masterfrom
iuiu-py:fix/9996-session-waiter-ownership
Open

iuiu-py wants to merge 1 commit into
AstrBotDevs:masterfrom
iuiu-py:fix/9996-session-waiter-ownership

Conversation

@iuiu-py

@iuiu-py iuiu-py commented Sep 21, 2026

Copy link
Copy Markdown

Modifications

Test Results

  • Red: uv run pytest tests/test_session_waiter.py -q failed before the fix because cleanup removed the replacement waiter (KeyError: same-session).
  • Green: after the fix, the same command passes with 2 passed.
  • uv run ruff format astrbot/core/utils/session_waiter.py tests/test_session_waiter.py completed; focused uv run ruff check ... passed.

Checklist

  • This is NOT a breaking change.
  • My changes have been well-tested, and verification commands/results are provided above.
  • No WebUI navigation or terminology changed, so no WebUI documentation update is needed.
  • No new dependencies are introduced.
  • My changes do not introduce malicious code.

Summary by Sourcery

Preserve replacement session waiters when cleaning up superseded registrations.

Bug Fixes:

  • Prevent stale session waiters from removing a newer waiter registered for the same session during cleanup.

Tests:

  • Add regression tests covering stale-waiter cleanup and cleanup by the current session owner.

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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.

[Bug] 同一 session 注册新等待器后,旧 SessionWaiter 结束会删除新等待器

1 participant