This repository was archived by the owner on Sep 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: address agent lifecycle issues #881
Merged
mattjohnsonpint
merged 4 commits into
main
from
mjp/hyp-3472-error-stopping-modus-agent-while-its-suspended
Jun 11, 2025
Merged
fix: address agent lifecycle issues #881
mattjohnsonpint
merged 4 commits into
main
from
mjp/hyp-3472-error-stopping-modus-agent-while-its-suspended
Jun 11, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
This comment was marked as outdated.
d2c4cc7 to
0286b1a
Compare
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR overhauls the agent lifecycle by centralizing lifecycle actions into a single event handler, refactors the Wasm agent actor to use discrete start/resume/suspend/stop methods with database-backed status updates, and adds a new UpdateAgentStatus helper in the DB layer.
- Introduce
handleEvent/handleMessageexports and remove separate activate/shutdown in Go and AssemblyScript SDKs - Refactor
wasmAgentActorto split lifecycle intostartAgent,resumeAgent,suspendAgent,stopAgent, and push status updates to the database - Add
UpdateAgentStatusinagentstate.goand tweak the wasm host config (WithSysNanosleep, disable passivation)
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/go/pkg/agents/agents.go | Replaced shutdownAgent, added handleEvent, improved Stop error handling |
| sdk/assemblyscript/src/assembly/exports.ts | Updated exports to use _modus_agent_handle_event |
| sdk/assemblyscript/src/assembly/agent.ts | Removed shutdownAgent, added handleEvent and lifecycle comments |
| runtime/wasmhost/wasmhost.go | Broke chain calls for clarity, added WithSysNanosleep |
| runtime/db/agentstate.go | Added UpdateAgentStatus, refactored DB update functions |
| runtime/actors/wasmagent.go | Refactored actor lifecycle into discrete methods and status updates |
| runtime/actors/agents.go | Updated actor spawning, StopAgent/getAgentInfo to use ensureAgentReady |
| runtime/actors/actorsystem.go | Disabled passivation to avoid premature actor shutdown |
| CHANGELOG.md | Added entry for agent lifecycle fixes |
| .trunk/configs/cspell.json | Added “Nanosleep” to spelling dictionary |
Comments suppressed due to low confidence (2)
runtime/db/agentstate.go:68
- The nil‐engine guard was removed, so if
GlobalModusDbEngineis nil this Upsert will panic or error. Consider re‐adding a check to skip or warn when the engine is unavailable.
gid, _, _, err := modusgraph.Upsert(ctx, GlobalModusDbEngine, state)
.trunk/configs/cspell.json:129
- [nitpick] The entry 'Nanosleep' may not match the lowercase
nanosleepnaming in code; consider aligning casing with the actual API name.
"Nanosleep",
Co-authored-by: Copilot <[email protected]>
kevinmingtarja
approved these changes
Jun 11, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note, I tested with passivation enabled for suspend/restore state changes. However, I disabled it at the end because there's still an open issue with long-running tasks.