Skip to content

Fix span/event normalization and multi-hop agent ownership - #33

Merged
91pavan merged 4 commits into
ioc-project:rt-normalizationfrom
91pavan:fix/rt-normalization
Nov 19, 2026
Merged

91pavan merged 4 commits into
ioc-project:rt-normalizationfrom
91pavan:fix/rt-normalization

Conversation

@91pavan

@91pavan 91pavan commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Make span and event normalization converge on the same execution graph,
independent of arrival order.

Previously, child calls arriving before their agent could remain disconnected.
MCP server-side tool spans also pointed to intermediate transport spans rather
than directly to agents. Participating services could become extra MAS nodes,
and arbitrary execution-graph nodes could be misclassified as Agents.

This change:

  • Backfills ownership and capability-use relationships when agents arrive.
  • Traverses transport ancestry, including sessionless MCP server spans.
  • Persists compact ancestry in private _NormalizationTrace records.
  • Merges provisional lifecycle events with authoritative completed spans.
  • Retains pending handoffs, offered/discovered tools and A2A message states.
  • Uses the originating application for MAS identity.
  • Declares graph nodes as Agents only when matched to observed agents.
  • Corrects Agent/Tool endpoint typing when both share an id.
  • Preserves earliest starts, latest completions and last-ending child boundaries.
  • Shares normalization logic between batch processing and the realtime worker.

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

- Backfill agent ownership regardless of record arrival order
- Merge lifecycle events with authoritative completed spans
- Preserve sessionless MCP/A2A ancestry in private trace context
- Correct MAS identity and reconcile graph nodes with observed agents
- Fix same-named Agent/Tool edge typing and session boundary timing
- Share reconciliation between batch normalization and the realtime worker

Signed-off-by: Pavan Sudheendra <pavan0591@gmail.com>
Signed-off-by: Pavan Sudheendra <pavan0591@gmail.com>
Signed-off-by: Pavan Sudheendra <pavan0591@gmail.com>
@91pavan
91pavan requested a review from a team as a code owner November 13, 2026 06:20
@91pavan
91pavan requested a review from manang November 13, 2026 12:28
@91pavan

91pavan commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Neo4j views must exclude private normalization metadata

The realtime normalizer at the moment persists _NormalizationTrace nodes in Neo4j to retain compact span ancestry, including sessionless transport spans. This allows ownership reconciliation when spans/events arrive out of order or the worker restarts.

These are internal bookkeeping records—not ontology entities or execution-graph nodes. Their presence does not change the KG ontology.

Unfiltered queries can expose them as disconnected nodes and inflate node counts. Update graph visualizations, entity counts, label selectors, and ontology exports to exclude them:

MATCH (n)
WHERE NOT n:_NormalizationTrace
RETURN n

For relationship-based views, exclude both endpoints:

MATCH (a)-[r]->(b)
WHERE NOT a:_NormalizationTrace
  AND NOT b:_NormalizationTrace
RETURN a, r, b

Since, this is a correlation state, maybe we can also persist them in worker memory. The trade-off being that it loses context on restart and is unsafe when run in a distributed setting.

Signed-off-by: Pavan Sudheendra <pavan0591@gmail.com>
@91pavan

91pavan commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Switched trace context to in-memory storage; ontology nodes and relationships still use Neo4j.

  • No _NormalizationTrace reads or writes.
  • Context lasts only for one worker/store instance — lost on restart and not shared across workers.
  • No cache expiry yet; memory grows with processed spans.

@91pavan
91pavan merged commit 196b579 into ioc-project:rt-normalization Nov 19, 2026
1 check passed
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.

1 participant