Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# Change Log

## 2025-06-24 - Runtime v0.18.0
## 2025-06-24 - Runtime v0.18.1

- fix: subscribing to events should not be blocked by agent actor state [#910](https://github.com/hypermodeinc/modus/pull/910)

## 2025-06-23 - Runtime v0.18.0

NOTE: These notes are inclusive of all preview releases in the v0.18.0 series.

Expand Down Expand Up @@ -38,7 +42,7 @@ Other items:
- fix: time zone retrieval and logging [#906](https://github.com/hypermodeinc/modus/pull/906)
- fix: update dockerfile to include legacy time zones [#909](https://github.com/hypermodeinc/modus/pull/909)

## 2025-06-24 - Go SDK v0.18.0
## 2025-06-23 - Go SDK v0.18.0

NOTE: These notes are inclusive of all preview releases in the v0.18.0 series.

Expand All @@ -62,7 +66,7 @@ Other items:
- feat: return user and chat errors in API response [#863](https://github.com/hypermodeinc/modus/pull/863)
- feat: delete collections features [#872](https://github.com/hypermodeinc/modus/pull/872)

## 2025-06-24 - AssemblyScript SDK v0.18.0
## 2025-06-23 - AssemblyScript SDK v0.18.0

NOTE: These notes are inclusive of all preview releases in the v0.18.0 series.

Expand Down
16 changes: 12 additions & 4 deletions runtime/actors/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,18 @@ func GetAgentInfo(ctx context.Context, agentId string) (*AgentInfo, error) {
}, nil
}

// If the actor is not found, or if the request timed out, we can check the database for the agent state.
// This is useful for agents that are terminated or suspended, or just busy processing another request.
if errors.Is(err, goakt.ErrActorNotFound) || errors.Is(err, goakt.ErrRequestTimeout) {
return getAgentInfoFromDatabase(ctx, agentId)
// If the actor is not responding, we can check the database for the agent state.
// This is useful for agents that are still starting, are terminated or suspended, or just busy processing another request.
allowedErrs := []error{
goakt.ErrActorNotFound,
goakt.ErrRequestTimeout,
goakt.ErrRemoteSendFailure,
goakt.ErrDead,
}
for _, r := range allowedErrs {
if errors.Is(err, r) {
return getAgentInfoFromDatabase(ctx, agentId)
}
}

return nil, fmt.Errorf("error getting agent info: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion runtime/actors/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func SubscribeForAgentEvents(ctx context.Context, agentId string, update func(da
span, ctx := utils.NewSentrySpanForCurrentFunc(ctx)
defer span.Finish()

if a, err := GetAgentInfo(ctx, agentId); err != nil {
// Go directly to the database for the agent status, because we don't want subscribing to events to fail
// if there is any issue with the agent actor.
if a, err := getAgentInfoFromDatabase(ctx, agentId); err != nil {
return err
} else if a.Status == AgentStatusStopping || a.Status == AgentStatusTerminated {
return fmt.Errorf("agent %s is %s, cannot subscribe to events", agentId, a.Status)
Expand Down
Loading