Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit d931945

Browse files
fix: check topic actor status before publishing events (#918)
1 parent a2f2e3f commit d931945

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
NOTE: all releases may include dependency updates, not specifically mentioned
66

7+
UNRELEASED
8+
9+
- fix: check topic actor status before publishing events [#918](https://github.com/hypermodeinc/modus/pull/918)
10+
711
## 2025-06-25 - Runtime v0.18.2
812

913
- fix: validate inference history is valid json [#916](https://github.com/hypermodeinc/modus/pull/916)

runtime/actors/agents.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ func PublishAgentEvent(ctx context.Context, agentId, eventName string, eventData
267267
}
268268

269269
topicActor := _actorSystem.TopicActor()
270+
if !topicActor.IsRunning() {
271+
// If the topic actor is not running, we cannot publish the event.
272+
// This can happen during shutdown if the topic actor is stopped before the agent actors.
273+
logger.Warn(ctx).Str("event", eventName).Any("data", eventData).Msg("Topic actor is not running. Cannot publish event.")
274+
return nil
275+
}
270276

271277
// if the pid is in context, we're being called as a host function
272278
if pid, ok := ctx.Value(pidContextKey{}).(*goakt.PID); ok {

0 commit comments

Comments
 (0)