Skip to content

feat(eval): multi-agent orchestration eval (loops, context loss, mis-… - #1050

Merged
AmitoVrito merged 6 commits into
SynapseKit:mainfrom
Premvkmishra:feat/orchestration-eval-983
Sep 18, 2026
Merged

AmitoVrito merged 6 commits into
SynapseKit:mainfrom
Premvkmishra:feat/orchestration-eval-983

Conversation

@Premvkmishra

Copy link
Copy Markdown
Contributor

Summary

Goal-level, orchestration-aware evaluation over a framework-agnostic RunGraph abstraction detecting three core failure modes: infinite handoff loops (LoopDetector), per-transfer context loss (ContextLossDetector), and non-deterministic mis-routing (MisroutingDetector).

Closes #983 (Epic #947, milestone v3.0)

Type of change

  • New feature

Changes

  • RunGraph Abstraction: RunNode & Transfer dataclasses adapted from HandoffResult (from_handoff_result) or Live event history (from_events).
  • Detectors:
    • LoopDetector: Exact periodic cycles + stalled input similarity (>= 0.92).
    • ContextLossDetector: Extracted factual span tracking (retention threshold 0.7) + opt-in LLMContextLossJudge.
    • MisroutingDetector: Target modal distribution across goals & golden route matching.
  • Report & Live Wiring: OrchestrationEvalReport (JSON/Markdown) & OrchestrationEvaluator.evaluate_and_publish() wired to SynapseKit Live bus (🧭 icon + story line).
  • Fixtures & CI: 4 deterministic fixtures (including false-positive-free healthy fixture), 17 unit tests (zero mocks), orchestration-eval-gate CI job, and examples/orchestration_eval.py.

Testing

  • All existing tests pass (uv run pytest tests/ -q)
  • New tests added for new behaviour (17 passed in 0.63s)
  • No API keys or secrets in the code

Documentation

  • Docstrings updated with Usage:: examples
  • CHANGELOG.md updated under ## [Unreleased]

Notes for reviewer

  • RunGraph is framework-agnostic (not tied to HandoffChain).
  • LLMContextLossJudge is opt-in and not constructed/invoked by default ContextLossDetector.
  • orchestration-eval-gate CI job uses deterministic structural fixtures with zero external network dependencies.

Premvkmishra and others added 6 commits September 18, 2026 23:18
…not position

Positional step_counter arithmetic (step_counter-2/-1) collapsed a handoff
into a self-loop whenever it wasn't sandwiched between exactly one node
event on each side, corrupting the graph fed to LoopDetector and
ContextLossDetector. Resolve source/target by matching agent name against
the nearest surrounding node events instead.

Co-authored-by: Premvkmishra <[email protected]>
- publish_graph() was only ever called with graph_list[0], silently
  dropping the dashboard snapshot for every other graph in a
  multi-run misrouting batch. Node/edge ids are run_id-prefixed, so
  combine every evaluated graph into one snapshot instead.
- evaluate_and_publish never called live._maybe_autostart(), unlike
  observe/runtime.py and dream/core.py. With SYNAPSEKIT_LIVE=1 as the
  only enabling signal in-process, bus.enabled stayed False and every
  publish() silently no-op'd.
- Narrow the wrapping `except Exception: pass` to `except ImportError`
  so real bugs in report/graph construction surface instead of being
  silently swallowed.

Co-authored-by: Premvkmishra <[email protected]>
RunGraph.from_handoff_result reads item["timestamp"]/item["context"]
from HandoffChain.run's history, but history entries never carried
those keys, so every RunNode.timestamp was silently None on the
primary production path. Stamp each history entry with a timestamp
(additive field); document that "context" has no equivalent in
HandoffChain today so ContextLossDetector falls back to text matching.

Co-authored-by: Premvkmishra <[email protected]>
LLMContextLossJudge was defined and exported but never invoked by
evaluate()/evaluate_and_publish, so constructing one had no effect
despite the PR description framing it as part of the detection story.
Add an optional llm_judge constructor param and an async evaluate_async()
that runs the judge over transfers the heuristic ContextLossDetector
didn't already flag, avoiding a double-charge on the same miss.

Co-authored-by: Premvkmishra <[email protected]>
Cycle spans are positional indices into agent_sequence() (sorted by
.step), but node lookup used nodes_by_step[step] keyed by raw .step
values. Non-contiguous step numbering silently dropped most nodes from
a detected cycle's node_ids. Index into the same sorted-by-step list
agent_sequence() derives from instead.

Co-authored-by: Premvkmishra <[email protected]>
@AmitoVrito
AmitoVrito merged commit 138eb0b into SynapseKit:main Sep 18, 2026
16 checks passed
@AmitoVrito

Copy link
Copy Markdown
Collaborator

Thanks for this one, Prem. Solid work on the RunGraph abstraction and the three detectors, and nice fixture coverage too. I pushed a few follow up fixes on top (the from_events self loop bug, the Live publish/autostart gaps, and wiring up LLMContextLossJudge) and merged. Appreciate the contribution, this is your third PR in now and it shows.

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.

Multi-agent orchestration eval (loops, context loss, mis-routing)

2 participants