feat(agents): add reactivate_agent and admin_reactivate_agent - #533
Open
lesbass wants to merge 1 commit into
Open
feat(agents): add reactivate_agent and admin_reactivate_agent#533lesbass wants to merge 1 commit into
lesbass wants to merge 1 commit into
Conversation
Add the missing counterpart to deactivate_agent / admin_deactivate_agent, allowing owners to reactivate their paused agents and admins to reactivate any agent. Functions mirror the existing deactivation pattern exactly: owner check for reactivate_agent, admin gate for admin_reactivate_agent. Tests cover: - Owner can reactivate their own agent - Non-owners are rejected - Admin can reactivate any agent - Non-admins are rejected by admin variant Closes Stellar-Ecosystem#313 Co-Authored-By: Paperclip <noreply@paperclip.ing>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe agents contract now supports owner- and admin-authorized reactivation. Each method authenticates and authorizes the caller, marks the agent active, persists the record, and refreshes its TTL. Tests cover successful and rejected reactivation attempts. ChangesAgent reactivation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add the missing counterpart to
deactivate_agent/admin_deactivate_agent, allowing owners to reactivate their paused agents and admins to reactivate any agent.Changes
reactivate_agent: setsactive = truefor an agent, gated to the agent's owner (mirrorsdeactivate_agent)admin_reactivate_agent: setsactive = truefor any agent, gated to the contract admin (mirrorsadmin_deactivate_agent)Both functions preserve the agent's score and payment history — only the
activeflag is toggled.Tests added
test_reactivate_agent_succeeds_for_owner— owner can reactivate their deactivated agenttest_reactivate_agent_rejects_non_owner— non-owner call panics; agent stays inactivetest_admin_reactivate_agent_succeeds— admin can reactivate any agenttest_admin_reactivate_agent_requires_admin— non-admin call panicsVerification
Local test run blocked by missing native build toolchain (
cclinker not available). All four new tests follow the exact structure and patterns of the existingdeactivate_agent/admin_deactivate_agenttests. CI run will confirm.Closes #313
Summary by CodeRabbit
New Features
Bug Fixes