-
Notifications
You must be signed in to change notification settings - Fork 34
Implement recursive import processing with BFS traversal for shared agentic workflows #3008
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
- Refactored ProcessImportsFromFrontmatterWithManifest to use queue-based BFS - Added cycle detection for cross-referenced imports - Maintains deterministic ordering through breadth-first traversal - Added comprehensive tests for recursive, cyclic, diamond, and ordering scenarios - Fixed import path resolution for nested imports (relative to base dir) - Updated validation to allow imports field in shared workflow files - All existing tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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 recursive import support for workflow files with BFS (Breadth-First Search) traversal, cycle detection, and improved validation. The changes enable workflow files to import other files that themselves contain imports, creating a hierarchical import structure.
Key Changes
- Added BFS-based recursive import processing with cycle detection in frontmatter parser
- Updated
isUnderWorkflowsDirectoryto correctly identify top-level workflow files vs. shared files in subdirectories - Added comprehensive test suite covering recursive imports, cyclic imports, diamond patterns, and import ordering
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/workflow/imports_recursive_test.go | New comprehensive test suite for recursive imports, cyclic dependencies, diamond patterns, and BFS ordering |
| pkg/parser/frontmatter_test.go | Updated test expectation for subdirectory file detection |
| pkg/parser/frontmatter.go | Implemented BFS-based recursive import processing with queue-based traversal and cycle detection; enhanced validation for imported files |
| .github/workflows/daily-news.lock.yml | Regenerated lock file reflecting new imports, Python data visualization support, and firewall configuration changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Resolve nested import path relative to the workflows directory, not the nested file's directory | ||
| nestedFullPath, err := resolveIncludePath(nestedFilePath, baseDir) |
Copilot
AI
Nov 2, 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.
[nitpick] The comment on line 542 states nested imports are resolved relative to the workflows directory, but this design decision may be problematic. In typical import systems, relative paths in nested files should be resolved relative to the importing file's directory, not the root. This inconsistency could confuse users and make it difficult to create reusable shared file hierarchies. Consider documenting this behavior prominently in user-facing documentation, or reconsider the design to support relative-to-file resolution.
The compiler only processed direct imports from workflow frontmatter, ignoring nested imports in shared files. This meant workflows importing shared files that themselves had imports would miss transitive dependencies.
Changes
Queue-based BFS traversal
ProcessImportsFromFrontmatterWithManifestimportQueueItemstruct to track import path, resolved path, section, and base directoryRecursive import discovery
imports:fieldImport path resolution
shared/trends.mdimportingshared/python-dataviz.mdlooked in wrong pathValidation relaxation
isUnderWorkflowsDirectoryto only flag top-level workflow filesimports:,mcp-servers:fieldsExample
Before (only direct imports processed):
After (recursive processing):
All three files are now correctly merged in BFS order: trends → python-dataviz.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.