Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Phase 6: Remove dynamic attribute creation in NIM client
Cursor Agent0bab393c051a
diff --git a/providers/nvidia_nim/client.py b/providers/nvidia_nim/client.pyindex 199c1a50..8aaa58f3 100644--- a/providers/nvidia_nim/client.py+++ b/providers/nvidia_nim/client.py@@ -303,14 +303,6 @@ class NvidiaNimProvider(BaseProvider):# INTERCEPTION: Task args can stream in many partial chunks. Buffer until we# have valid JSON, then emit a single delta with run_in_background forced off.if current_name == "Task":- # Allow older tests to pass with MagicMock'd builders by lazily creating fields.- if not isinstance(getattr(sse.blocks, "task_arg_buffer", None), dict):- sse.blocks.task_arg_buffer = {}- if not isinstance(getattr(sse.blocks, "task_args_emitted", None), dict):- sse.blocks.task_args_emitted = {}- if not isinstance(getattr(sse.blocks, "tool_ids", None), dict):- sse.blocks.tool_ids = {}-if not sse.blocks.task_args_emitted.get(tc_index, False):buf = sse.blocks.task_arg_buffer.get(tc_index, "") + argssse.blocks.task_arg_buffer[tc_index] = buf@@ -336,14 +328,7 @@ class NvidiaNimProvider(BaseProvider):def _flush_task_arg_buffers(self, sse: Any):"""Emit buffered Task args as a single JSON delta (best-effort)."""- if not isinstance(getattr(sse.blocks, "task_arg_buffer", None), dict):- return- if not isinstance(getattr(sse.blocks, "task_args_emitted", None), dict):- sse.blocks.task_args_emitted = {}- if not isinstance(getattr(sse.blocks, "tool_ids", None), dict):- sse.blocks.tool_ids = {}- # Iterate over a copy; we will mutate dicts.- for tool_index, buf in list(getattr(sse.blocks, "task_arg_buffer", {}).items()):+ for tool_index, buf in list(sse.blocks.task_arg_buffer.items()):if sse.blocks.task_args_emitted.get(tool_index, False):sse.blocks.task_arg_buffer.pop(tool_index, None)continuediff --git a/tests/test_subagent_interception.py b/tests/test_subagent_interception.pyindex 58b2af1e..f05eae6f 100644--- a/tests/test_subagent_interception.py+++ b/tests/test_subagent_interception.py@@ -21,6 +21,9 @@ async def test_task_tool_interception():sse.blocks.tool_indices = {}sse.blocks.tool_names = {}sse.blocks.tool_started = {}+ sse.blocks.task_arg_buffer = {}+ sse.blocks.task_args_emitted = {}+ sse.blocks.tool_ids = {}# Tool call data (Task tool)tc = {