fix(agent): export waits for complete workflow state#889
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR addresses a timing issue in YAML workflow exports by making the export process properly asynchronous. The main fix converts the getYaml() method in the YAML store from synchronous to asynchronous, ensuring it waits for complete YAML generation before returning content. This prevents premature exports that were occurring when users triggered exports before the workflow state was fully processed.
The core changes involve:
- YAML Store (
store.ts): ThegetYaml()method is now async and properly awaitsgenerateYaml()when data is stale, ensuring fresh YAML content is available before export - Export Controls Component: The
handleExportYamlfunction is converted to async/await pattern to properly wait for the YAML generation process - Environment Configuration: The
isDevconstant is hardcoded tofalse, disabling development-specific features across the application
The first two changes work together to fix the race condition where exports could happen before YAML generation completed via the /api/workflows/yaml/convert endpoint. The YAML store checks if cached content is stale (>1 second old) and refreshes it through an API call when needed. The export component was already designed to handle async operations, so the conversion to async/await integrates smoothly with existing error handling and loading states.
PR Description Notes:
- Several checklist items remain unchecked, including style guidelines, self-review, and testing requirements
Confidence score: 2/5
- This PR contains a critical unrelated change that will cause significant issues in development environments
- Score severely lowered due to the hardcoded
isDev = falsechange that disables all development features regardless of NODE_ENV - The environment change appears unrelated to the stated bug fix and could break development workflows, debugging, and logging
3 files reviewed, no comments
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
* Fix yaml export race condition * Fix env.ts dev
* Fix yaml export race condition * Fix env.ts dev
Summary
Export waits for complete workflow state (fixes premature/empty exports)
Type of Change
Testing
Manual testing
Checklist