Repository navigation
Closed
Propagate compile context into remote workflowspec resolution to make fetch/SHA calls cancellable#48481
Conversation
Co-authored-by: pelikhan <[email protected]>
Copilot
AI
changed the title
[WIP] Fix context.Background() to honour compile cancellation
Propagate compile context into remote workflowspec resolution to make fetch/SHA calls cancellable
Jul 28, 2026
pelikhan
marked this pull request as ready for review
July 28, 2026 02:35
Contributor
|
✅ Test Quality Sentinel completed test quality analysis. |
Contributor
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
Contributor
|
|
Contributor
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
Contributor
There was a problem hiding this comment.
Pull request overview
Threads compile context through remote workflowspec resolution to support cancellation for issue #48469.
Changes:
- Adds context-aware parser APIs while preserving existing wrappers.
- Propagates compiler context through imports and selected include paths.
- Adds cancellation propagation tests and WASM API parity.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/compiler_orchestrator_workflow.go |
Passes context to safe-output includes. |
pkg/workflow/compiler_orchestrator_engine.go |
Passes context through import and engine resolution. |
pkg/parser/remote_workflow_spec.go |
Uses propagated context for remote calls. |
pkg/parser/remote_resolve_path.go |
Adds context-aware path resolution. |
pkg/parser/remote_fetch_wasm.go |
Mirrors the new API for WASM. |
pkg/parser/remote_fetch_test.go |
Tests low-level context propagation. |
pkg/parser/remote_fetch_integration_test.go |
Updates integration calls with test context. |
pkg/parser/include_expander.go |
Threads context through field expansion. |
pkg/parser/import_topological.go |
Threads context through dependency resolution. |
pkg/parser/import_processor.go |
Adds a context-aware import entry point. |
pkg/parser/import_bfs.go |
Propagates context throughout import traversal. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
pkg/workflow/compiler_orchestrator_engine.go:238
- Cancellation from this resolution is treated as an unresolvable import by the warning/continue branch, so Ctrl+C merely skips the security scan and compilation proceeds. Return
ctx.Err()before applying the fail-open behavior intended for ordinary resolution failures.
fullPath, resolveErr := parser.ResolveIncludePathWithContext(ctx, importFilePath, markdownDir, importCache)
if resolveErr != nil {
orchestratorEngineLog.Printf("Skipping security scan for unresolvable import: %s: %v", importedFile, resolveErr)
fmt.Fprintf(os.Stderr, "WARNING: Skipping security scan for unresolvable import '%s': %v\n", importedFile, resolveErr)
continue
- Files reviewed: 11/11 changed files
- Comments generated: 3
- Review effort level: Medium
|
|
||
| // ResolveIncludePath resolves include path based on workflowspec format or relative path | ||
| func ResolveIncludePath(filePath, baseDir string, cache *ImportCache) (string, error) { | ||
| return ResolveIncludePathWithContext(context.Background(), filePath, baseDir, cache) |
| dependencies := make(map[string][]string, len(imports)) | ||
| for _, importPath := range imports { | ||
| nestedImports, err := resolveNestedImportPaths(importPath, baseDir, cache) | ||
| nestedImports, err := resolveNestedImportPaths(ctx, importPath, baseDir, cache) |
Comment on lines
+323
to
326
| fullPath, err := ResolveIncludePathWithContext(ctx, filePath, baseDir, nil) | ||
| if err != nil { | ||
| if directive.IsOptional { | ||
| return "", true, nil |
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compilation could continue through remote workflowspec network calls after cancellation because the parser path used
context.Background()for ref resolution and file download. This change threads the active compile context through those code paths so Ctrl+C can stop in-flight remote fetches.Parser: context-aware workflowspec resolution
downloadIncludeFromWorkflowSpecandresolveWorkflowSpecSHAForCacheto acceptcontext.Context.context.Background()usage with propagated context for:Parser APIs: backward-compatible context threading
ResolveIncludePathWithContextProcessImportsFromFrontmatterWithSourceWithContextExpandIncludesForEnginesWithContextExpandIncludesForSafeOutputsWithContextImport/include pipelines: end-to-end propagation
Compiler integration
c.ctxinto parser import/include resolution, removing uncancellable network hops during compile.