-
Notifications
You must be signed in to change notification settings - Fork 75
feat: switch cancel task to active/inactive tasks; add SetTaskActive; #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 implements a major architectural change replacing the irreversible "Canceled" task status with a reversible "Active/Inactive" toggle mechanism. This enables users to temporarily turn tasks off and reactivate them later without losing task definitions or history.
Key Changes:
- Replaces
TaskStatus_Canceled(enum value 3) withTaskStatus_Inactive(enum value 5) and renamesTaskStatus_ExecutingtoTaskStatus_Running(enum value 4) - Introduces new
SetTaskActiveRPC replacing the removedCancelTaskRPC, allowing explicit activation/deactivation control - Updates operator control messages from
MessageOp_CancelTasktoMessageOp_DeactivateTaskfor immediate operator notification
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| storage/schema/task.go | Updates storage key mapping: "l" (canceled) → "i" (inactive), "executing" comment → "running" |
| protobuf/node.proto | Renames MessageOp_CancelTask to MessageOp_DeactivateTask and updates comment references |
| protobuf/node.pb.go | Generated code reflecting MessageOp enum changes |
| protobuf/avs_grpc.pb.go | Generated gRPC code: replaces CancelTask method with SetTaskActive |
| protobuf/avs.proto | Defines new SetTaskActiveReq/Resp messages, removes CancelTaskResp, updates TaskStatus enum |
| protobuf/avs.pb.go | Generated code for new activation/deactivation messages and updated enums |
| operator/worker_loop_test.go | Updates test to use DeactivateTask operation |
| operator/worker_loop.go | Updates message processing to handle DeactivateTask instead of CancelTask |
| operator/process_message.go | Updates operator message handling for deactivation |
| model/user.go | Renames SmartWalletTaskStat.Canceled field to Inactive |
| model/task.go | Renames SetCanceled() method to SetInactive(), removes CompletedAt timestamp update |
| integration_test/orphaned_task_reclamation_test.go | Updates event trigger Topics structure from nested to flat array |
| integration_test/operator_reconnection_test.go | Updates Topics structure and node naming |
| integration_test/activation_deactivation_sync_test.go | New integration test verifying activation/deactivation synchronization flow |
| docs/ACTIVE_INACTIVE_TASK_STATUS_MIGRATION.md | Comprehensive migration documentation covering protocol changes, implementation, and rollout plan |
| core/taskengine/stats_test.go | Updates test assertions for Inactive field |
| core/taskengine/stats.go | Updates stats tracking to count Inactive tasks instead of Canceled |
| core/taskengine/operator_notification_test.go | Updates tests to verify DeactivateTask notifications and new response fields |
| core/taskengine/engine.go | Implements SetTaskActiveByUser replacing CancelTaskByUser, adds activation/deactivation logic with idempotency |
| core/apqueue/cleanup.go | Updates orphaned job cleanup to check for Inactive and Running statuses |
| aggregator/rpc_server.go | Replaces CancelTask RPC handler with SetTaskActive, updates overload handling to use deactivation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
…ge, tests; integration fixes
…#433) * chore: add plan for implementing active status * fix: switch to active/inactive tasks; add SetTaskActive; update operator/storage/tests * fix: active/inactive tasks; add SetTaskActive; update operator, storage, tests; integration fixes * fix: test failures caused by mock server
This pull request refactors task cancellation logic throughout the codebase to use a more general "active/inactive" status instead of the previous "canceled" status. The main effect is to allow tasks to be toggled between active and inactive states, improving clarity and flexibility in task management. The changes also update related APIs, logging, notifications, and tests to reflect this new approach.
Task status and API refactor:
CancelTaskByUsermethod is replaced withSetTaskActiveByUser, andCancelTaskwithDeactivateTask. [1] [2] [3] [4]Operator notification and event handling:
DeactivateTaskand the corresponding message type, replacing the previous "cancel" semantics. [1] [2] [3] [4] [5]Testing updates:
These changes modernize the task lifecycle management, making it more expressive and easier to extend in the future.
Note
Switches task cancellation to reversible active/inactive, introducing SetTaskActive RPC and DeactivateTask message, updating statuses, storage, engine/operator logic, and tests.
TaskStatus.Inactive; renameExecuting→Running.CancelTaskResp/CancelTaskwithSetTaskActiveReq/Respandrpc SetTaskActive.MessageOp_CancelTask→MessageOp_DeactivateTask.SetTaskActiveByUser(activate/deactivate with idempotency and guards); addDeactivateTaskfor alerts.SetTaskActiveand adjust overload handling (deactivate on alert).Running.DeactivateTask(remove checks); update worker loop and processing.ifor inactive,xfor running); stats/counts useInactiveinstead ofCanceled.docs/ACTIVE_INACTIVE_TASK_STATUS_MIGRATION.mdoutlining breaking changes.scripts/gh_job_logs.shCLI (positional JOB_ID, help).Written by Cursor Bugbot for commit 85b1997. Configure here.