Skip to content

[test-build] PluginManager.emit_event reports emitted plugins twice #64

@huanghuoguoguo

Description

@huanghuoguoguo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions