-
-
Notifications
You must be signed in to change notification settings - Fork 229
Prevent AutoRun Tasks From Saving Without Required Options #106
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
base: main
Are you sure you want to change the base?
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 prevents AutoRun tasks from being saved when required module options are missing, ensuring agents start with complete configurations and avoiding connection failures.
Key Changes:
- Added validation logic to detect modules with missing required options before saving
- Updated the options dialog to use
GeneralFormcomponent with proper form validation - Refactored the UI layout to improve spacing and alignment of module controls
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return Object.entries(module.options) | ||
| .filter( | ||
| ([key, option]) => option.required === true && key.toLowerCase() !== "agent", |
Copilot
AI
Nov 28, 2025
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.
The hardcoded lowercase comparison with 'agent' is used in multiple places (lines 336, 344, 360). Consider extracting this as a constant or helper function to improve maintainability and ensure consistency.
| this.dialogOptions = null; | ||
| }, | ||
| cloneModuleOptions(options) { | ||
| const cloned = JSON.parse(JSON.stringify(options || {})); |
Copilot
AI
Nov 28, 2025
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.
Using JSON.parse(JSON.stringify()) for deep cloning can be inefficient for large objects and doesn't handle non-JSON-serializable values. Consider using a dedicated cloning utility or the structured clone algorithm if available.
| return cloned; | ||
| }, | ||
| applyFormValuesToOptions(options, formValues) { | ||
| const updatedOptions = JSON.parse(JSON.stringify(options)); |
Copilot
AI
Nov 28, 2025
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.
Using JSON.parse(JSON.stringify()) for deep cloning can be inefficient for large objects and doesn't handle non-JSON-serializable values. Consider using a dedicated cloning utility or the structured clone algorithm if available.
| return; | ||
| } | ||
| const isValid = this.$refs.generalform?.$refs.form.validate?.(); |
Copilot
AI
Nov 28, 2025
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.
The nested ref access $refs.generalform?.$refs.form.validate?.() is fragile and tightly coupled to the internal structure of GeneralForm. Consider exposing a validation method directly on GeneralForm's interface.
| const isValid = this.$refs.generalform?.$refs.form.validate?.(); | |
| const isValid = this.$refs.generalform?.validate?.(); |
🛠 Fix:
Previously, AutoRun tasks could be saved even when one or more required options were missing. This resulted in agents starting up with incomplete module configurations, ultimately causing the agent to fail to connect.
This PR updates the
saveAutorunTasks()logic to validate all modules before saving.If any AutoRun module is missing required options, the save action is blocked and a descriptive error is shown to the user.
✔ What’s Changed
🚫 Example Error
✅ Outcome
This ensures that users cannot save incomplete AutoRun configurations and avoids agent connection failures caused by missing required module options.