issue-handle-bug.lock.yml 131 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038
  1. # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"993e0443c856ddd2249e653a0a27f652075b694cc6bdc679ca462efa2e572680","body_hash":"072e3bd4457c2b0e1aecc8527b2664b1cb360a88d54bc81f2025bf5df9f61fd1","compiler_version":"v0.89.21","strict":true,"agent_id":"codex","agent_model":"gpt-5.6-luna","engine_versions":{"codex":"0.154.0"}}
  2. # gh-aw-manifest: {"version":1,"secrets":["CODEX_API_KEY","COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","OPENAI_API_KEY","PIXEL_API_KEY"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"924af5fdc64061cfbf66fb584c8b07e2ac230c60","version":"v0.89.21"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.28.23","digest":"sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.28.23@sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.23","digest":"sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.23@sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.28.23","digest":"sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.28.23@sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.25","digest":"sha256:9be0a86220e807a0ecc89e53d7453468f7a53fbc6b3d1efd2299025ffe01d086","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.25@sha256:9be0a86220e807a0ecc89e53d7453468f7a53fbc6b3d1efd2299025ffe01d086"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:11c2c544876cdbaffefe0f7f1283b74838c209654b4934a78e23ed11f750490f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:11c2c544876cdbaffefe0f7f1283b74838c209654b4934a78e23ed11f750490f"},{"image":"ghcr.io/github/github-mcp-server:v1.12.2","digest":"sha256:508a0857ec762b1ab1cece29193345b501fab1dd9d1228a7b617062954cecac6","pinned_image":"ghcr.io/github/github-mcp-server:v1.12.2@sha256:508a0857ec762b1ab1cece29193345b501fab1dd9d1228a7b617062954cecac6"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_me","get_pull_request","get_pull_request_comments","get_pull_request_diff","get_pull_request_files","get_pull_request_review_comments","get_pull_request_reviews","get_pull_request_status","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_pull_requests","list_releases","list_starred_repositories","list_tags","pull_request_read","search_code","search_issues","search_pull_requests","search_repositories"]},{"name":"safeoutputs","tools":["add_comment","add_labels","missing_data","missing_tool","noop","update_issue"]}]}
  3. # This file was automatically generated by gh-aw (v0.89.21). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
  4. #
  5. # ___ _ _
  6. # / _ \ | | (_)
  7. # | |_| | __ _ ___ _ __ | |_ _ ___
  8. # | _ |/ _` |/ _ \ '_ \| __| |/ __|
  9. # | | | | (_| | __/ | | | |_| | (__
  10. # \_| |_/\__, |\___|_| |_|\__|_|\___|
  11. # __/ |
  12. # _ _ |___/
  13. # | | | | / _| |
  14. # | | | | ___ _ __ _ __| |_| | _____ ____
  15. # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
  16. # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
  17. # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
  18. #
  19. #
  20. # To update this file, edit the corresponding .md file and run:
  21. # gh aw compile
  22. # Not all edits will cause changes to this file.
  23. #
  24. # For more information: https://github.github.com/gh-aw/introduction/overview/
  25. #
  26. # 处理分类为 bug 的 issue,进行深入分析并给出修复建议
  27. #
  28. # Resolved workflow manifest:
  29. # Imports:
  30. # - shared/engine.md
  31. # - shared/network.md
  32. #
  33. # Secrets used:
  34. # - CODEX_API_KEY
  35. # - COPILOT_GITHUB_TOKEN
  36. # - GH_AW_DEFAULT_OTLP_ENDPOINT
  37. # - GH_AW_DEFAULT_OTLP_HEADERS
  38. # - GH_AW_GITHUB_MCP_SERVER_TOKEN
  39. # - GH_AW_GITHUB_TOKEN
  40. # - GITHUB_TOKEN
  41. # - OPENAI_API_KEY
  42. # - PIXEL_API_KEY
  43. #
  44. # Custom actions used:
  45. # - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  46. # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  47. # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  48. # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
  49. # - actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  50. # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  51. # - github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  52. #
  53. # Container images used:
  54. # - ghcr.io/github/gh-aw-firewall/agent:0.28.23@sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2
  55. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.28.23@sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64
  56. # - ghcr.io/github/gh-aw-firewall/squid:0.28.23@sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0
  57. # - ghcr.io/github/gh-aw-mcpg:v0.4.25@sha256:9be0a86220e807a0ecc89e53d7453468f7a53fbc6b3d1efd2299025ffe01d086
  58. # - ghcr.io/github/gh-aw-node@sha256:11c2c544876cdbaffefe0f7f1283b74838c209654b4934a78e23ed11f750490f
  59. # - ghcr.io/github/github-mcp-server:v1.12.2@sha256:508a0857ec762b1ab1cece29193345b501fab1dd9d1228a7b617062954cecac6
  60. name: "Issue Handle Bug"
  61. on:
  62. workflow_call:
  63. inputs:
  64. aw_context:
  65. default: ""
  66. description: "Agent caller context (used internally by Agentic Workflows)."
  67. required: false
  68. type: string
  69. issue_number:
  70. required: true
  71. type: string
  72. payload:
  73. required: false
  74. type: string
  75. outputs:
  76. comment_id:
  77. description: ID of the first added comment
  78. value: ${{ jobs.safe_outputs.outputs.comment_id }}
  79. comment_url:
  80. description: URL of the first added comment
  81. value: ${{ jobs.safe_outputs.outputs.comment_url }}
  82. secrets:
  83. CODEX_API_KEY:
  84. required: false
  85. COPILOT_GITHUB_TOKEN:
  86. required: false
  87. GH_AW_DEFAULT_OTLP_ENDPOINT:
  88. required: false
  89. GH_AW_DEFAULT_OTLP_HEADERS:
  90. required: false
  91. GH_AW_GITHUB_MCP_SERVER_TOKEN:
  92. required: false
  93. GH_AW_GITHUB_TOKEN:
  94. required: false
  95. OPENAI_API_KEY:
  96. required: false
  97. PIXEL_API_KEY:
  98. required: false
  99. permissions: {}
  100. concurrency:
  101. group: "gh-aw-issue-handle-bug-${{ github.run_id }}"
  102. queue: max
  103. run-name: "Issue Handle Bug"
  104. env:
  105. OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT || vars.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  106. OTEL_SERVICE_NAME: gh-aw.issue-handle-bug
  107. OTEL_RESOURCE_ATTRIBUTES: 'gh-aw.workflow.name=Issue%20Handle%20Bug,gh-aw.repository=${{ github.repository }},gh-aw.run.id=${{ github.run_id }},github.run_id=${{ github.run_id }},gh-aw.engine.id=codex'
  108. OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  109. GH_AW_OTLP_ENDPOINTS: '[{"url":"${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT || vars.GH_AW_DEFAULT_OTLP_ENDPOINT }}","headers":"${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}"}]'
  110. GH_AW_OTLP_IF_MISSING: ignore
  111. jobs:
  112. activation:
  113. runs-on: ubuntu-slim
  114. permissions:
  115. actions: read
  116. contents: read
  117. issues: write
  118. env:
  119. GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }}
  120. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  121. outputs:
  122. artifact_prefix: ${{ steps.artifact-prefix.outputs.prefix }}
  123. comment_id: ""
  124. comment_repo: ""
  125. daily_ai_credits_exceeded: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_exceeded == 'true' }}
  126. daily_ai_credits_guardrail_error: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_error || '' }}
  127. daily_ai_credits_guardrail_status: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status || '' }}
  128. daily_ai_credits_threshold: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_threshold || '' }}
  129. daily_ai_credits_total: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_total || '' }}
  130. engine_id: ${{ steps.generate_aw_info.outputs.engine_id }}
  131. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  132. model: ${{ steps.generate_aw_info.outputs.model }}
  133. oauth_token_check_failed: ${{ steps.check-oauth-tokens.outputs.oauth_token_check_failed == 'true' }}
  134. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  135. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  136. setup-span-id: ${{ steps.setup.outputs.span-id }}
  137. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  138. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  139. target_checkout_ref: ${{ steps.resolve-host-repo.outputs.target_checkout_ref }}
  140. target_ref: ${{ steps.resolve-host-repo.outputs.target_ref }}
  141. target_repo: ${{ steps.resolve-host-repo.outputs.target_repo }}
  142. target_repo_name: ${{ steps.resolve-host-repo.outputs.target_repo_name }}
  143. steps:
  144. - name: Setup Scripts
  145. id: setup
  146. uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  147. with:
  148. destination: ${{ runner.temp }}/gh-aw/actions
  149. job-name: ${{ github.job }}
  150. safe-output-artifact-client: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  151. env:
  152. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Bug"
  153. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-bug.lock.yml@${{ github.ref }}
  154. GH_AW_INFO_VERSION: "0.154.0"
  155. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  156. GH_AW_INFO_ENGINE_ID: "codex"
  157. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  158. - name: Mask OTLP telemetry headers
  159. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  160. - name: Resolve host repo for activation checkout
  161. id: resolve-host-repo
  162. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  163. env:
  164. JOB_WORKFLOW_REPOSITORY: ${{ job.workflow_repository }}
  165. JOB_WORKFLOW_SHA: ${{ job.workflow_sha }}
  166. JOB_WORKFLOW_REF: ${{ job.workflow_ref }}
  167. JOB_WORKFLOW_FILE_PATH: ${{ job.workflow_file_path }}
  168. with:
  169. script: |
  170. const path = require('path');
  171. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  172. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  173. setupGlobals(core, github, context, exec, io, getOctokit);
  174. const { main } = require(path.join(actionsDir, 'resolve_host_repo.cjs'));
  175. await main();
  176. - name: Compute artifact prefix
  177. id: artifact-prefix
  178. env:
  179. INPUTS_JSON: ${{ toJSON(inputs) }}
  180. run: bash "${RUNNER_TEMP}/gh-aw/actions/compute_artifact_prefix.sh"
  181. - name: Generate agentic run info
  182. id: generate_aw_info
  183. env:
  184. GH_AW_INFO_ENGINE_ID: "codex"
  185. GH_AW_INFO_ENGINE_NAME: "Codex"
  186. GH_AW_INFO_MODEL: "gpt-5.6-luna"
  187. GH_AW_INFO_VERSION: "0.154.0"
  188. GH_AW_INFO_AGENT_VERSION: "0.154.0"
  189. GH_AW_INFO_CLI_VERSION: "v0.89.21"
  190. GH_AW_INFO_WORKFLOW_NAME: "Issue Handle Bug"
  191. GH_AW_INFO_EXPERIMENTAL: "false"
  192. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  193. GH_AW_INFO_STAGED: "false"
  194. GH_AW_INFO_ALLOWED_DOMAINS: '["ai-pixel.online","api-inference.modelscope.cn","api.commandcode.ai","api.deepseek.com","api.minimaxi.com","defaults","open.bigmodel.cn","opencode.ai"]'
  195. GH_AW_INFO_FIREWALL_ENABLED: "true"
  196. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  197. GH_AW_INFO_AWMG_VERSION: ""
  198. GH_AW_INFO_FIREWALL_TYPE: "squid"
  199. GH_AW_INFO_AGENT_RUNTIME: ""
  200. GH_AW_COMPILED_STRICT: "true"
  201. GH_AW_INFO_TARGET_REPO: ${{ steps.resolve-host-repo.outputs.target_repo }}
  202. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  203. with:
  204. script: |
  205. const path = require('path');
  206. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  207. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  208. setupGlobals(core, github, context, exec, io, getOctokit);
  209. const { main } = require(path.join(actionsDir, 'generate_aw_info.cjs'));
  210. await main(core, context);
  211. - name: Restore daily AIC scan observations
  212. id: restore-daily-aic-cache-fallback
  213. if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  214. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  215. env:
  216. GH_AW_HAS_SLASH_COMMAND: "false"
  217. GH_AW_HAS_LABEL_COMMAND: "false"
  218. with:
  219. github-token: ${{ secrets.GITHUB_TOKEN }}
  220. script: |
  221. const path = require('path');
  222. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  223. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  224. setupGlobals(core, github, context, exec, io, getOctokit);
  225. const { main } = require(path.join(actionsDir, 'restore_aic_scan_cache.cjs'));
  226. await main();
  227. - name: Check daily workflow token guardrail
  228. id: daily-ai-credits-workflow-guardrail
  229. if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  230. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  231. env:
  232. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  233. GH_AW_WORKFLOW_ID: "issue-handle-bug"
  234. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  235. GH_AW_WORKFLOW_DISPATCH_AW_CONTEXT: ${{ github.event.inputs.aw_context || '' }}
  236. GH_AW_HAS_SLASH_COMMAND: "false"
  237. GH_AW_HAS_LABEL_COMMAND: "false"
  238. GH_AW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  239. GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }}
  240. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  241. with:
  242. github-token: ${{ secrets.GITHUB_TOKEN }}
  243. script: |
  244. const path = require('path');
  245. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  246. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  247. setupGlobals(core, github, context, exec, io, getOctokit);
  248. const { main } = require(path.join(actionsDir, 'check_daily_aic_workflow_guardrail.cjs'));
  249. await main();
  250. - name: Publish daily AIC scan observations
  251. if: always() && env.GH_AW_MAX_DAILY_AI_CREDITS != ''
  252. continue-on-error: true
  253. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  254. with:
  255. name: aic-usage-scan-v2
  256. path: /tmp/gh-aw/agentic-workflow-usage-scan-v2.jsonl
  257. overwrite: true
  258. if-no-files-found: ignore
  259. retention-days: 3
  260. - name: Validate CODEX_API_KEY or OPENAI_API_KEY secret
  261. id: validate-secret
  262. run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" CODEX_API_KEY OPENAI_API_KEY Codex https://github.github.com/gh-aw/reference/engines/#openai-codex
  263. env:
  264. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  265. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  266. - name: Check for OAuth tokens
  267. id: check-oauth-tokens
  268. run: bash "${RUNNER_TEMP}/gh-aw/actions/check_oauth_tokens.sh"
  269. env:
  270. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  271. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  272. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  273. - name: Print cross-repo setup guidance
  274. if: failure() && steps.resolve-host-repo.outputs.target_repo != github.repository
  275. run: |
  276. echo "::error::COPILOT_GITHUB_TOKEN must be configured in the CALLER repository's secrets."
  277. echo "::error::For cross-repo workflow_call, secrets must be set in the repository that triggers the workflow."
  278. echo "::error::See: https://github.github.com/gh-aw/patterns/central-repo-ops/#cross-repo-setup"
  279. - name: Checkout .github and .agents folders
  280. if: steps.resolve-host-repo.outputs.target_repo == github.repository
  281. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  282. with:
  283. persist-credentials: false
  284. repository: ${{ steps.resolve-host-repo.outputs.target_repo }}
  285. ref: ${{ steps.resolve-host-repo.outputs.target_checkout_ref }}
  286. sparse-checkout: |
  287. .github
  288. .agents
  289. .claude
  290. .codex
  291. .gemini
  292. .pi
  293. sparse-checkout-cone-mode: true
  294. fetch-depth: 1
  295. - name: Save agent config folders for base branch restoration
  296. env:
  297. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  298. GH_AW_AGENT_FILES: "AGENTS.md"
  299. run: |
  300. bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh"
  301. - name: Check workflow lock file
  302. id: check-lock-file
  303. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  304. env:
  305. GH_AW_WORKFLOW_FILE: "issue-handle-bug.lock.yml"
  306. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  307. with:
  308. script: |
  309. const path = require('path');
  310. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  311. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  312. setupGlobals(core, github, context, exec, io, getOctokit);
  313. const { main } = require(path.join(actionsDir, 'check_workflow_timestamp_api.cjs'));
  314. await main();
  315. - name: Check compile-agentic version
  316. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  317. env:
  318. GH_AW_COMPILED_VERSION: "v0.89.21"
  319. GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "true"
  320. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  321. with:
  322. script: |
  323. const path = require('path');
  324. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  325. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  326. setupGlobals(core, github, context, exec, io, getOctokit);
  327. const { main } = require(path.join(actionsDir, 'check_version_updates.cjs'));
  328. await main();
  329. - name: Log runtime features
  330. if: ${{ contains(toJSON(vars), '"GH_AW_RUNTIME_FEATURES":') }}
  331. run: bash "${RUNNER_TEMP}/gh-aw/actions/log_runtime_features_summary.sh"
  332. - name: Create prompt with built-in context
  333. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  334. env:
  335. GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions
  336. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  337. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  338. GH_AW_PROMPT_CONFIG: "{\"items\":[{\"content_env\":\"GH_AW_PROMPT_CONTENT_0000\"},{\"file\":\"xpia.md\"},{\"file\":\"temp_folder_prompt.md\"},{\"file\":\"markdown.md\"},{\"file\":\"safe_outputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0001\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0002\"},{\"file\":\"mcp_cli_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0003\"},{\"file\":\"github_mcp_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0004\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0005\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0006\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0007\"}]}"
  339. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  340. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  341. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  342. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  343. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  344. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  345. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  346. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  347. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  348. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  349. GH_AW_PROMPT_CONTENT_0000: "<system>\n"
  350. GH_AW_PROMPT_CONTENT_0001: "<safe-output-tools>\nTools: add_comment, update_issue, add_labels(max:3), missing_tool, missing_data, noop\n"
  351. GH_AW_PROMPT_CONTENT_0002: "</safe-output-tools>\n"
  352. GH_AW_PROMPT_CONTENT_0003: "<github-context>\nThe following GitHub context information is available for this workflow:\n{{#if github.actor}}\n- **actor**: __GH_AW_GITHUB_ACTOR__\n{{/if}}\n{{#if github.repository}}\n- **repository**: __GH_AW_GITHUB_REPOSITORY__\n{{/if}}\n{{#if github.workspace}}\n- **workspace**: __GH_AW_GITHUB_WORKSPACE__\n{{/if}}\n{{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}}\n- **issue-number**: #__GH_AW_EXPR_802A9F6A__\n{{/if}}\n{{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}}\n- **discussion-number**: #__GH_AW_EXPR_1A3A194A__\n{{/if}}\n{{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}}\n- **pull-request-number**: #__GH_AW_EXPR_463A214A__\n{{/if}}\n{{#if github.event.comment.id || github.aw.context.comment_id}}\n- **comment-id**: __GH_AW_EXPR_FF1D34CE__\n{{/if}}\n{{#if github.run_id}}\n- **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__\n{{/if}}\n</github-context>\n\n"
  353. GH_AW_PROMPT_CONTENT_0004: "</system>\n"
  354. GH_AW_PROMPT_CONTENT_0005: "{{#runtime-import .github/workflows/shared/engine.md}}\n"
  355. GH_AW_PROMPT_CONTENT_0006: "{{#runtime-import .github/workflows/shared/network.md}}\n"
  356. GH_AW_PROMPT_CONTENT_0007: "{{#runtime-import .github/workflows/issue-handle-bug.md}}\n"
  357. with:
  358. script: |
  359. const { setupGlobals } = require(process.env.GH_AW_ACTIONS_DIR + '/setup_globals.cjs');
  360. setupGlobals(core, github, context, exec, io, getOctokit);
  361. const { main } = require(process.env.GH_AW_ACTIONS_DIR + '/create_prompt.cjs');
  362. await main(core);
  363. - name: Interpolate variables and render templates
  364. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  365. env:
  366. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  367. GH_AW_ENGINE_ID: "codex"
  368. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  369. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  370. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  371. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  372. with:
  373. script: |
  374. const path = require('path');
  375. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  376. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  377. setupGlobals(core, github, context, exec, io, getOctokit);
  378. const { main } = require(path.join(actionsDir, 'interpolate_prompt.cjs'));
  379. await main();
  380. - name: Substitute placeholders
  381. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  382. env:
  383. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  384. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  385. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  386. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  387. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  388. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  389. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  390. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  391. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  392. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  393. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  394. GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools'
  395. with:
  396. script: |
  397. const path = require('path');
  398. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  399. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  400. setupGlobals(core, github, context, exec, io, getOctokit);
  401. const substitutePlaceholders = require(path.join(actionsDir, 'substitute_placeholders.cjs'));
  402. // Call the substitution function
  403. return await substitutePlaceholders({
  404. file: process.env.GH_AW_PROMPT,
  405. substitutions: {
  406. GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A,
  407. GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A,
  408. GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A,
  409. GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE,
  410. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  411. GH_AW_GITHUB_EVENT_ISSUE_TITLE: process.env.GH_AW_GITHUB_EVENT_ISSUE_TITLE,
  412. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  413. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  414. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE,
  415. GH_AW_INPUTS_ISSUE_NUMBER: process.env.GH_AW_INPUTS_ISSUE_NUMBER,
  416. GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST
  417. }
  418. });
  419. - name: Validate prompt placeholders
  420. env:
  421. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  422. run: |
  423. bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh"
  424. - name: Print prompt
  425. env:
  426. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  427. run: |
  428. bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  429. - name: Upload info artifact
  430. if: success() || failure()
  431. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  432. with:
  433. name: ${{ steps.artifact-prefix.outputs.prefix }}info
  434. path: /tmp/gh-aw/aw_info.json
  435. if-no-files-found: ignore
  436. - name: Stage prompt files for artifact upload
  437. run: |
  438. mkdir -p /tmp/gh-aw/aw-prompts
  439. cp -a "${RUNNER_TEMP}/gh-aw/aw-prompts/." /tmp/gh-aw/aw-prompts/
  440. - name: Upload activation artifact
  441. if: success() || failure()
  442. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  443. with:
  444. name: ${{ steps.artifact-prefix.outputs.prefix }}activation
  445. include-hidden-files: true
  446. path: |
  447. /tmp/gh-aw/aw_info.json
  448. /tmp/gh-aw/models.json
  449. /tmp/gh-aw/aw-prompts/prompt.txt
  450. /tmp/gh-aw/aw-prompts/prompt-template.txt
  451. /tmp/gh-aw/aw-prompts/prompt-import-tree.json
  452. /tmp/gh-aw/github_rate_limits.jsonl
  453. /tmp/gh-aw/base
  454. /tmp/gh-aw/.codex/agents
  455. /tmp/gh-aw/.codex/skills
  456. if-no-files-found: ignore
  457. retention-days: 1
  458. agent:
  459. needs: activation
  460. if: needs.activation.outputs.daily_ai_credits_exceeded != 'true'
  461. runs-on: ubuntu-latest
  462. permissions:
  463. actions: read
  464. checks: read
  465. contents: read
  466. discussions: read
  467. issues: read
  468. pull-requests: read
  469. statuses: read
  470. concurrency:
  471. group: "gh-aw-codex-issue-handle-bug"
  472. queue: max
  473. timeout-minutes: 60
  474. env:
  475. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  476. GH_AW_ASSETS_ALLOWED_EXTS: ""
  477. GH_AW_ASSETS_BRANCH: ""
  478. GH_AW_ASSETS_MAX_SIZE_KB: 0
  479. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  480. GH_AW_PR_HEAD_BASE_BRANCH: ""
  481. GH_AW_PR_HEAD_BASE_PR_NUMBER: ""
  482. GH_AW_PR_HEAD_BASE_REF: ""
  483. GH_AW_PR_HEAD_BASE_REPO: ""
  484. GH_AW_PR_HEAD_BASE_SHA: ""
  485. GH_AW_PR_HEAD_REPO: ""
  486. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  487. GH_AW_WORKFLOW_ID_SANITIZED: issuehandlebug
  488. outputs:
  489. agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }}
  490. ai_credits_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.ai_credits_rate_limit_error || 'false' }}
  491. aic: ${{ steps.parse-token-usage.outputs.aic }}
  492. ambient_context: ${{ steps.parse-token-usage.outputs.ambient_context }}
  493. artifact_prefix: ${{ needs.activation.outputs.artifact_prefix }}
  494. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  495. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  496. http_400_response_error: ${{ steps.detect-agent-errors.outputs.http_400_response_error || 'false' }}
  497. inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }}
  498. invocation_cap_exceeded: ${{ steps.detect-agent-errors.outputs.invocation_cap_exceeded || 'false' }}
  499. max_cache_misses_exceeded: ${{ steps.detect-agent-errors.outputs.max_cache_misses_exceeded || 'false' }}
  500. mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }}
  501. missing_model_pricing_error: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_error || 'false' }}
  502. missing_model_pricing_model_name: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_model_name || '' }}
  503. model: ${{ needs.activation.outputs.model }}
  504. model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }}
  505. output: ${{ steps.collect_output.outputs.output }}
  506. output_types: ${{ steps.collect_output.outputs.output_types }}
  507. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  508. setup-span-id: ${{ steps.setup.outputs.span-id }}
  509. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  510. shell_expansion_guard_rejected: ${{ steps.detect-agent-errors.outputs.shell_expansion_guard_rejected || 'false' }}
  511. unknown_model_ai_credits: ${{ steps.parse-mcp-gateway.outputs.unknown_model_ai_credits || 'false' }}
  512. steps:
  513. - name: Setup Scripts
  514. id: setup
  515. uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  516. with:
  517. destination: ${{ runner.temp }}/gh-aw/actions
  518. job-name: ${{ github.job }}
  519. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  520. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  521. env:
  522. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Bug"
  523. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-bug.lock.yml@${{ github.ref }}
  524. GH_AW_INFO_VERSION: "0.154.0"
  525. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  526. GH_AW_INFO_ENGINE_ID: "codex"
  527. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  528. - name: Set runtime paths
  529. id: set-runtime-paths
  530. env:
  531. GH_AW_RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}
  532. run: | # zizmor: ignore[github-env] - runner.tool_cache is set by GitHub Actions, not user input.
  533. if [ -z "${RUNNER_TOOL_CACHE:-}" ]; then
  534. echo "RUNNER_TOOL_CACHE=${GH_AW_RUNNER_TOOL_CACHE}" >> "$GITHUB_ENV"
  535. fi
  536. {
  537. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  538. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  539. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  540. } >> "$GITHUB_OUTPUT"
  541. - name: Mask OTLP telemetry headers
  542. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  543. - name: Check OTLP telemetry configuration
  544. run: bash "${RUNNER_TEMP}/gh-aw/actions/check_otlp_default_credentials.sh"
  545. - name: Checkout repository
  546. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  547. with:
  548. persist-credentials: false
  549. - name: Initialize agent execution evidence
  550. run: |
  551. mkdir -p "/tmp/gh-aw"
  552. evidence_tmp="/tmp/gh-aw/agent_execution.json.tmp"
  553. printf '{"version":1,"component":"agent","run_id":%s,"run_attempt":%s,"state":"not_started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  554. mv "$evidence_tmp" "/tmp/gh-aw/agent_execution.json"
  555. - name: Create gh-aw temp directory
  556. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  557. - name: Configure gh CLI for GitHub Enterprise
  558. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  559. env:
  560. GH_TOKEN: ${{ github.token }}
  561. - name: Download activation artifact
  562. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  563. with:
  564. name: ${{ needs.activation.outputs.artifact_prefix }}activation
  565. path: /tmp/gh-aw
  566. - name: Configure Git credentials
  567. env:
  568. GITHUB_REPOSITORY: ${{ github.repository }}
  569. GITHUB_SERVER_URL: ${{ github.server_url }}
  570. GITHUB_TOKEN: ${{ github.token }}
  571. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  572. - name: Checkout PR branch
  573. id: checkout-pr
  574. if: |
  575. github.event.pull_request || github.event.issue.pull_request || github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.aw_context || '{}').item_type == 'pull_request'
  576. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  577. env:
  578. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  579. with:
  580. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  581. script: |
  582. const path = require('path');
  583. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  584. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  585. setupGlobals(core, github, context, exec, io, getOctokit);
  586. const { main } = require(path.join(actionsDir, 'checkout_pr_branch.cjs'));
  587. await main();
  588. - name: Setup Node.js
  589. uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  590. with:
  591. node-version: '24'
  592. package-manager-cache: false
  593. - name: Install Codex CLI
  594. run: npm install --ignore-scripts -g @openai/codex@0.154.0
  595. - name: Install AWF binary
  596. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.28.23 --rootless
  597. - name: Determine automatic lockdown mode for GitHub MCP Server
  598. id: determine-automatic-lockdown
  599. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
  600. env:
  601. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  602. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  603. GH_AW_GITHUB_MIN_INTEGRITY: 'none'
  604. with:
  605. script: |
  606. const path = require('path');
  607. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  608. const determineAutomaticLockdown = require(path.join(actionsDir, 'determine_automatic_lockdown.cjs'));
  609. await determineAutomaticLockdown(github, context, core);
  610. - name: Parse integrity filter lists
  611. id: parse-guard-vars
  612. env:
  613. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  614. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  615. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  616. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  617. - name: Restore agent config folders from base branch
  618. if: steps.checkout-pr.outcome == 'success'
  619. env:
  620. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  621. GH_AW_AGENT_FILES: "AGENTS.md"
  622. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh"
  623. - name: Restore inline sub-agents from activation artifact
  624. env:
  625. GH_AW_SUB_AGENT_DIR: ".codex/agents"
  626. GH_AW_SUB_AGENT_EXT: ".md"
  627. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh"
  628. - name: Restore inline skills from activation artifact
  629. env:
  630. GH_AW_SKILL_DIR: ".codex/skills"
  631. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
  632. - name: Download container images
  633. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.28.23@sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2 ghcr.io/github/gh-aw-firewall/api-proxy:0.28.23@sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64 ghcr.io/github/gh-aw-firewall/squid:0.28.23@sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0 ghcr.io/github/gh-aw-mcpg:v0.4.25@sha256:9be0a86220e807a0ecc89e53d7453468f7a53fbc6b3d1efd2299025ffe01d086 ghcr.io/github/gh-aw-node@sha256:11c2c544876cdbaffefe0f7f1283b74838c209654b4934a78e23ed11f750490f ghcr.io/github/github-mcp-server:v1.12.2@sha256:508a0857ec762b1ab1cece29193345b501fab1dd9d1228a7b617062954cecac6
  634. - name: Prepare Safe Outputs Directories
  635. run: |
  636. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  637. mkdir -p /tmp/gh-aw/safeoutputs
  638. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  639. - name: Generate Safe Outputs Config
  640. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  641. env:
  642. GH_AW_FILE_ROOT: "${{ runner.temp }}/gh-aw"
  643. GH_AW_FILE_CONFIG: "{\"files\":[{\"path\":\"safeoutputs/config.json\",\"content_env\":\"GH_AW_SAFE_OUTPUTS_CONFIG\"}]}"
  644. GH_AW_SAFE_OUTPUTS_CONFIG: "{\"add_comment\":{\"max\":1,\"target\":\"${GH_AW_INPUT_ISSUE_NUMBER}\"},\"add_labels\":{\"max\":3,\"target\":\"${GH_AW_INPUT_ISSUE_NUMBER}\"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"update_issue\":{\"allow_body\":true,\"max\":1,\"target\":\"${GH_AW_INPUT_ISSUE_NUMBER}\"}}"
  645. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  646. with:
  647. script: |
  648. const path = require('path');
  649. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  650. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  651. setupGlobals(core, github, context, exec, io, getOctokit);
  652. const { main } = require(path.join(actionsDir, 'create_files.cjs'));
  653. await main();
  654. - name: Generate Safe Outputs Tools
  655. env:
  656. GH_AW_TOOLS_META_JSON: |
  657. {
  658. "description_suffixes": {
  659. "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Target: ${GH_AW_INPUTS_ISSUE_NUMBER}. Supports reply_to_id for discussion threading.",
  660. "add_labels": " CONSTRAINTS: Maximum 3 label(s) can be added. Target: ${GH_AW_INPUTS_ISSUE_NUMBER}.",
  661. "update_issue": " CONSTRAINTS: Maximum 1 issue(s) can be updated. Target: ${GH_AW_INPUTS_ISSUE_NUMBER}."
  662. },
  663. "repo_params": {},
  664. "dynamic_tools": []
  665. }
  666. GH_AW_VALIDATION_JSON: |
  667. {
  668. "add_comment": {
  669. "defaultMax": 1,
  670. "fields": {
  671. "body": {
  672. "required": true,
  673. "type": "string",
  674. "sanitize": true,
  675. "maxLength": 65000
  676. },
  677. "comment_id": {
  678. "optionalPositiveInteger": true
  679. },
  680. "item_number": {
  681. "issueOrPRNumber": true
  682. },
  683. "pr": {
  684. "issueOrPRNumber": true
  685. },
  686. "pr_number": {
  687. "issueOrPRNumber": true
  688. },
  689. "reply_to_id": {
  690. "type": "string",
  691. "maxLength": 256
  692. },
  693. "repo": {
  694. "type": "string",
  695. "maxLength": 256
  696. },
  697. "target": {
  698. "type": "string",
  699. "enum": [
  700. "status"
  701. ]
  702. },
  703. "temporary_id": {
  704. "type": "string",
  705. "pattern": "^#?aw_[A-Za-z0-9_]{3,12}$"
  706. }
  707. }
  708. },
  709. "add_labels": {
  710. "defaultMax": 5,
  711. "fields": {
  712. "item_number": {
  713. "issueNumberOrTemporaryId": true
  714. },
  715. "labels": {
  716. "required": true,
  717. "type": "array"
  718. },
  719. "repo": {
  720. "type": "string",
  721. "maxLength": 256
  722. }
  723. }
  724. },
  725. "missing_data": {
  726. "defaultMax": 20,
  727. "fields": {
  728. "alternatives": {
  729. "type": "string",
  730. "sanitize": true,
  731. "maxLength": 256
  732. },
  733. "context": {
  734. "type": "string",
  735. "sanitize": true,
  736. "maxLength": 256
  737. },
  738. "data_type": {
  739. "type": "string",
  740. "sanitize": true,
  741. "maxLength": 128
  742. },
  743. "reason": {
  744. "type": "string",
  745. "sanitize": true,
  746. "maxLength": 256
  747. }
  748. }
  749. },
  750. "missing_tool": {
  751. "defaultMax": 20,
  752. "fields": {
  753. "alternatives": {
  754. "type": "string",
  755. "sanitize": true,
  756. "maxLength": 512
  757. },
  758. "reason": {
  759. "required": true,
  760. "type": "string",
  761. "sanitize": true,
  762. "maxLength": 256
  763. },
  764. "tool": {
  765. "type": "string",
  766. "sanitize": true,
  767. "maxLength": 128
  768. }
  769. }
  770. },
  771. "noop": {
  772. "defaultMax": 1,
  773. "fields": {
  774. "message": {
  775. "required": true,
  776. "type": "string",
  777. "sanitize": true,
  778. "maxLength": 65000
  779. }
  780. }
  781. },
  782. "report_incomplete": {
  783. "defaultMax": 5,
  784. "fields": {
  785. "details": {
  786. "type": "string",
  787. "sanitize": true,
  788. "maxLength": 65000
  789. },
  790. "reason": {
  791. "required": true,
  792. "type": "string",
  793. "sanitize": true,
  794. "maxLength": 1024
  795. }
  796. }
  797. },
  798. "update_issue": {
  799. "defaultMax": 1,
  800. "fields": {
  801. "assignees": {
  802. "type": "array",
  803. "itemType": "string",
  804. "itemSanitize": true,
  805. "itemMaxLength": 39
  806. },
  807. "body": {
  808. "type": "string",
  809. "sanitize": true,
  810. "maxLength": 65000
  811. },
  812. "issue_number": {
  813. "issueOrPRNumber": true
  814. },
  815. "labels": {
  816. "type": "array"
  817. },
  818. "milestone": {
  819. "optionalPositiveInteger": true
  820. },
  821. "operation": {
  822. "type": "string",
  823. "enum": [
  824. "replace",
  825. "append",
  826. "prepend",
  827. "replace-island"
  828. ]
  829. },
  830. "repo": {
  831. "type": "string",
  832. "maxLength": 256
  833. },
  834. "status": {
  835. "type": "string",
  836. "enum": [
  837. "open",
  838. "closed"
  839. ]
  840. },
  841. "title": {
  842. "type": "string",
  843. "sanitize": true,
  844. "maxLength": 128
  845. }
  846. },
  847. "customValidation": "requiresOneOf:status,title,body,labels,assignees,milestone"
  848. }
  849. }
  850. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  851. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  852. with:
  853. script: |
  854. const path = require('path');
  855. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  856. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  857. setupGlobals(core, github, context, exec, io, getOctokit);
  858. const { main } = require(path.join(actionsDir, 'generate_safe_outputs_tools.cjs'));
  859. await main();
  860. - name: Start MCP Gateway
  861. id: start-mcp-gateway
  862. env:
  863. CODEX_HOME: /tmp/gh-aw/mcp-config
  864. GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST: ${{ vars.GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST || 'true' }}
  865. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  866. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_CONFIG_PATH }}
  867. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_TOOLS_PATH }}
  868. GH_AW_SINK_VISIBILITY: ${{ steps.determine-automatic-lockdown.outputs.visibility }}
  869. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  870. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  871. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  872. run: |
  873. set -eo pipefail
  874. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  875. if [ -n "${GITHUB_EVENT_PATH:-}" ] && [ -r "${GITHUB_EVENT_PATH}" ]; then
  876. GH_AW_SAFEOUTPUTS_EVENT_PATH="${RUNNER_TEMP}/gh-aw/safeoutputs/github_event.json"
  877. cp "${GITHUB_EVENT_PATH}" "${GH_AW_SAFEOUTPUTS_EVENT_PATH}"
  878. export GITHUB_EVENT_PATH="${GH_AW_SAFEOUTPUTS_EVENT_PATH}"
  879. fi
  880. # Export gateway environment variables for MCP config and gateway script
  881. export MCP_GATEWAY_PORT="8080"
  882. export MCP_GATEWAY_DOMAIN="awmg-mcpg"
  883. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  884. MCP_GATEWAY_AGENT_ID=$(openssl rand -base64 45 | tr -d '/+=')
  885. echo "::add-mask::${MCP_GATEWAY_AGENT_ID}"
  886. export MCP_GATEWAY_AGENT_ID
  887. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  888. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  889. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  890. export MCP_GATEWAY_ALLOWED_MOUNT_ROOTS="${GITHUB_WORKSPACE}:rw,${RUNNER_TEMP}/gh-aw:ro,${RUNNER_TEMP}/gh-aw/safeoutputs:rw,/opt:ro,/tmp:rw,/usr/bin/gh:ro"
  891. export GH_AW_PR_HEAD_BASE_BRANCH="${GH_AW_PR_HEAD_BASE_BRANCH:-}"
  892. export GH_AW_PR_HEAD_BASE_SHA="${GH_AW_PR_HEAD_BASE_SHA:-}"
  893. export GH_AW_PR_HEAD_BASE_REPO="${GH_AW_PR_HEAD_BASE_REPO:-}"
  894. export GH_AW_PR_HEAD_BASE_PR_NUMBER="${GH_AW_PR_HEAD_BASE_PR_NUMBER:-}"
  895. export GH_AW_PR_HEAD_BASE_REF="${GH_AW_PR_HEAD_BASE_REF:-}"
  896. export GH_AW_PR_HEAD_REPO="${GH_AW_PR_HEAD_REPO:-}"
  897. export DEBUG="*"
  898. export GH_AW_ENGINE="codex"
  899. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  900. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  901. source "${RUNNER_TEMP}/gh-aw/actions/resolve_docker_socket_gid.sh"
  902. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network bridge -p 127.0.0.1:'"${MCP_GATEWAY_PORT}"':'"${MCP_GATEWAY_PORT}"' --name awmg-mcpg --add-host host.docker.internal:host-gateway --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_AGENT_ID -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_PR_HEAD_BASE_BRANCH -e GH_AW_PR_HEAD_BASE_SHA -e GH_AW_PR_HEAD_BASE_REPO -e GH_AW_PR_HEAD_BASE_PR_NUMBER -e GH_AW_PR_HEAD_BASE_REF -e GH_AW_PR_HEAD_REPO -e GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GH_AW_SINK_VISIBILITY -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e RUNNER_TEMP -e RUNNER_TOOL_CACHE -e MCP_GATEWAY_ALLOWED_MOUNT_ROOTS -e GITHUB_AW_OTEL_TRACE_ID -e GITHUB_AW_OTEL_PARENT_SPAN_ID -e OTEL_EXPORTER_OTLP_HEADERS -e GH_AW_INPUT_ISSUE_NUMBER -e CODEX_HOME -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw -v '"${RUNNER_TEMP}"'/gh-aw/safeoutputs:'"${RUNNER_TEMP}"'/gh-aw/safeoutputs:rw ghcr.io/github/gh-aw-mcpg:v0.4.25'
  903. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_MCP_CONFIG_eaadeae34d7c962c_EOF
  904. [history]
  905. persistence = "none"
  906. [otel]
  907. metrics_exporter = "none"
  908. [shell_environment_policy]
  909. inherit = "core"
  910. include_only = ["^CODEX_API_KEY$", "^GH_AW_ASSETS_ALLOWED_EXTS$", "^GH_AW_ASSETS_BRANCH$", "^GH_AW_ASSETS_MAX_SIZE_KB$", "^GH_AW_SAFE_OUTPUTS$", "^GITHUB_PERSONAL_ACCESS_TOKEN$", "^GITHUB_REPOSITORY$", "^GITHUB_SERVER_URL$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  911. [mcp_servers.github]
  912. user_agent = "issue-handle-bug"
  913. startup_timeout_sec = 120
  914. tool_timeout_sec = 60
  915. container = "ghcr.io/github/github-mcp-server:v1.12.2"
  916. env = { "GITHUB_FEATURES" = "fields_param", "GITHUB_HOST" = "$GITHUB_SERVER_URL", "GITHUB_PERSONAL_ACCESS_TOKEN" = "$GH_AW_GITHUB_TOKEN", "GITHUB_READ_ONLY" = "1", "GITHUB_TOOLSETS" = "context,repos,issues,pull_requests" }
  917. env_vars = ["GITHUB_FEATURES", "GITHUB_HOST", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_READ_ONLY", "GITHUB_TOOLSETS"]
  918. [mcp_servers.safeoutputs]
  919. container = "ghcr.io/github/gh-aw-node"
  920. mounts = ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"]
  921. args = ["-w", "$GITHUB_WORKSPACE"]
  922. entrypoint = "sh"
  923. entrypointArgs = ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"]
  924. env_vars = ["DEBUG", "DEFAULT_BRANCH", "GH_AW_ASSETS_ALLOWED_EXTS", "GH_AW_ASSETS_BRANCH", "GH_AW_ASSETS_MAX_SIZE_KB", "GH_AW_MCP_LOG_DIR", "GH_AW_SAFE_OUTPUTS", "GH_AW_SAFE_OUTPUTS_CONFIG_PATH", "GH_AW_SAFE_OUTPUTS_TOOLS_PATH", "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST", "GH_AW_PR_HEAD_BASE_BRANCH", "GH_AW_PR_HEAD_BASE_SHA", "GH_AW_PR_HEAD_BASE_REPO", "GH_AW_PR_HEAD_BASE_PR_NUMBER", "GH_AW_PR_HEAD_BASE_REF", "GH_AW_PR_HEAD_REPO", "GITHUB_EVENT_NAME", "GITHUB_EVENT_PATH", "GITHUB_REPOSITORY", "GITHUB_SHA", "GITHUB_TOKEN", "GITHUB_WORKSPACE", "RUNNER_TEMP", "GH_AW_INPUT_ISSUE_NUMBER"]
  925. [mcp_servers.safeoutputs."guard-policies"]
  926. [mcp_servers.safeoutputs."guard-policies".write-sink]
  927. accept = ["*"]
  928. sink-visibility = "${GH_AW_SINK_VISIBILITY}"
  929. GH_AW_MCP_CONFIG_eaadeae34d7c962c_EOF
  930. # Generate JSON config for MCP gateway
  931. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  932. cat << GH_AW_MCP_CONFIG_243f571a340317b4_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  933. {
  934. "mcpServers": {
  935. "github": {
  936. "container": "ghcr.io/github/github-mcp-server:v1.12.2",
  937. "env": {
  938. "GITHUB_FEATURES": "fields_param",
  939. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  940. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  941. "GITHUB_READ_ONLY": "1",
  942. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  943. },
  944. "guard-policies": {
  945. "allow-only": {
  946. "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }},
  947. "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }},
  948. "min-integrity": "none",
  949. "repos": "all",
  950. "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }}
  951. }
  952. }
  953. },
  954. "safeoutputs": {
  955. "container": "ghcr.io/github/gh-aw-node",
  956. "mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
  957. "args": ["-w", "\${GITHUB_WORKSPACE}"],
  958. "entrypoint": "sh",
  959. "entrypointArgs": ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"],
  960. "env": {
  961. "DEBUG": "*",
  962. "DEFAULT_BRANCH": "\${DEFAULT_BRANCH}",
  963. "GH_AW_ASSETS_ALLOWED_EXTS": "\${GH_AW_ASSETS_ALLOWED_EXTS}",
  964. "GH_AW_ASSETS_BRANCH": "\${GH_AW_ASSETS_BRANCH}",
  965. "GH_AW_ASSETS_MAX_SIZE_KB": "\${GH_AW_ASSETS_MAX_SIZE_KB}",
  966. "GH_AW_MCP_LOG_DIR": "\${GH_AW_MCP_LOG_DIR}",
  967. "GH_AW_SAFE_OUTPUTS": "\${GH_AW_SAFE_OUTPUTS}",
  968. "GH_AW_SAFE_OUTPUTS_CONFIG_PATH": "\${GH_AW_SAFE_OUTPUTS_CONFIG_PATH}",
  969. "GH_AW_SAFE_OUTPUTS_TOOLS_PATH": "\${GH_AW_SAFE_OUTPUTS_TOOLS_PATH}",
  970. "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST": "\${GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST}",
  971. "GH_AW_PR_HEAD_BASE_BRANCH": "\${GH_AW_PR_HEAD_BASE_BRANCH}",
  972. "GH_AW_PR_HEAD_BASE_SHA": "\${GH_AW_PR_HEAD_BASE_SHA}",
  973. "GH_AW_PR_HEAD_BASE_REPO": "\${GH_AW_PR_HEAD_BASE_REPO}",
  974. "GH_AW_PR_HEAD_BASE_PR_NUMBER": "\${GH_AW_PR_HEAD_BASE_PR_NUMBER}",
  975. "GH_AW_PR_HEAD_BASE_REF": "\${GH_AW_PR_HEAD_BASE_REF}",
  976. "GH_AW_PR_HEAD_REPO": "\${GH_AW_PR_HEAD_REPO}",
  977. "GITHUB_EVENT_NAME": "\${GITHUB_EVENT_NAME}",
  978. "GITHUB_EVENT_PATH": "\${GITHUB_EVENT_PATH}",
  979. "GITHUB_REPOSITORY": "\${GITHUB_REPOSITORY}",
  980. "GITHUB_SHA": "\${GITHUB_SHA}",
  981. "GITHUB_TOKEN": "\${GITHUB_TOKEN}",
  982. "GITHUB_WORKSPACE": "\${GITHUB_WORKSPACE}",
  983. "RUNNER_TEMP": "\${RUNNER_TEMP}",
  984. "GH_AW_INPUT_ISSUE_NUMBER": "\${GH_AW_INPUT_ISSUE_NUMBER}"
  985. },
  986. "guard-policies": {
  987. "write-sink": {
  988. "accept": [
  989. "*"
  990. ],
  991. "sink-visibility": "${GH_AW_SINK_VISIBILITY}"
  992. }
  993. }
  994. }
  995. },
  996. "gateway": {
  997. "port": $MCP_GATEWAY_PORT,
  998. "domain": "${MCP_GATEWAY_DOMAIN}",
  999. "agentId": "${MCP_GATEWAY_AGENT_ID}",
  1000. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}",
  1001. "startupTimeout": 120,
  1002. "opentelemetry": {
  1003. "endpoint": "${OTEL_EXPORTER_OTLP_ENDPOINT}",
  1004. "traceId": "${GITHUB_AW_OTEL_TRACE_ID}",
  1005. "spanId": "${GITHUB_AW_OTEL_PARENT_SPAN_ID}"
  1006. }
  1007. }
  1008. }
  1009. GH_AW_MCP_CONFIG_243f571a340317b4_EOF
  1010. # Sync converter output to writable CODEX_HOME for Codex
  1011. mkdir -p /tmp/gh-aw/mcp-config
  1012. cat > "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_SHELL_POLICY_1291c5e46fe06428_EOF
  1013. model_provider = "openai-proxy"
  1014. [model_providers.openai-proxy]
  1015. name = "OpenAI AWF proxy"
  1016. base_url = "http://172.30.0.30:10000"
  1017. env_key = "CODEX_API_KEY"
  1018. wire_api = "responses"
  1019. requires_openai_auth = false
  1020. supports_websockets = false
  1021. [features]
  1022. plugins = false
  1023. [shell_environment_policy]
  1024. inherit = "core"
  1025. include_only = ["^CODEX_API_KEY$", "^GH_AW_ASSETS_ALLOWED_EXTS$", "^GH_AW_ASSETS_BRANCH$", "^GH_AW_ASSETS_MAX_SIZE_KB$", "^GH_AW_SAFE_OUTPUTS$", "^GITHUB_PERSONAL_ACCESS_TOKEN$", "^GITHUB_REPOSITORY$", "^GITHUB_SERVER_URL$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  1026. GH_AW_CODEX_SHELL_POLICY_1291c5e46fe06428_EOF
  1027. awk '
  1028. BEGIN { skip_openai_proxy = 0 }
  1029. /^[[:space:]]*model_provider[[:space:]]*=/ { next }
  1030. /^\[model_providers\.openai-proxy\][[:space:]]*$/ { skip_openai_proxy = 1; next }
  1031. /^\[/ { skip_openai_proxy = 0 }
  1032. !skip_openai_proxy { print }
  1033. ' "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" >> "/tmp/gh-aw/mcp-config/config.toml"
  1034. chmod 600 "/tmp/gh-aw/mcp-config/config.toml"
  1035. mkdir -p "${CODEX_HOME}"
  1036. if [ "/tmp/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "/tmp/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  1037. chmod 600 "${CODEX_HOME}/config.toml"
  1038. - name: Mount MCP servers as CLIs
  1039. id: mount-mcp-clis
  1040. continue-on-error: true
  1041. env:
  1042. MCP_GATEWAY_AGENT_ID: ${{ steps.start-mcp-gateway.outputs.gateway-agent-id }}
  1043. MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }}
  1044. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  1045. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1046. with:
  1047. script: |
  1048. const path = require('path');
  1049. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1050. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1051. setupGlobals(core, github, context, exec, io);
  1052. const { main } = require(path.join(actionsDir, 'mount_mcp_as_cli.cjs'));
  1053. await main();
  1054. - name: Clean credentials
  1055. continue-on-error: true
  1056. run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  1057. - name: Audit pre-agent workspace
  1058. id: pre_agent_audit
  1059. continue-on-error: true
  1060. run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh"
  1061. - name: Execute Codex CLI
  1062. id: agentic_execution
  1063. timeout-minutes: 15
  1064. run: |
  1065. set -o pipefail
  1066. trap 'gh_aw_exit_code=$?; mkdir -p /tmp/gh-aw >/dev/null 2>&1 || true; printf "%s" "$gh_aw_exit_code" > /tmp/gh-aw/agent_execution_exit_code.txt || true; if [ "$gh_aw_exit_code" -ne 0 ]; then echo "::error::Agent execution exited with code $gh_aw_exit_code"; fi' EXIT
  1067. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  1068. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  1069. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  1070. GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-1000}"
  1071. if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^[0-9]+$ ]]; then
  1072. GH_AW_MAX_AI_CREDITS="1000"
  1073. fi
  1074. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.28.23/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"ai-pixel.online\",\"api-inference.modelscope.cn\",\"api.commandcode.ai\",\"api.deepseek.com\",\"api.minimaxi.com\",\"api.snapcraft.io\",\"archive.ubuntu.com\",\"azure.archive.ubuntu.com\",\"crl.geotrust.com\",\"crl.globalsign.com\",\"crl.identrust.com\",\"crl.sectigo.com\",\"crl.thawte.com\",\"crl.usertrust.com\",\"crl.verisign.com\",\"crl3.digicert.com\",\"crl4.digicert.com\",\"crls.ssl.com\",\"json-schema.org\",\"json.schemastore.org\",\"keyserver.ubuntu.com\",\"ocsp.digicert.com\",\"ocsp.geotrust.com\",\"ocsp.globalsign.com\",\"ocsp.identrust.com\",\"ocsp.sectigo.com\",\"ocsp.ssl.com\",\"ocsp.thawte.com\",\"ocsp.usertrust.com\",\"ocsp.verisign.com\",\"open.bigmodel.cn\",\"opencode.ai\",\"packagecloud.io\",\"packages.cloud.google.com\",\"packages.microsoft.com\",\"ppa.launchpad.net\",\"s.symcb.com\",\"s.symcd.com\",\"security.ubuntu.com\",\"ts-crl.ws.symantec.com\",\"ts-ocsp.ws.symantec.com\",\"www.googleapis.com\"],\"isolation\":true,\"topologyAttach\":[\"awmg-mcpg\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"modelFallback\":{\"enabled\":false},\"targets\":{\"openai\":{\"host\":\"ai-pixel.online\"}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-6\",\"gpt-5.4\",\"gpt-5.5\",\"gpt-5.6\",\"gpt-5.3\",\"gemini-pro\",\"any\"],\"antigravity\":[\"copilot/antigravity*\",\"google/antigravity*\",\"gemini/antigravity*\"],\"any\":[\"copilot/*\",\"anthropic/*\",\"openai/*\",\"google/*\",\"gemini/*\"],\"auto\":[\"copilot/auto\",\"large\"],\"claude\":[\"agent\"],\"codex\":[\"agent\"],\"coding\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\",\"gpt-5-codex\",\"kimi\"],\"computer-use\":[\"copilot/*computer-use*\",\"google/*computer-use*\",\"gemini/*computer-use*\",\"openai/*computer-use*\"],\"copilot\":[\"agent\"],\"deep-research\":[\"copilot/deep-research*\",\"copilot/o3-deep-research*\",\"copilot/o4-mini-deep-research*\",\"google/deep-research*\",\"gemini/deep-research*\",\"openai/o3-deep-research*\",\"openai/o4-mini-deep-research*\"],\"detection\":[\"small\"],\"evals\":[\"small\"],\"fable\":[\"copilot/*fable*\",\"anthropic/*fable*\"],\"gemini\":[\"agent\"],\"gemini-3-flash\":[\"copilot/gemini-3*flash*\",\"google/gemini-3*flash*\",\"gemini/gemini-3*flash*\"],\"gemini-3-pro\":[\"copilot/gemini-3*pro*\",\"google/gemini-3*pro*\",\"google/nano-banana*\",\"gemini/gemini-3*pro*\"],\"gemini-3.1-flash\":[\"copilot/gemini-3.1*flash*\",\"google/gemini-3.1*flash*\",\"gemini/gemini-3.1*flash*\"],\"gemini-3.1-pro\":[\"copilot/gemini-3.1*pro*\",\"google/gemini-3.1*pro*\",\"gemini/gemini-3.1*pro*\"],\"gemini-3.5-flash\":[\"copilot/gemini-3.5*flash*\",\"google/gemini-3.5*flash*\",\"gemini/gemini-3.5*flash*\"],\"gemini-3.6-flash\":[\"copilot/gemini-3.6*flash*\",\"google/gemini-3.6*flash*\",\"gemini/gemini-3.6*flash*\"],\"gemini-3.7-flash\":[\"copilot/gemini-3.7*flash*\",\"google/gemini-3.7*flash*\",\"gemini/gemini-3.7*flash*\"],\"gemini-3.8-flash\":[\"copilot/gemini-3.8*flash*\",\"google/gemini-3.8*flash*\",\"gemini/gemini-3.8*flash*\"],\"gemini-flash\":[\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"],\"gemini-flash-lite\":[\"copilot/gemini-*flash*lite*\",\"google/gemini-*flash*lite*\",\"gemini/gemini-*flash*lite*\"],\"gemini-omni\":[\"copilot/gemini-omni*\",\"google/gemini-omni*\",\"gemini/gemini-omni*\"],\"gemini-pro\":[\"copilot/gemini-*pro*\",\"google/gemini-*pro*\",\"gemini/gemini-*pro*\"],\"gemma\":[\"copilot/gemma*\",\"google/gemma*\",\"gemini/gemma*\"],\"gpt-5\":[\"copilot/gpt-5*\",\"openai/gpt-5*\"],\"gpt-5-codex\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\"],\"gpt-5-mini\":[\"copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"],\"gpt-5-nano\":[\"copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"],\"gpt-5-pro\":[\"copilot/gpt-5*pro*\",\"openai/gpt-5*pro*\"],\"gpt-5.1\":[\"copilot/gpt-5.1*\",\"openai/gpt-5.1*\"],\"gpt-5.2\":[\"copilot/gpt-5.2*\",\"openai/gpt-5.2*\"],\"gpt-5.3\":[\"copilot/gpt-5.3*\",\"openai/gpt-5.3*\"],\"gpt-5.4\":[\"copilot/gpt-5.4*\",\"openai/gpt-5.4*\"],\"gpt-5.5\":[\"copilot/gpt-5.5*\",\"openai/gpt-5.5*\"],\"gpt-5.6\":[\"copilot/gpt-5.6*\",\"openai/gpt-5.6*\"],\"gpt-6\":[\"copilot/gpt-6*\",\"openai/gpt-6*\"],\"grok\":[\"copilot/*grok*\",\"openai/*grok*\"],\"haiku\":[\"copilot/*haiku*\",\"anthropic/*haiku*\"],\"image-generation\":[\"copilot/gpt-image*\",\"openai/gpt-image*\",\"openai/chatgpt-image*\",\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"google/imagen*\"],\"kimi\":[\"copilot/kimi*\",\"openai/kimi*\"],\"kiwi\":[\"copilot/kiwi*\",\"openai/kiwi*\"],\"large\":[\"sonnet\",\"gpt-6\",\"gpt-5-pro\",\"gpt-5\",\"gemini-pro\"],\"lyria\":[\"google/lyria*\",\"gemini/lyria*\",\"copilot/lyria*\"],\"mai-code\":[\"copilot/MAI-Code*\",\"copilot/mai-code*\",\"openai/MAI-Code*\"],\"mai-code-1-flash-picker\":[\"copilot/MAI-Code-1-Flash-picker*\",\"copilot/mai-code-1-flash-picker*\",\"openai/MAI-Code-1-Flash-picker*\"],\"mini\":[\"haiku\",\"gpt-5-mini\",\"gpt-5-nano\",\"gemini-flash-lite\"],\"nano-banana\":[\"copilot/nano-banana*\",\"google/nano-banana*\",\"gemini/nano-banana*\"],\"opus\":[\"copilot/*opus*\",\"anthropic/*opus*\"],\"opusplan\":[\"opus?effort=high\"],\"raptor-mini\":[\"copilot/raptor*\",\"openai/raptor*\"],\"reasoning\":[\"copilot/o1*\",\"copilot/o3*\",\"copilot/o4*\",\"openai/o1*\",\"openai/o3*\",\"openai/o4*\"],\"robotics\":[\"copilot/*robotics*\",\"google/*robotics*\",\"gemini/*robotics*\"],\"small\":[\"mini\"],\"small-agent\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash\"],\"sonnet\":[\"copilot/*sonnet*\",\"anthropic/*sonnet*\"],\"sonnet-6x\":[\"copilot/*sonnet-4.5*\",\"copilot/*sonnet-4.6*\",\"copilot/*sonnet-5*\",\"copilot/*sonnet-4-5-*\",\"anthropic/*sonnet-4-5-*\",\"copilot/*sonnet-4-6*\",\"anthropic/*sonnet-4-6*\",\"anthropic/*sonnet-5*\"],\"summarization\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash-lite\",\"mini\"],\"veo\":[\"google/veo*\",\"gemini/veo*\"],\"vision\":[\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"]}},\"container\":{\"imageTag\":\"0.28.23,squid=sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0,agent=sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2,api-proxy=sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64,cli-proxy=sha256:9e31a6e518eba44652b9ae94ce55c3b6958e06290c3b81b08de4174751bb439a\"},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1075. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  1076. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  1077. GH_AW_DOCKER_HOST=""
  1078. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1079. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  1080. fi
  1081. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1082. GH_AW_CHROOT_BINARIES_SOURCE_PATH="${RUNNER_TEMP}/gh-aw" GH_AW_CHROOT_IDENTITY_HOME="${RUNNER_TEMP}/gh-aw/home" node "${RUNNER_TEMP}/gh-aw/actions/patch_awf_chroot_config.cjs"
  1083. fi
  1084. GH_AW_TOOL_CACHE_MOUNT=""
  1085. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  1086. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  1087. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  1088. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  1089. fi
  1090. fi
  1091. # shellcheck disable=SC1003,SC2016,SC2086
  1092. mkdir -p "/tmp/gh-aw"
  1093. evidence_tmp="/tmp/gh-aw/agent_execution.json.tmp"
  1094. printf '{"version":1,"component":"agent","run_id":%s,"run_attempt":%s,"state":"started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  1095. mv "$evidence_tmp" "/tmp/gh-aw/agent_execution.json"
  1096. export GH_AW_AWF_EXECUTION_COMPONENT="agent"
  1097. export GH_AW_AWF_EXECUTION_EVIDENCE_FILE="/tmp/gh-aw/agent_execution.json"
  1098. GH_AW_AWF_ENGINE_NAME=codex \
  1099. GH_AW_AWF_HARNESS_MARKER='[codex-harness]' \
  1100. GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
  1101. GH_AW_AWF_ATTEMPT_LOG_NAME=codex \
  1102. bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
  1103. awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env CODEX_API_KEY --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OPENAI_API_KEY --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --skip-pull \
  1104. -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_AGENT_CODEX:+ --model "$GH_AW_MODEL_AGENT_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
  1105. env:
  1106. AWF_REFLECT_ENABLED: 1
  1107. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1108. CODEX_HOME: /tmp/gh-aw/mcp-config
  1109. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  1110. GH_AW_LLM_PROVIDER: openai
  1111. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  1112. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  1113. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  1114. GH_AW_MODEL_AGENT_CODEX: gpt-5.6-luna
  1115. GH_AW_PHASE: agent
  1116. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1117. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1118. GH_AW_VERSION: v0.89.21
  1119. GITHUB_AW: true
  1120. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1121. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1122. GIT_AUTHOR_NAME: github-actions[bot]
  1123. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1124. GIT_COMMITTER_NAME: github-actions[bot]
  1125. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1126. OPENAI_BASE_URL: https://ai-pixel.online
  1127. RUNNER_TEMP: ${{ runner.temp }}
  1128. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,codex_exec=debug' || 'warn' }}
  1129. TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }}
  1130. - name: Detect agent errors
  1131. if: always()
  1132. id: detect-agent-errors
  1133. continue-on-error: true
  1134. env:
  1135. GH_AW_AGENTIC_EXECUTION_OUTCOME: ${{ steps.agentic_execution.outcome }}
  1136. GH_AW_ENGINE_STEP_TIMEOUT_MINUTES: 15
  1137. GH_AW_ENGINE_INTERNAL_LOGS_DIR: /tmp/gh-aw/mcp-config/logs
  1138. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1139. with:
  1140. script: |
  1141. const path = require('path');
  1142. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1143. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1144. setupGlobals(core, github, context, exec, io, getOctokit);
  1145. const { main } = require(path.join(actionsDir, 'detect_agent_errors.cjs'));
  1146. await main();
  1147. - name: Configure Git credentials
  1148. env:
  1149. GITHUB_REPOSITORY: ${{ github.repository }}
  1150. GITHUB_SERVER_URL: ${{ github.server_url }}
  1151. GITHUB_TOKEN: ${{ github.token }}
  1152. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  1153. - name: Stop MCP Gateway
  1154. if: always()
  1155. continue-on-error: true
  1156. env:
  1157. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  1158. MCP_GATEWAY_AGENT_ID: ${{ steps.start-mcp-gateway.outputs.gateway-agent-id }}
  1159. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  1160. run: |
  1161. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  1162. - name: Redact secrets in logs
  1163. if: always()
  1164. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1165. with:
  1166. script: |
  1167. const path = require('path');
  1168. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1169. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1170. setupGlobals(core, github, context, exec, io, getOctokit);
  1171. const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
  1172. await main();
  1173. env:
  1174. GH_AW_SECRET_NAMES: 'CODEX_API_KEY,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN,OPENAI_API_KEY,PIXEL_API_KEY'
  1175. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1176. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1177. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1178. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1179. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1180. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1181. - name: Append agent step summary
  1182. if: always()
  1183. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  1184. - name: Copy Safe Outputs
  1185. if: always()
  1186. env:
  1187. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1188. run: |
  1189. mkdir -p /tmp/gh-aw
  1190. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  1191. - name: Ingest agent output
  1192. id: collect_output
  1193. if: always()
  1194. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1195. env:
  1196. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1197. GH_AW_ALLOWED_DOMAINS: "ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.minimaxi.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,opencode.ai,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  1198. GITHUB_SERVER_URL: ${{ github.server_url }}
  1199. GITHUB_API_URL: ${{ github.api_url }}
  1200. with:
  1201. script: |
  1202. const path = require('path');
  1203. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1204. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1205. setupGlobals(core, github, context, exec, io, getOctokit);
  1206. const { main } = require(path.join(actionsDir, 'collect_ndjson_output.cjs'));
  1207. await main();
  1208. - name: Parse agent logs for step summary
  1209. if: always()
  1210. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1211. env:
  1212. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  1213. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1214. with:
  1215. script: |
  1216. const path = require('path');
  1217. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1218. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1219. setupGlobals(core, github, context, exec, io, getOctokit);
  1220. const { main } = require(path.join(actionsDir, 'parse_codex_log.cjs'));
  1221. await main();
  1222. - name: Parse MCP Gateway logs for step summary
  1223. if: always()
  1224. id: parse-mcp-gateway
  1225. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1226. with:
  1227. script: |
  1228. const path = require('path');
  1229. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1230. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1231. setupGlobals(core, github, context, exec, io, getOctokit);
  1232. const { main } = require(path.join(actionsDir, 'parse_mcp_gateway_log.cjs'));
  1233. await main();
  1234. - name: Print firewall logs
  1235. if: always()
  1236. continue-on-error: true
  1237. env:
  1238. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  1239. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_firewall_logs.sh" --rootless
  1240. - name: Parse token usage for step summary
  1241. if: always()
  1242. id: parse-token-usage
  1243. continue-on-error: true
  1244. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1245. with:
  1246. script: |
  1247. const path = require('path');
  1248. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1249. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1250. setupGlobals(core, github, context, exec, io, getOctokit);
  1251. const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
  1252. await main();
  1253. - name: Print AWF reflect summary
  1254. if: always()
  1255. continue-on-error: true
  1256. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1257. with:
  1258. script: |
  1259. const path = require('path');
  1260. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1261. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1262. setupGlobals(core, github, context, exec, io, getOctokit);
  1263. const { main } = require(path.join(actionsDir, 'awf_reflect_summary.cjs'));
  1264. await main();
  1265. - name: Generate observability summary
  1266. if: always()
  1267. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1268. with:
  1269. script: |
  1270. const path = require('path');
  1271. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1272. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1273. setupGlobals(core, github, context, exec, io, getOctokit);
  1274. const { main } = require(path.join(actionsDir, 'generate_observability_summary.cjs'));
  1275. await main(core);
  1276. - name: Write agent output placeholder if missing
  1277. if: always()
  1278. run: |
  1279. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  1280. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  1281. fi
  1282. # Small dedicated copy of the agent output so safe-output processing
  1283. # survives a failed or timed-out upload of the larger agent artifact
  1284. - name: Upload agent output fallback artifact
  1285. if: always()
  1286. continue-on-error: true
  1287. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1288. with:
  1289. name: ${{ needs.activation.outputs.artifact_prefix }}agent-output-fallback
  1290. path: |
  1291. /tmp/gh-aw/agent_output.json
  1292. /tmp/gh-aw/safeoutputs.jsonl
  1293. /tmp/gh-aw/agent_execution.json
  1294. /tmp/gh-aw/agent_usage.jsonl
  1295. /tmp/gh-aw/agent_usage.json
  1296. /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl
  1297. /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl
  1298. /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl
  1299. if-no-files-found: ignore
  1300. - name: Upload agent artifacts
  1301. if: always()
  1302. continue-on-error: true
  1303. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1304. with:
  1305. name: ${{ needs.activation.outputs.artifact_prefix }}agent
  1306. path: |
  1307. /tmp/gh-aw/aw-prompts/prompt.txt
  1308. /tmp/gh-aw/agent_execution.json
  1309. /tmp/gh-aw/mcp-config/logs/
  1310. /tmp/gh-aw/redacted-urls.log
  1311. /tmp/gh-aw/mcp-logs/
  1312. /tmp/gh-aw/proxy-logs/
  1313. !/tmp/gh-aw/proxy-logs/proxy-tls/
  1314. /tmp/gh-aw/agent_usage.json
  1315. /tmp/gh-aw/agent-stdio.log
  1316. /tmp/gh-aw/pre-agent-audit.txt
  1317. /tmp/gh-aw/github_rate_limits.jsonl
  1318. /tmp/gh-aw/otel.jsonl
  1319. /tmp/gh-aw/otlp-export-errors.jsonl
  1320. /tmp/gh-aw/safeoutputs.jsonl
  1321. /tmp/gh-aw/agent_output.json
  1322. /tmp/gh-aw/aw-*.patch
  1323. /tmp/gh-aw/aw-*.bundle
  1324. /tmp/gh-aw/awf-config.json
  1325. /tmp/gh-aw/sandbox/firewall/logs/
  1326. /tmp/gh-aw/sandbox/firewall/audit/
  1327. /tmp/gh-aw/sandbox/firewall/awf-reflect.json
  1328. if-no-files-found: ignore
  1329. conclusion:
  1330. needs:
  1331. - activation
  1332. - agent
  1333. - detection
  1334. - safe_outputs
  1335. if: >
  1336. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  1337. needs.activation.outputs.oauth_token_check_failed == 'true' || needs.activation.outputs.stale_lock_file_failed == 'true' ||
  1338. needs.activation.outputs.secret_verification_result == 'failed' || needs.activation.outputs.daily_ai_credits_exceeded == 'true' ||
  1339. needs.activation.outputs.daily_ai_credits_guardrail_status == 'structural_error' || needs.activation.outputs.daily_ai_credits_guardrail_status == 'transient_error')
  1340. runs-on: ubuntu-slim
  1341. permissions:
  1342. actions: read
  1343. issues: write
  1344. pull-requests: write
  1345. concurrency:
  1346. group: "gh-aw-conclusion-issue-handle-bug"
  1347. cancel-in-progress: false
  1348. queue: max
  1349. env:
  1350. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1351. outputs:
  1352. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  1353. noop_message: ${{ steps.noop.outputs.noop_message }}
  1354. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  1355. total_count: ${{ steps.missing_tool.outputs.total_count }}
  1356. steps:
  1357. - name: Setup Scripts
  1358. id: setup
  1359. uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  1360. with:
  1361. destination: ${{ runner.temp }}/gh-aw/actions
  1362. job-name: ${{ github.job }}
  1363. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1364. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1365. env:
  1366. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Bug"
  1367. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-bug.lock.yml@${{ github.ref }}
  1368. GH_AW_INFO_VERSION: "0.154.0"
  1369. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  1370. GH_AW_INFO_ENGINE_ID: "codex"
  1371. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1372. - name: Download agent output artifact
  1373. id: download-agent-output
  1374. continue-on-error: true
  1375. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1376. with:
  1377. pattern: "{${{ needs.activation.outputs.artifact_prefix }}agent,${{ needs.activation.outputs.artifact_prefix }}agent-output-fallback}"
  1378. merge-multiple: true
  1379. path: /tmp/gh-aw/
  1380. - name: Setup agent output environment variable
  1381. id: setup-agent-output-env
  1382. if: steps.download-agent-output.outcome == 'success'
  1383. run: |
  1384. mkdir -p /tmp/gh-aw/
  1385. find "/tmp/gh-aw/" -type f -print
  1386. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  1387. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1388. fi
  1389. - name: Download detection artifact
  1390. id: download-detection-artifact
  1391. continue-on-error: true
  1392. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1393. with:
  1394. name: ${{ needs.activation.outputs.artifact_prefix }}detection
  1395. path: /tmp/gh-aw/threat-detection/
  1396. - name: Download Safe Outputs Items Manifest
  1397. id: download-safe-outputs-manifest
  1398. if: always()
  1399. continue-on-error: true
  1400. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1401. with:
  1402. pattern: ${{ needs.activation.outputs.artifact_prefix }}safe-outputs-items
  1403. merge-multiple: true
  1404. path: /tmp/gh-aw/
  1405. - name: Collect usage artifact files
  1406. if: always()
  1407. continue-on-error: true
  1408. run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
  1409. - name: Upload usage artifact
  1410. id: upload-usage-artifact
  1411. if: always()
  1412. continue-on-error: true
  1413. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1414. with:
  1415. name: ${{ needs.activation.outputs.artifact_prefix }}usage
  1416. path: |
  1417. /tmp/gh-aw/usage/aw_info.json
  1418. /tmp/gh-aw/usage/aw-info.jsonl
  1419. /tmp/gh-aw/usage/agent_usage.json
  1420. /tmp/gh-aw/usage/agent_usage.jsonl
  1421. /tmp/gh-aw/usage/detection_usage.jsonl
  1422. /tmp/gh-aw/usage/evals.jsonl
  1423. /tmp/gh-aw/usage/graders/grader_manifest.json
  1424. /tmp/gh-aw/usage/graders/grader_results.json
  1425. /tmp/gh-aw/usage/github_rate_limits.jsonl
  1426. /tmp/gh-aw/usage/agent/token_usage.jsonl
  1427. /tmp/gh-aw/usage/agent/execution.json
  1428. /tmp/gh-aw/usage/detection/token_usage.jsonl
  1429. /tmp/gh-aw/usage/detection/execution.json
  1430. /tmp/gh-aw/usage/evals/token_usage.jsonl
  1431. /tmp/gh-aw/usage/evals/execution.json
  1432. /tmp/gh-aw/usage/activity/summary.json
  1433. if-no-files-found: ignore
  1434. - name: Wait before retrying usage artifact upload
  1435. if: always() && steps.upload-usage-artifact.outcome == 'failure'
  1436. run: sleep 10
  1437. - name: Retry upload usage artifact
  1438. id: upload-usage-artifact-retry
  1439. if: always() && steps.upload-usage-artifact.outcome == 'failure'
  1440. continue-on-error: true
  1441. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1442. with:
  1443. name: ${{ needs.activation.outputs.artifact_prefix }}usage
  1444. path: |
  1445. /tmp/gh-aw/usage/aw_info.json
  1446. /tmp/gh-aw/usage/aw-info.jsonl
  1447. /tmp/gh-aw/usage/agent_usage.json
  1448. /tmp/gh-aw/usage/agent_usage.jsonl
  1449. /tmp/gh-aw/usage/detection_usage.jsonl
  1450. /tmp/gh-aw/usage/evals.jsonl
  1451. /tmp/gh-aw/usage/graders/grader_manifest.json
  1452. /tmp/gh-aw/usage/graders/grader_results.json
  1453. /tmp/gh-aw/usage/github_rate_limits.jsonl
  1454. /tmp/gh-aw/usage/agent/token_usage.jsonl
  1455. /tmp/gh-aw/usage/agent/execution.json
  1456. /tmp/gh-aw/usage/detection/token_usage.jsonl
  1457. /tmp/gh-aw/usage/detection/execution.json
  1458. /tmp/gh-aw/usage/evals/token_usage.jsonl
  1459. /tmp/gh-aw/usage/evals/execution.json
  1460. /tmp/gh-aw/usage/activity/summary.json
  1461. if-no-files-found: ignore
  1462. overwrite: true
  1463. - name: Process no-op messages
  1464. id: noop
  1465. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1466. env:
  1467. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1468. GH_AW_NOOP_MAX: "1"
  1469. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1470. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1471. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1472. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1473. GH_AW_NOOP_REPORT_AS_ISSUE: "false"
  1474. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1475. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1476. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  1477. GH_AW_WORKFLOW_ID: "issue-handle-bug"
  1478. with:
  1479. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1480. script: |
  1481. const path = require('path');
  1482. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1483. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1484. setupGlobals(core, github, context, exec, io, getOctokit);
  1485. const { main } = require(path.join(actionsDir, 'handle_noop_message.cjs'));
  1486. await main();
  1487. - name: Log detection run
  1488. id: detection_runs
  1489. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1490. env:
  1491. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1492. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1493. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1494. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1495. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1496. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1497. with:
  1498. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1499. script: |
  1500. const path = require('path');
  1501. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1502. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1503. setupGlobals(core, github, context, exec, io, getOctokit);
  1504. const { main } = require(path.join(actionsDir, 'handle_detection_runs.cjs'));
  1505. await main();
  1506. - name: Record missing tool
  1507. id: missing_tool
  1508. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1509. env:
  1510. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1511. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  1512. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1513. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1514. with:
  1515. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1516. script: |
  1517. const path = require('path');
  1518. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1519. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1520. setupGlobals(core, github, context, exec, io, getOctokit);
  1521. const { main } = require(path.join(actionsDir, 'missing_tool.cjs'));
  1522. await main();
  1523. - name: Record incomplete
  1524. id: report_incomplete
  1525. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1526. env:
  1527. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1528. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  1529. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1530. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1531. with:
  1532. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1533. script: |
  1534. const path = require('path');
  1535. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1536. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1537. setupGlobals(core, github, context, exec, io, getOctokit);
  1538. const { main } = require(path.join(actionsDir, 'report_incomplete_handler.cjs'));
  1539. await main();
  1540. - name: Handle agent failure
  1541. id: handle_agent_failure
  1542. if: always()
  1543. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1544. env:
  1545. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1546. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1547. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1548. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1549. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1550. GH_AW_WORKFLOW_ID: "issue-handle-bug"
  1551. GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
  1552. GH_AW_ENGINE_ID: "codex"
  1553. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  1554. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  1555. GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }}
  1556. GH_AW_UNKNOWN_MODEL_AI_CREDITS: ${{ needs.agent.outputs.unknown_model_ai_credits || 'false' }}
  1557. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1558. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1559. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  1560. GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
  1561. GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }}
  1562. GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }}
  1563. GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }}
  1564. GH_AW_HTTP_400_RESPONSE_ERROR: ${{ needs.agent.outputs.http_400_response_error }}
  1565. GH_AW_MAX_CACHE_MISSES_EXCEEDED: ${{ needs.agent.outputs.max_cache_misses_exceeded }}
  1566. GH_AW_MISSING_MODEL_PRICING_ERROR: ${{ needs.agent.outputs.missing_model_pricing_error }}
  1567. GH_AW_MISSING_MODEL_PRICING_MODEL_NAME: ${{ needs.agent.outputs.missing_model_pricing_model_name }}
  1568. GH_AW_SHELL_EXPANSION_GUARD_REJECTED: ${{ needs.agent.outputs.shell_expansion_guard_rejected }}
  1569. GH_AW_ENGINE_API_HOSTS: "api.openai.com"
  1570. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  1571. GH_AW_OAUTH_TOKEN_CHECK_FAILED: ${{ needs.activation.outputs.oauth_token_check_failed }}
  1572. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  1573. GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
  1574. GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
  1575. GH_AW_DAILY_AI_CREDITS_GUARDRAIL_ERROR: ${{ needs.activation.outputs.daily_ai_credits_guardrail_error }}
  1576. GH_AW_DAILY_AI_CREDITS_TOTAL: ${{ needs.activation.outputs.daily_ai_credits_total }}
  1577. GH_AW_DAILY_AI_CREDITS_THRESHOLD: ${{ needs.activation.outputs.daily_ai_credits_threshold }}
  1578. GH_AW_DAILY_AI_CREDITS_CONTINUE_ON_ERROR: "false"
  1579. GH_AW_GROUP_REPORTS: "false"
  1580. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  1581. GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true"
  1582. GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true"
  1583. GH_AW_TIMEOUT_MINUTES: "15"
  1584. with:
  1585. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1586. script: |
  1587. const path = require('path');
  1588. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1589. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1590. setupGlobals(core, github, context, exec, io, getOctokit);
  1591. const { main } = require(path.join(actionsDir, 'handle_agent_failure.cjs'));
  1592. await main();
  1593. - name: Report failed jobs
  1594. id: report_failed_jobs
  1595. if: always()
  1596. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1597. env:
  1598. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1599. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1600. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1601. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1602. GH_AW_REPORT_FAILED_JOBS: "true"
  1603. with:
  1604. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1605. script: |
  1606. const path = require('path');
  1607. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1608. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1609. setupGlobals(core, github, context, exec, io, getOctokit);
  1610. const { main } = require(path.join(actionsDir, 'report_failed_jobs.cjs'));
  1611. await main();
  1612. detection:
  1613. needs:
  1614. - activation
  1615. - agent
  1616. if: always() && needs.agent.result != 'skipped'
  1617. runs-on: ubuntu-latest
  1618. permissions:
  1619. contents: read
  1620. timeout-minutes: 10
  1621. env:
  1622. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1623. outputs:
  1624. aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
  1625. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  1626. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  1627. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  1628. steps:
  1629. - name: Setup Scripts
  1630. id: setup
  1631. uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  1632. with:
  1633. destination: ${{ runner.temp }}/gh-aw/actions
  1634. job-name: ${{ github.job }}
  1635. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1636. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1637. env:
  1638. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Bug"
  1639. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-bug.lock.yml@${{ github.ref }}
  1640. GH_AW_INFO_VERSION: "0.154.0"
  1641. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  1642. GH_AW_INFO_ENGINE_ID: "codex"
  1643. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1644. - name: Download activation artifact
  1645. continue-on-error: true
  1646. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1647. with:
  1648. name: ${{ needs.activation.outputs.artifact_prefix }}activation
  1649. path: /tmp/gh-aw
  1650. - name: Download agent output artifact
  1651. id: download-agent-output
  1652. continue-on-error: true
  1653. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1654. with:
  1655. pattern: "{${{ needs.agent.outputs.artifact_prefix }}agent,${{ needs.agent.outputs.artifact_prefix }}agent-output-fallback}"
  1656. merge-multiple: true
  1657. path: /tmp/gh-aw/
  1658. - name: Setup agent output environment variable
  1659. id: setup-agent-output-env
  1660. if: steps.download-agent-output.outcome == 'success'
  1661. run: |
  1662. mkdir -p /tmp/gh-aw/
  1663. find "/tmp/gh-aw/" -type f -print
  1664. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  1665. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1666. fi
  1667. - name: Checkout repository for patch context
  1668. if: needs.agent.outputs.has_patch == 'true'
  1669. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  1670. with:
  1671. persist-credentials: false
  1672. # --- Threat Detection ---
  1673. - name: Initialize detection execution evidence
  1674. run: |
  1675. mkdir -p "/tmp/gh-aw/threat-detection"
  1676. evidence_tmp="/tmp/gh-aw/threat-detection/execution.json.tmp"
  1677. printf '{"version":1,"component":"detection","run_id":%s,"run_attempt":%s,"state":"not_started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  1678. mv "$evidence_tmp" "/tmp/gh-aw/threat-detection/execution.json"
  1679. - name: Clear inherited Copilot session state
  1680. run: rm -rf /tmp/gh-aw/sandbox/agent/logs/copilot-session-state
  1681. - name: Clean stale firewall files from agent artifact
  1682. run: |
  1683. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  1684. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  1685. - name: Download container images
  1686. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.28.23@sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2 ghcr.io/github/gh-aw-firewall/api-proxy:0.28.23@sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64 ghcr.io/github/gh-aw-firewall/squid:0.28.23@sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0
  1687. - name: Check if detection needed
  1688. id: detection_guard
  1689. if: always()
  1690. env:
  1691. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1692. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1693. run: |
  1694. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1695. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1696. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1697. else
  1698. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1699. echo "Detection skipped: no agent outputs or patches to analyze"
  1700. fi
  1701. - name: Clear MCP Config for detection
  1702. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1703. run: |
  1704. rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  1705. rm -f "$HOME/.copilot/mcp-config.json"
  1706. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1707. - name: Prepare threat detection files
  1708. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1709. run: |
  1710. bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
  1711. - name: Setup threat detection
  1712. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1713. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1714. env:
  1715. WORKFLOW_NAME: "Issue Handle Bug"
  1716. WORKFLOW_DESCRIPTION: "处理分类为 bug 的 issue,进行深入分析并给出修复建议"
  1717. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1718. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1719. GH_AW_DETECTION_SKIP_PROMPT_SUMMARY: "true"
  1720. with:
  1721. script: |
  1722. const path = require('path');
  1723. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1724. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1725. setupGlobals(core, github, context, exec, io, getOctokit);
  1726. const { main } = require(path.join(actionsDir, 'setup_threat_detection.cjs'));
  1727. await main();
  1728. - name: Ensure threat-detection directory and log
  1729. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1730. run: |
  1731. mkdir -p /tmp/gh-aw/threat-detection
  1732. touch /tmp/gh-aw/threat-detection/detection.log
  1733. - name: Install AWF binary
  1734. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.28.23 --rootless
  1735. - name: Setup Node.js
  1736. uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  1737. with:
  1738. node-version: '24'
  1739. package-manager-cache: false
  1740. - name: Install Codex CLI
  1741. run: npm install --ignore-scripts -g @openai/codex@0.154.0
  1742. - name: Prepare Codex config for threat-detect
  1743. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1744. run: |
  1745. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" "/tmp/gh-aw/mcp-config" "/tmp/gh-aw/mcp-config/logs/"
  1746. printf '%s\n' "{\"mcpServers\":{}}" > "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  1747. # Point Codex at the AWF OpenAI proxy and disable websocket startup.
  1748. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_DETECTION_CONFIG_af28c8b5454431f5_EOF
  1749. model_provider = "openai-proxy"
  1750. [history]
  1751. persistence = "none"
  1752. [model_providers.openai-proxy]
  1753. name = "OpenAI AWF proxy"
  1754. base_url = "http://172.30.0.30:10000"
  1755. api_base = "http://172.30.0.30:10000"
  1756. wss_base = "ws://172.30.0.30:10000"
  1757. env_key = "CODEX_API_KEY"
  1758. wire_api = "responses"
  1759. requires_openai_auth = false
  1760. supports_websockets = false
  1761. GH_AW_CODEX_DETECTION_CONFIG_af28c8b5454431f5_EOF
  1762. cp "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" "/tmp/gh-aw/mcp-config/config.toml"
  1763. chmod 600 "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" "/tmp/gh-aw/mcp-config/config.toml"
  1764. - name: Install threat-detect binary
  1765. id: threat_detect_install
  1766. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1767. continue-on-error: true
  1768. run: |
  1769. bash "${RUNNER_TEMP}/gh-aw/actions/install_threat_detect_binary.sh" v0.5.2 --artifact-base-url https://github.com/github/gh-aw-threat-detection/releases/download --sha256-amd64 b4ecda6a8f1ee09913c40b58e5e9d3337d2173618d41b1bfdef9207e4e7959b9 --sha256-arm64 f6260a0f9ad72bcb67c7af19c4ce262ca34e2c3d5ccbf912832a8bd277200904
  1770. - name: Execute threat detection with AWF
  1771. id: detection_agentic_execution
  1772. if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.threat_detect_install.outcome == 'success'
  1773. continue-on-error: true
  1774. timeout-minutes: 10
  1775. env:
  1776. AWF_REFLECT_ENABLED: 1
  1777. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1778. CODEX_HOME: /tmp/gh-aw/mcp-config
  1779. GH_AW_HARNESS_MAX_RETRIES: 0
  1780. GH_AW_LLM_PROVIDER: openai
  1781. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
  1782. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  1783. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  1784. GH_AW_MODEL_DETECTION_CODEX: gpt-5.6-luna
  1785. GH_AW_PHASE: detection
  1786. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1787. GH_AW_VERSION: v0.89.21
  1788. GITHUB_AW: true
  1789. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1790. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1791. GIT_AUTHOR_NAME: github-actions[bot]
  1792. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1793. GIT_COMMITTER_NAME: github-actions[bot]
  1794. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1795. OPENAI_BASE_URL: https://ai-pixel.online
  1796. RUNNER_TEMP: ${{ runner.temp }}
  1797. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,codex_exec=debug' || 'warn' }}
  1798. TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }}
  1799. WORKFLOW_NAME: "Issue Handle Bug"
  1800. WORKFLOW_DESCRIPTION: "处理分类为 bug 的 issue,进行深入分析并给出修复建议"
  1801. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1802. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1803. run: |
  1804. mkdir -p "/tmp/gh-aw/threat-detection"
  1805. evidence_tmp="/tmp/gh-aw/threat-detection/execution.json.tmp"
  1806. printf '{"version":1,"component":"detection","run_id":%s,"run_attempt":%s,"state":"started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  1807. mv "$evidence_tmp" "/tmp/gh-aw/threat-detection/execution.json"
  1808. export GH_AW_AWF_EXECUTION_COMPONENT="detection"
  1809. export GH_AW_AWF_EXECUTION_EVIDENCE_FILE="/tmp/gh-aw/threat-detection/execution.json"
  1810. set -o pipefail
  1811. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  1812. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  1813. GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
  1814. if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^[0-9]+$ ]]; then
  1815. GH_AW_MAX_AI_CREDITS="400"
  1816. fi
  1817. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.28.23/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"172.30.0.1\",\"ai-pixel.online\",\"api-inference.modelscope.cn\",\"api.commandcode.ai\",\"api.deepseek.com\",\"api.github.com\",\"api.minimaxi.com\",\"api.openai.com\",\"chatgpt.com\",\"github.com\",\"host.docker.internal\",\"open.bigmodel.cn\",\"openai.com\",\"opencode.ai\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"modelFallback\":{\"enabled\":false},\"targets\":{\"openai\":{\"host\":\"ai-pixel.online\"}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-6\",\"gpt-5.4\",\"gpt-5.5\",\"gpt-5.6\",\"gpt-5.3\",\"gemini-pro\",\"any\"],\"antigravity\":[\"copilot/antigravity*\",\"google/antigravity*\",\"gemini/antigravity*\"],\"any\":[\"copilot/*\",\"anthropic/*\",\"openai/*\",\"google/*\",\"gemini/*\"],\"auto\":[\"copilot/auto\",\"large\"],\"claude\":[\"agent\"],\"codex\":[\"agent\"],\"coding\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\",\"gpt-5-codex\",\"kimi\"],\"computer-use\":[\"copilot/*computer-use*\",\"google/*computer-use*\",\"gemini/*computer-use*\",\"openai/*computer-use*\"],\"copilot\":[\"agent\"],\"deep-research\":[\"copilot/deep-research*\",\"copilot/o3-deep-research*\",\"copilot/o4-mini-deep-research*\",\"google/deep-research*\",\"gemini/deep-research*\",\"openai/o3-deep-research*\",\"openai/o4-mini-deep-research*\"],\"detection\":[\"small\"],\"evals\":[\"small\"],\"fable\":[\"copilot/*fable*\",\"anthropic/*fable*\"],\"gemini\":[\"agent\"],\"gemini-3-flash\":[\"copilot/gemini-3*flash*\",\"google/gemini-3*flash*\",\"gemini/gemini-3*flash*\"],\"gemini-3-pro\":[\"copilot/gemini-3*pro*\",\"google/gemini-3*pro*\",\"google/nano-banana*\",\"gemini/gemini-3*pro*\"],\"gemini-3.1-flash\":[\"copilot/gemini-3.1*flash*\",\"google/gemini-3.1*flash*\",\"gemini/gemini-3.1*flash*\"],\"gemini-3.1-pro\":[\"copilot/gemini-3.1*pro*\",\"google/gemini-3.1*pro*\",\"gemini/gemini-3.1*pro*\"],\"gemini-3.5-flash\":[\"copilot/gemini-3.5*flash*\",\"google/gemini-3.5*flash*\",\"gemini/gemini-3.5*flash*\"],\"gemini-3.6-flash\":[\"copilot/gemini-3.6*flash*\",\"google/gemini-3.6*flash*\",\"gemini/gemini-3.6*flash*\"],\"gemini-3.7-flash\":[\"copilot/gemini-3.7*flash*\",\"google/gemini-3.7*flash*\",\"gemini/gemini-3.7*flash*\"],\"gemini-3.8-flash\":[\"copilot/gemini-3.8*flash*\",\"google/gemini-3.8*flash*\",\"gemini/gemini-3.8*flash*\"],\"gemini-flash\":[\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"],\"gemini-flash-lite\":[\"copilot/gemini-*flash*lite*\",\"google/gemini-*flash*lite*\",\"gemini/gemini-*flash*lite*\"],\"gemini-omni\":[\"copilot/gemini-omni*\",\"google/gemini-omni*\",\"gemini/gemini-omni*\"],\"gemini-pro\":[\"copilot/gemini-*pro*\",\"google/gemini-*pro*\",\"gemini/gemini-*pro*\"],\"gemma\":[\"copilot/gemma*\",\"google/gemma*\",\"gemini/gemma*\"],\"gpt-5\":[\"copilot/gpt-5*\",\"openai/gpt-5*\"],\"gpt-5-codex\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\"],\"gpt-5-mini\":[\"copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"],\"gpt-5-nano\":[\"copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"],\"gpt-5-pro\":[\"copilot/gpt-5*pro*\",\"openai/gpt-5*pro*\"],\"gpt-5.1\":[\"copilot/gpt-5.1*\",\"openai/gpt-5.1*\"],\"gpt-5.2\":[\"copilot/gpt-5.2*\",\"openai/gpt-5.2*\"],\"gpt-5.3\":[\"copilot/gpt-5.3*\",\"openai/gpt-5.3*\"],\"gpt-5.4\":[\"copilot/gpt-5.4*\",\"openai/gpt-5.4*\"],\"gpt-5.5\":[\"copilot/gpt-5.5*\",\"openai/gpt-5.5*\"],\"gpt-5.6\":[\"copilot/gpt-5.6*\",\"openai/gpt-5.6*\"],\"gpt-6\":[\"copilot/gpt-6*\",\"openai/gpt-6*\"],\"grok\":[\"copilot/*grok*\",\"openai/*grok*\"],\"haiku\":[\"copilot/*haiku*\",\"anthropic/*haiku*\"],\"image-generation\":[\"copilot/gpt-image*\",\"openai/gpt-image*\",\"openai/chatgpt-image*\",\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"google/imagen*\"],\"kimi\":[\"copilot/kimi*\",\"openai/kimi*\"],\"kiwi\":[\"copilot/kiwi*\",\"openai/kiwi*\"],\"large\":[\"sonnet\",\"gpt-6\",\"gpt-5-pro\",\"gpt-5\",\"gemini-pro\"],\"lyria\":[\"google/lyria*\",\"gemini/lyria*\",\"copilot/lyria*\"],\"mai-code\":[\"copilot/MAI-Code*\",\"copilot/mai-code*\",\"openai/MAI-Code*\"],\"mai-code-1-flash-picker\":[\"copilot/MAI-Code-1-Flash-picker*\",\"copilot/mai-code-1-flash-picker*\",\"openai/MAI-Code-1-Flash-picker*\"],\"mini\":[\"haiku\",\"gpt-5-mini\",\"gpt-5-nano\",\"gemini-flash-lite\"],\"nano-banana\":[\"copilot/nano-banana*\",\"google/nano-banana*\",\"gemini/nano-banana*\"],\"opus\":[\"copilot/*opus*\",\"anthropic/*opus*\"],\"opusplan\":[\"opus?effort=high\"],\"raptor-mini\":[\"copilot/raptor*\",\"openai/raptor*\"],\"reasoning\":[\"copilot/o1*\",\"copilot/o3*\",\"copilot/o4*\",\"openai/o1*\",\"openai/o3*\",\"openai/o4*\"],\"robotics\":[\"copilot/*robotics*\",\"google/*robotics*\",\"gemini/*robotics*\"],\"small\":[\"mini\"],\"small-agent\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash\"],\"sonnet\":[\"copilot/*sonnet*\",\"anthropic/*sonnet*\"],\"sonnet-6x\":[\"copilot/*sonnet-4.5*\",\"copilot/*sonnet-4.6*\",\"copilot/*sonnet-5*\",\"copilot/*sonnet-4-5-*\",\"anthropic/*sonnet-4-5-*\",\"copilot/*sonnet-4-6*\",\"anthropic/*sonnet-4-6*\",\"anthropic/*sonnet-5*\"],\"summarization\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash-lite\",\"mini\"],\"veo\":[\"google/veo*\",\"gemini/veo*\"],\"vision\":[\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"]}},\"container\":{\"imageTag\":\"0.28.23,squid=sha256:02ffc56dd40158223064ef03a78c2d9717473c93723b4e403d455ea6f0b09ae0,agent=sha256:2c78aaba1c108e130e2d6d01e4f2cca334ea04c53e6f258913ac34173fe7e3b2,api-proxy=sha256:c15c3d1208df10c5b588a3657be53742aa982ae0909d1eb1812525268794ca64,cli-proxy=sha256:9e31a6e518eba44652b9ae94ce55c3b6958e06290c3b81b08de4174751bb439a\"},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1818. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  1819. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  1820. GH_AW_DOCKER_HOST=""
  1821. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1822. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  1823. fi
  1824. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1825. _GH_AW_CHROOT_JSON=$(jq -c --arg src "${RUNNER_TEMP}/gh-aw" --arg user "$(id -un)" --argjson uid "$(id -u)" --argjson gid "$(id -g)" --arg home "${RUNNER_TEMP}/gh-aw/home" '.chroot={"binariesSourcePath":$src,"identity":{"user":$user,"uid":$uid,"gid":$gid,"home":$home}}' "${RUNNER_TEMP}/gh-aw/awf-config.json") || { echo "chroot config patch failed" >&2; exit 1; }
  1826. printf '%s\n' "$_GH_AW_CHROOT_JSON" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1827. fi
  1828. GH_AW_TOOL_CACHE_MOUNT=""
  1829. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  1830. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  1831. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  1832. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  1833. fi
  1834. fi
  1835. # shellcheck disable=SC1003,SC2016,SC2086
  1836. awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env CODEX_API_KEY --exclude-env COPILOT_GITHUB_TOKEN --exclude-env OPENAI_API_KEY --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --skip-pull \
  1837. -- /bin/bash -c 'set +o histexpand; : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && threat-detect --engine codex --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
  1838. - name: Render detection log
  1839. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1840. continue-on-error: true
  1841. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1842. with:
  1843. script: |
  1844. const path = require('path');
  1845. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1846. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1847. setupGlobals(core, github, context, exec, io, getOctokit);
  1848. const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
  1849. await main();
  1850. - name: Copy detection firewall logs
  1851. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1852. continue-on-error: true
  1853. run: |
  1854. mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall
  1855. if [ -d /tmp/gh-aw/sandbox/firewall/logs ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/logs && cp -r /tmp/gh-aw/sandbox/firewall/logs/. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/; fi
  1856. if [ -d /tmp/gh-aw/sandbox/firewall/audit ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/audit && cp -r /tmp/gh-aw/sandbox/firewall/audit/. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/; fi
  1857. - name: Parse threat detection token usage for step summary
  1858. id: parse_detection_token_usage
  1859. if: always()
  1860. continue-on-error: true
  1861. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1862. env:
  1863. GH_AW_TOKEN_USAGE_SUMMARY_TITLE: Threat Detection Token Usage
  1864. GH_AW_AGENT_USAGE_PATH: /tmp/gh-aw/threat-detection/detection_usage.json
  1865. GH_AW_AGENT_USAGE_JSONL_PATH: /tmp/gh-aw/threat-detection/detection_usage.jsonl
  1866. GH_AW_WRITE_EMPTY_USAGE: "true"
  1867. with:
  1868. script: |
  1869. const path = require('path');
  1870. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1871. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1872. setupGlobals(core, github, context, exec, io, getOctokit);
  1873. const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
  1874. await main();
  1875. - name: Upload threat detection artifact
  1876. if: always()
  1877. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1878. with:
  1879. name: ${{ needs.agent.outputs.artifact_prefix }}detection
  1880. path: |
  1881. /tmp/gh-aw/threat-detection/detection_result.json
  1882. /tmp/gh-aw/threat-detection/execution.json
  1883. /tmp/gh-aw/threat-detection/detection_usage.json
  1884. /tmp/gh-aw/threat-detection/detection_usage.jsonl
  1885. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/
  1886. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/
  1887. if-no-files-found: ignore
  1888. - name: Conclude threat detection
  1889. id: detection_conclusion
  1890. if: always()
  1891. continue-on-error: true
  1892. env:
  1893. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  1894. DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
  1895. THREAT_DETECT_INSTALL_OUTCOME: ${{ steps.threat_detect_install.outcome }}
  1896. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1897. run: |
  1898. bash "${RUNNER_TEMP}/gh-aw/actions/conclude_threat_detection.sh" /tmp/gh-aw/threat-detection/detection_result.json
  1899. safe_outputs:
  1900. needs:
  1901. - activation
  1902. - agent
  1903. - detection
  1904. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  1905. runs-on: ubuntu-slim
  1906. permissions:
  1907. issues: write
  1908. pull-requests: write
  1909. timeout-minutes: 45
  1910. env:
  1911. GH_AW_AGENT_AIC: ${{ needs.agent.outputs.aic }}
  1912. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1913. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  1914. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-handle-bug"
  1915. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1916. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1917. GH_AW_ENGINE_ID: "codex"
  1918. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  1919. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1920. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1921. GH_AW_WORKFLOW_ID: "issue-handle-bug"
  1922. GH_AW_WORKFLOW_NAME: "Issue Handle Bug"
  1923. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-bug.md"
  1924. outputs:
  1925. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  1926. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  1927. comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }}
  1928. comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }}
  1929. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  1930. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  1931. process_safe_outputs_items_applied: ${{ steps.process_safe_outputs.outputs.items_applied }}
  1932. process_safe_outputs_items_cancelled: ${{ steps.process_safe_outputs.outputs.items_cancelled }}
  1933. process_safe_outputs_items_deferred: ${{ steps.process_safe_outputs.outputs.items_deferred }}
  1934. process_safe_outputs_items_failed: ${{ steps.process_safe_outputs.outputs.items_failed }}
  1935. process_safe_outputs_items_skipped: ${{ steps.process_safe_outputs.outputs.items_skipped }}
  1936. process_safe_outputs_items_succeeded: ${{ steps.process_safe_outputs.outputs.items_succeeded }}
  1937. process_safe_outputs_items_warnings: ${{ steps.process_safe_outputs.outputs.items_warnings }}
  1938. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  1939. process_safe_outputs_status: ${{ steps.process_safe_outputs.outputs.status }}
  1940. steps:
  1941. - name: Setup Scripts
  1942. id: setup
  1943. uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
  1944. with:
  1945. destination: ${{ runner.temp }}/gh-aw/actions
  1946. job-name: ${{ github.job }}
  1947. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1948. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1949. env:
  1950. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Bug"
  1951. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-bug.lock.yml@${{ github.ref }}
  1952. GH_AW_INFO_VERSION: "0.154.0"
  1953. GH_AW_INFO_AWF_VERSION: "v0.28.23"
  1954. GH_AW_INFO_ENGINE_ID: "codex"
  1955. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1956. - name: Mask OTLP telemetry headers
  1957. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  1958. - name: Download agent output artifact
  1959. id: download-agent-output
  1960. continue-on-error: true
  1961. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1962. with:
  1963. pattern: "{${{ needs.activation.outputs.artifact_prefix }}agent,${{ needs.activation.outputs.artifact_prefix }}agent-output-fallback}"
  1964. merge-multiple: true
  1965. path: /tmp/gh-aw/
  1966. - name: Setup agent output environment variable
  1967. id: setup-agent-output-env
  1968. if: steps.download-agent-output.outcome == 'success'
  1969. run: |
  1970. mkdir -p /tmp/gh-aw/
  1971. find "/tmp/gh-aw/" -type f -print
  1972. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  1973. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1974. fi
  1975. - name: Configure GH_HOST for enterprise compatibility
  1976. id: ghes-host-config
  1977. shell: bash
  1978. run: | # zizmor: ignore[github-env] - GITHUB_SERVER_URL is set by GitHub Actions, not user input.
  1979. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  1980. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  1981. GH_HOST="${GITHUB_SERVER_URL#https://}"
  1982. GH_HOST="${GH_HOST#http://}"
  1983. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  1984. - name: Process Safe Outputs
  1985. id: process_safe_outputs
  1986. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1987. env:
  1988. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1989. GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }}
  1990. GH_AW_ALLOWED_DOMAINS: "ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.minimaxi.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,opencode.ai,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  1991. GITHUB_SERVER_URL: ${{ github.server_url }}
  1992. GITHUB_API_URL: ${{ github.api_url }}
  1993. GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1,\"target\":\"${{ inputs.issue_number }}\"},\"add_labels\":{\"max\":3,\"target\":\"${{ inputs.issue_number }}\"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"update_issue\":{\"allow_body\":true,\"max\":1,\"target\":\"${{ inputs.issue_number }}\"}}"
  1994. with:
  1995. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1996. script: |
  1997. const path = require('path');
  1998. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1999. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2000. setupGlobals(core, github, context, exec, io, getOctokit);
  2001. const { main } = require(path.join(actionsDir, 'process_safe_outputs.cjs'));
  2002. await main();
  2003. - name: Upload Safe Outputs Items
  2004. if: always()
  2005. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  2006. with:
  2007. name: ${{ needs.activation.outputs.artifact_prefix }}safe-outputs-items
  2008. path: |
  2009. /tmp/gh-aw/safe-output-items.jsonl
  2010. /tmp/gh-aw/temporary-id-map.json
  2011. /tmp/gh-aw/safe-output-errors.json
  2012. if-no-files-found: ignore