Skip to content

Commit c3ad56a

Browse files
mjnoviceclaude
andcommitted
fix: make span_id and trace_id required in _ingest_escalation_memory
These should not be nullable — the caller resolves them from OTel context before calling. Removed "unknown" fallbacks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3b54ae5 commit c3ad56a

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/uipath_langchain/agent/tools/escalation_tool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ async def _ingest_escalation_memory(
542542
memory_space_id: str,
543543
answer: str,
544544
attributes: str,
545-
span_id: str = "",
546-
trace_id: str = "",
545+
span_id: str,
546+
trace_id: str,
547547
folder_path: str | None = None,
548548
) -> None:
549549
"""Persist a resolved escalation outcome into memory.
@@ -559,8 +559,8 @@ async def _ingest_escalation_memory(
559559
from uipath.platform.memory import EscalationMemoryIngestRequest
560560

561561
request = EscalationMemoryIngestRequest(
562-
span_id=span_id or "unknown",
563-
trace_id=trace_id or "unknown",
562+
span_id=span_id,
563+
trace_id=trace_id,
564564
answer=answer,
565565
attributes=attributes,
566566
)

tests/agent/tools/test_escalation_memory.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ async def test_returns_none_on_failure(self, mock_uipath_cls: MagicMock) -> None
9292

9393

9494
class TestIngestEscalationMemory:
95-
@pytest.mark.asyncio
96-
async def test_noop_when_no_space_id(self) -> None:
97-
await _ingest_escalation_memory(None, answer="yes", attributes="{}")
98-
9995
@pytest.mark.asyncio
10096
@patch("uipath_langchain.agent.tools.escalation_tool.UiPath")
10197
async def test_calls_ingest(self, mock_uipath_cls: MagicMock) -> None:
@@ -104,7 +100,11 @@ async def test_calls_ingest(self, mock_uipath_cls: MagicMock) -> None:
104100
mock_sdk.memory.escalation_ingest_async = AsyncMock()
105101

106102
await _ingest_escalation_memory(
107-
"space-123", answer='{"approved": true}', attributes='{"input": "test"}'
103+
"space-123",
104+
answer='{"approved": true}',
105+
attributes='{"input": "test"}',
106+
span_id="abc123",
107+
trace_id="def456",
108108
)
109109

110110
mock_sdk.memory.escalation_ingest_async.assert_called_once()
@@ -119,4 +119,10 @@ async def test_graceful_on_failure(self, mock_uipath_cls: MagicMock) -> None:
119119
)
120120

121121
# Should not raise
122-
await _ingest_escalation_memory("space-123", answer="yes", attributes="{}")
122+
await _ingest_escalation_memory(
123+
"space-123",
124+
answer="yes",
125+
attributes="{}",
126+
span_id="abc123",
127+
trace_id="def456",
128+
)

0 commit comments

Comments
 (0)