Skip to content

fix: escalation memory spans render wrong type and empty results#963

Merged
mjnovice merged 2 commits into
mainfrom
fix/escalation-memory-span-rendering
Jul 2, 2026
Merged

fix: escalation memory spans render wrong type and empty results#963
mjnovice merged 2 commits into
mainfrom
fix/escalation-memory-span-rendering

Conversation

@mjnovice

@mjnovice mjnovice commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Customer feedback (Schneider, via #dev-agent-memory): the escalation memory span in the execution trace shows type "Dynamic few-shot" and nothing in the Results tab.

Root cause, verified against @uipath/traceview (2.45.0 and current traceview-ui main):

  1. The escalation lookup emitted an "Apply escalation memory" child span typed applyDynamicFewShot, borrowed from the episodic memory flow. The UI labels that type "Dynamic few-shot".
  2. The UI renderer for applyDynamicFewShot only displays episodic feedback items — it requires response.results[].feedback.comment. Escalation search results are shaped results[].answer.{output, outcome} (no feedback field ever), so the Results tab could never show anything.
  3. Latent bug: the "Save escalation memory" ingest span used kind agentMemoryWrite, which is not in the UI span-type registry and renders as type "N/A". The registered type is agentMemoryStore.

The LlmOps backend does not key any processing off these span kinds — this is purely a UI rendering contract.

Changes

  • Lookup: drop the applyDynamicFewShot child span and collapse onto the single "Find previous memories" span (agentMemoryLookup → renders as "Memory lookup"), now carrying request, response, fromMemory, memoryItemsMatched, and result. On a cache hit the cached answer also remains visible as the escalation tool span's own output.
  • Ingest: retype agentMemoryWriteagentMemoryStore ("Memory store"), and emit inputs/outputs attributes — exactly what the UI's default renderer displays in the Results tab — so the save span shows the persisted memory item and savedToMemory outcome.

Notes

With today's traceview there is no span type that renders escalation-memory matches in a dedicated Results tab (agentMemoryLookup is deliberately excluded from that tab, same as episodic lookups). Rich rendering of the matched item needs a small traceview-ui follow-up (e.g. a renderer for results[].answer or a new applyEscalationMemory type). This PR fixes the wrong label and the misleading empty tab within the current contract.

Testing

  • uv run pytest tests/agent/ — 1273 passed
  • uv run ruff check / ruff format --check / mypy on touched files — clean

🤖 Generated with Claude Code

The escalation memory lookup emitted an "Apply escalation memory" child
span typed applyDynamicFewShot, borrowed from the episodic memory flow.
The trace UI renders that type as "Dynamic few-shot" and its renderer
only displays episodic feedback items (response.results[].feedback),
which escalation results (results[].answer) never contain - so the
Results tab was always empty.

- Collapse the lookup into the single "Find previous memories" span
  (agentMemoryLookup, "Memory lookup" in the UI) carrying request,
  response, fromMemory, memoryItemsMatched, and result attributes.
- Retype the ingest span agentMemoryWrite -> agentMemoryStore; the
  former is not in the UI span-type registry and rendered as "N/A".
- Emit inputs/outputs on the ingest span so its Results tab shows the
  persisted memory item and savedToMemory outcome.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 01:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes how escalation-memory tracing spans are typed and populated so the Studio/traceview UI renders the correct span type labels and shows meaningful Results content for ingest operations. It aligns emitted span kinds and attributes with the current UI rendering contract, without changing backend behavior.

Changes:

  • Remove the applyDynamicFewShot child span from escalation lookup and consolidate lookup details onto the single agentMemoryLookup (“Memory lookup”) span.
  • Retype escalation ingest span from agentMemoryWrite to agentMemoryStore and emit inputs/outputs attributes so the UI Results tab can display persisted content and outcome.
  • Update escalation-memory tests to assert the new span structure, kinds, and attributes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/agent/tools/test_escalation_memory.py Updates span assertions to match the new lookup span shape and the ingest span kind/attributes (agentMemoryStore, inputs/outputs).
src/uipath_langchain/agent/tools/escalation_memory.py Adjusts tracing spans for escalation memory lookup/ingest to match UI span-type registry and renderer expectations.

@saksharthakkar

Copy link
Copy Markdown
Contributor

Do you need to bump up langchain version?

@mjnovice mjnovice enabled auto-merge (squash) July 2, 2026 17:13
@mjnovice mjnovice merged commit a986c45 into main Jul 2, 2026
47 checks passed
@mjnovice mjnovice deleted the fix/escalation-memory-span-rendering branch July 2, 2026 17:16
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants