Skip to content

fix(agent): export waits for complete workflow state#889

Merged
Sg312 merged 2 commits intostagingfrom
fix/yaml-export-await
Aug 6, 2025
Merged

fix(agent): export waits for complete workflow state#889
Sg312 merged 2 commits intostagingfrom
fix/yaml-export-await

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Aug 6, 2025

Summary

Export waits for complete workflow state (fixes premature/empty exports)

Type of Change

  • Bug fix

Testing

Manual testing

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. YAML Store (store.ts): The getYaml() method is now async and properly awaits generateYaml() when data is stale, ensuring fresh YAML content is available before export
  2. Export Controls Component: The handleExportYaml function is converted to async/await pattern to properly wait for the YAML generation process
  3. Environment Configuration: The isDev constant is hardcoded to false, 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 = false change 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

Edit Code Review Bot Settings | Greptile

@vercel
Copy link

vercel bot commented Aug 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ❌ Failed (Inspect) Aug 6, 2025 6:24pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Aug 6, 2025 6:24pm

@vercel vercel bot temporarily deployed to Preview – docs August 6, 2025 18:14 Inactive
@Sg312 Sg312 merged commit 05e689b into staging Aug 6, 2025
4 of 5 checks passed
waleedlatif1 pushed a commit that referenced this pull request Aug 7, 2025
* Fix yaml export race condition

* Fix env.ts dev
@waleedlatif1 waleedlatif1 deleted the fix/yaml-export-await branch August 8, 2025 07:34
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* Fix yaml export race condition

* Fix env.ts dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants