salesforce / salesforce/evalon

EvaluatedAgent crashes on directConversations.head when an observer-only agent receives events

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Scala
Stars
0
Forks
3
Avg merge
1d 21h
Merged PRs (30d)
2

Description

Summary

If the evaluated participant is configured as an observer (listed in scenario.observations) but is not a direct party to any conversation (absent from every conversation's between list), its directConversations set is empty. When it then receives events, EvaluatedAgent calls directConversations.head on that empty set and throws NoSuchElementException. The actor dies under default supervision, no ParticipantFailed is sent, and the run degrades to an opaque TimeoutException instead of a clear error.

Reachability (verified by tracing)

  • There is no scenario validation in src/main — nothing prevents this configuration.
  • Observer mode is a supported, user-authored feature (Main branches on scenario.observations.nonEmpty).
  • When an observed conversation or event source emits, ScenarioRunner delivers Participant.ReceiveEvents(...) to the evaluated agent (ScenarioRunner.scala:208 and :272).
  • Both EvaluatedAgent handlers pick the response conversation via directConversations.head, which throws on an empty set:
    • EvaluatedAgent.scala:89 (idle ReceiveEvents handler)
    • EvaluatedAgent.scala:189 (generating success branch, None if pending.events.nonEmpty)

Impact

Low. Requires an unusual/arguably-malformed scenario (an agent that reacts to events but has no home conversation to respond in). It is pre-existing — not introduced by #8 — but surfaces as the same opaque-timeout failure mode that #8 set out to eliminate.

Suggested fix

Prefer scenario validation at load/startup over scattering empty-set guards at each .head. Fail fast with a clear message when a participant can receive events but belongs to no conversation (e.g. "participant X observes but has no conversation to respond in"). This both closes the crash and forces a design decision about where an observer-only agent should respond. The two .head call sites can then rely on the invariant.

Found during review of #8.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing observer handling from Main through ScenarioRunner.scala at lines 208 and 272, then inspect the two directConversations.head call sites in EvaluatedAgent.scala at lines 89 and 189. Check how scenarios are loaded and validated in src/main. Done should mean the observer-only configuration fails with a clear message instead of an actor crash and later TimeoutException.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.