warnPromptTmpPaths returns a non-empty advisory message when content contains tmp/ references that are not under /tmp/gh-aw/. Returns an empty string when no problematic patterns are found.
(content string)
| 63 | // /tmp/ references that are not under /tmp/gh-aw/. |
| 64 | // Returns an empty string when no problematic patterns are found. |
| 65 | func warnPromptTmpPaths(content string) string { |
| 66 | if !strings.Contains(content, tmpNeedle) { |
| 67 | return "" |
| 68 | } |
| 69 | // Walk every /tmp/ occurrence; warn as soon as one is not under /tmp/gh-aw/. |
| 70 | rest := content |
| 71 | for { |
| 72 | pos := strings.Index(rest, tmpNeedle) |
| 73 | if pos < 0 { |
| 74 | break |
| 75 | } |
| 76 | segment := rest[pos:] |
| 77 | if !strings.HasPrefix(segment, tmpSafePrefix) { |
| 78 | return "Prompt references /tmp/ directly. " + |
| 79 | "Use /tmp/gh-aw/agent/ as the root for all temporary files " + |
| 80 | "generated by the agent — its contents are uploaded as a run artifact." |
| 81 | } |
| 82 | rest = rest[pos+len(tmpNeedle):] |
| 83 | } |
| 84 | return "" |
| 85 | } |
| 86 | |
| 87 | // validatePromptTmpPaths emits an advisory warning when the workflow markdown body |
| 88 | // references /tmp/ or /tmp/gh-aw/ instead of the recommended /tmp/gh-aw/agent/ root. |
no outgoing calls