generateEngineOutputCleanup generates the workspace cleanup step for engine-declared output files. It does NOT upload an artifact — paths are added to the unified agent artifact instead.
(yaml *strings.Builder, engine CodingAgentEngine)
| 74 | // generateEngineOutputCleanup generates the workspace cleanup step for engine-declared output |
| 75 | // files. It does NOT upload an artifact — paths are added to the unified agent artifact instead. |
| 76 | func (c *Compiler) generateEngineOutputCleanup(yaml *strings.Builder, engine CodingAgentEngine) { |
| 77 | outputFiles := engine.GetDeclaredOutputFiles() |
| 78 | if len(outputFiles) == 0 { |
| 79 | engineOutputLog.Print("No engine output files to clean up") |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | engineOutputLog.Printf("Generating engine output cleanup for %d files", len(outputFiles)) |
| 84 | |
| 85 | // Add cleanup step to remove workspace output files after they have been collected. |
| 86 | // Only files outside /tmp/gh-aw/ need explicit removal. |
| 87 | cleanupYaml, hasCleanup := generateCleanupStep(outputFiles) |
| 88 | if hasCleanup { |
| 89 | yaml.WriteString(cleanupYaml) |
| 90 | } |
| 91 | } |