Skip to content

[Fix] Metadata in agents is unset before setting the field - #630

Merged
DaemonLoki merged 4 commits into
mainfrom
fix-metadata-customdata-unset
Aug 14, 2026
Merged

[Fix] Metadata in agents is unset before setting the field#630
DaemonLoki merged 4 commits into
mainfrom
fix-metadata-customdata-unset

Conversation

@DaemonLoki

Copy link
Copy Markdown
Contributor

Why

  • when setting the metadata for e.g. a realtime model the TTS and STT fields were partially set
  • this was wrong and therefore the FE would also show that information

Changes

  • clear the field before setting the specific values for this exact agent

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e318891-4f8c-4b26-82bb-e6f5378002e3

📥 Commits

Reviewing files that changed from the base of the PR and between 4508d7a and f2ffe8f.

📒 Files selected for processing (1)
  • plugins/getstream/tests/test_stream_edge_transport.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/getstream/tests/test_stream_edge_transport.py

📝 Walkthrough

Walkthrough

The change centralizes managed component metadata keys and resets them to None during agent authentication before applying current metadata. It preserves unrelated custom metadata and replaces stale component values. It also updates _merge_user to unset None custom fields, exclude them from update values, and omit them from fallback user creation. Tests cover both authentication behavior and Stream user updates.

Merge Risk: 🟡 Moderate · up to f2ffe

The PR clears metadata before assigning agent-specific values, but existing custom values can still overwrite the reset and current metadata, allowing stale TTS/STT information to remain visible. This correctness gap should be fixed or explicitly accepted before merge.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
agents-core/vision_agents/core/agents/agents.py (1)

859-863: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Prevent custom fields from overriding managed metadata.

**self.agent_user.custom is applied last. If it contains a key from _COMPONENT_METADATA_KEYS, it overwrites the reset and the current self.components_metadata. A reused agent user can still publish stale component metadata.

Merge existing custom fields first, then apply the reset and current metadata. Set is_agent last. Add a regression test with a pre-populated managed key.

This is required by the PR objective: clear stale component metadata before applying current metadata.

Proposed fix
                 self.agent_user.custom = {
+                    **self.agent_user.custom,
                     **dict.fromkeys(_COMPONENT_METADATA_KEYS),
                     **self.components_metadata,
                     **{"is_agent": True},
-                    **self.agent_user.custom,
                 }
🧹 Nitpick comments (2)
plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py (2)

362-363: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit annotations for the new locals.

Declare custom as dict[str, object] and unset as list[str].

Proposed annotation
-        custom = {key: value for key, value in user.custom.items() if value is not None}
-        unset = [key for key, value in user.custom.items() if value is None]
+        custom: dict[str, object] = {
+            key: value for key, value in user.custom.items() if value is not None
+        }
+        unset: list[str] = [
+            key for key, value in user.custom.items() if value is None
+        ]

As per coding guidelines, “Use type annotations everywhere.”

Source: Coding guidelines


358-379: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for both None custom-field paths.

Test removal of an existing custom field while preserving unrelated fields. Also test 404 fallback creation to confirm that null-valued fields are omitted.

The supplied test at plugins/getstream/tests/test_stream_edge_transport.py:126-148 covers only preservation of a non-null field. It would not detect regressions in either new path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7254e1e0-6411-466d-ac5c-ceb5229ecd4b

📥 Commits

Reviewing files that changed from the base of the PR and between a935f32 and 0d935e7.

📒 Files selected for processing (2)
  • agents-core/vision_agents/core/agents/agents.py
  • plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py

Comment thread agents-core/vision_agents/core/agents/agents.py

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/test_agents/test_agents.py (1)

453-453: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a return annotation to the new test.

Declare test_authenticate_clears_stale_managed_custom with -> None.
As per coding guidelines, **/*.py files must use type annotations everywhere.

Proposed change
-    async def test_authenticate_clears_stale_managed_custom(self):
+    async def test_authenticate_clears_stale_managed_custom(self) -> None:

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0638bdf9-bc1b-4fa4-afed-7b59fc328f89

📥 Commits

Reviewing files that changed from the base of the PR and between 0d935e7 and 4508d7a.

📒 Files selected for processing (4)
  • agents-core/vision_agents/core/agents/agents.py
  • plugins/getstream/tests/test_stream_edge_transport.py
  • plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py
  • tests/test_agents/test_agents.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/getstream/vision_agents/plugins/getstream/stream_edge_transport.py
  • agents-core/vision_agents/core/agents/agents.py

Comment thread plugins/getstream/tests/test_stream_edge_transport.py Outdated
@Nash0x7E2 Nash0x7E2 self-assigned this Aug 13, 2026
@DaemonLoki
DaemonLoki merged commit 674ed28 into main Aug 14, 2026
9 checks passed
@DaemonLoki
DaemonLoki deleted the fix-metadata-customdata-unset branch August 14, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants