Repository navigation
fix(llm): drop nonexistent name from __all__ - #7894
Merged
Merged
Conversation
Member
|
please remove the test file, it doesn't add any value |
RealtimeSessionRestoredEvent is listed in llm.__all__ but no such class exists anywhere in the package (it never existed in any released version), so both `from livekit.agents.llm import *` and plain attribute access raise AttributeError on every supported Python. Remove the stale entry.
BlueX888
force-pushed
the
fix/stale-star-import-export
branch
from
October 17, 2026 08:03
7cd8996 to
b48552b
Compare
Contributor
Author
|
Thanks @davidzhao — done, the test file is removed. The branch is now just the one-line change dropping the nonexistent |
BlueX888
added a commit
to BlueX888/BlueX888
that referenced
this pull request
Oct 18, 2026
- 新增缺陷表行:livekit/agents #7892/#7893/#7895/#7896/#7899(直接提 PR)、 agno-agi/agno #11132(修复 #10271 已提交)、 PrefectHQ/fastmcp #5780/#5781/#5782/#5799/#5800/#5801/#5802(已提交,等待确认) - deer-flow #7002 状态补「已合并」(2026-10-17 合入) - deer-flow issue #5846 记为「已被上游修复」(#7020 合并后关闭) - NOTES 补 deer-flow#7002 与 livekit/agents#7894 的根因说明,贡献区刷新为 32 个已合并 PR - 缺陷统计随之刷新(214 条 / 35 仓库)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR fix?
livekit.agents.llm.__all__listedRealtimeSessionRestoredEvent, but no such class exists anywhere in the package —realtime.pyonly definesRealtimeSessionReconnectedEvent. The dangling entry breaks the module's public import surface:from livekit.agents.llm import *fails immediately, because a star import resolves every__all__name against the module:AttributeError: module 'livekit.agents.llm' has no attribute 'RealtimeSessionRestoredEvent'(the did-you-mean suggestion machinery has existed since Python 3.10, so all supported versions show it). A named import of the missing name instead raisesImportError: cannot import name ...on every Python version.from livekit.agents import llmfollowed byllm.RealtimeSessionRestoredEventraisesAttributeErrorat attribute-access time.Any user code doing a star import of the module — or tooling that consumes
__all__to enumerate the public API (docs generation, stub builders, linters) — hits this on currentmain.Root cause
The entry was born dangling:
RealtimeSessionReconnectedEventexists inrealtime.py, butRealtimeSessionRestoredEventnever existed in any released version (verified against the published 1.1.0–1.8.8 wheels — the name appears only as this__all__string), so the__all__entry was most likely a typo'd or placeholder name for its sibling that no import ever validated.__all__is a plain string list with no runtime check tying it to the module contents, so importinglivekit.agents.llmitself still succeeds and nothing flagged the entry; it only surfaces when the name is actually resolved.The fix
Remove the single stale
"RealtimeSessionRestoredEvent"entry from__all__inlivekit-agents/livekit/agents/llm/__init__.py. It is the only entry without a backing attribute — all 78 other exports resolve. A repo-wide search confirms the name appears nowhere else; the only occurrence was the stale__all__entry.Testing
Adds
tests/test_llm_exports.py:test_public_llm_exports_resolve— asserts every name inllm.__all__is a real attribute of the module (mirrors the existingtest_public_inference_exports_resolveintests/test_inference_utils.py), so any future stale, removed, or renamed export is caught, not just this one.test_llm_star_import_resolves_every_export— executesfrom livekit.agents.llm import *and checks every__all__name is bound.Both tests fail on
mainat the stale entry:and pass with this change. The surrounding llm unit tests (chat context, decisions, tools, fallback, cache breakpoints, inference utils, chat-item proto coverage, ...) still pass; the single failure in
tests/test_duplex_adapter.pyreproduces identically onmainwithout this change and is unrelated.