Skip to content

Fix kernel container_id attribute shadowed by UserDict data dict in agent #9683

@fregataa

Description

@fregataa

AbstractKernel inherits from UserDict[str, Any], causing a mismatch between the instance attribute and the internal UserDict data dict for container_id.

  • AbstractKernel.init initializes self.container_id = None as an instance attribute (kernel.py:232)

  • After container startup, agent.py:3066 calls self.kernel_registry[kernel_id].data.update(container_data), which only updates the UserDict data dict

  • Due to Python's attribute lookup order, the instance attribute takes precedence, so kernel_obj.container_id always returns None

  • repr(kernel_obj) uses UserDict.repr() which displays the data dict, so container_id appears to have a valid value

Impact: In collect_container_stat(), the condition kernel_obj.container_id is None evaluates to True, causing container stats collection to be skipped entirely.

Fix: Either sync the instance attribute after data.update(), or unify container_id access to always go through self.data.

JIRA Issue: BA-4891

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions