Finding
PluginManager.emit_event appends a plugin to emitted_plugins inside the if resp["emitted"] block and then appends the same plugin again unconditionally. When a plugin reports emitted=True, callers receive duplicate plugin entries.
Why this matters
Consumers of emit_event may use the returned plugin list for observability, ordering, audit records, or follow-up logic. Duplicates make the returned result inaccurate even though the event was only emitted once.
Reproduction locked in tests
On the test-build branch:
uv run pytest tests/runtime/plugin/test_manager.py::test_emit_event_should_report_each_emitting_plugin_once -q
The test is marked xfail(strict=True) to document the current bug without modifying SDK source in the test-build branch.
Expected behavior
Each emitting plugin should appear once in emitted_plugins. Non-emitting plugins should not be appended.
Finding
PluginManager.emit_eventappends a plugin toemitted_pluginsinside theif resp["emitted"]block and then appends the same plugin again unconditionally. When a plugin reportsemitted=True, callers receive duplicate plugin entries.Why this matters
Consumers of
emit_eventmay use the returned plugin list for observability, ordering, audit records, or follow-up logic. Duplicates make the returned result inaccurate even though the event was only emitted once.Reproduction locked in tests
On the
test-buildbranch:The test is marked
xfail(strict=True)to document the current bug without modifying SDK source in the test-build branch.Expected behavior
Each emitting plugin should appear once in
emitted_plugins. Non-emitting plugins should not be appended.