mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 05:50:04 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3669671a7 | ||
|
|
327f1f103c |
@@ -5,10 +5,10 @@
|
||||
"version": "v9.0.0",
|
||||
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
||||
},
|
||||
"github/gh-aw-actions/setup@v1.4.5": {
|
||||
"github/gh-aw-actions/setup@v1.4.6": {
|
||||
"repo": "github/gh-aw-actions/setup",
|
||||
"version": "v1.4.5",
|
||||
"sha": "a83eaf07e756a15e65f669eb32d00787cf5a2569"
|
||||
"version": "v1.4.6",
|
||||
"sha": "a2b1229fe98b05bde43bbab67d4985650da08514"
|
||||
}
|
||||
},
|
||||
"containers": {
|
||||
|
||||
@@ -265,6 +265,14 @@ jobs:
|
||||
node-version: '26.14.0'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Pnpm install and check
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run prebuild ${{ matrix.target }}
|
||||
|
||||
- name: Release ${{ env.TAG_CHANNEL }} Version
|
||||
run: pnpm release-version autobuild-latest
|
||||
|
||||
- name: 'Setup for linux'
|
||||
run: |-
|
||||
sudo ls -lR /etc/apt/
|
||||
@@ -309,14 +317,6 @@ jobs:
|
||||
gcc-arm-linux-gnueabihf \
|
||||
g++-arm-linux-gnueabihf
|
||||
|
||||
- name: Pnpm install and check
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run prebuild ${{ matrix.target }}
|
||||
|
||||
- name: Release ${{ env.TAG_CHANNEL }} Version
|
||||
run: pnpm release-version autobuild-latest
|
||||
|
||||
- name: Tauri Build for Linux
|
||||
run: |
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
||||
|
||||
@@ -31,9 +31,9 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install gh-aw extension
|
||||
uses: github/gh-aw-actions/setup-cli@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup-cli@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
version: v1.4.5
|
||||
version: v1.4.6
|
||||
- name: Install Rust Stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
||||
@@ -107,14 +107,6 @@ jobs:
|
||||
node-version: '26.14.0'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Add Rust Target
|
||||
if: github.event.inputs[matrix.input] == 'true'
|
||||
run: |
|
||||
# Ensure cross target is installed for the pinned toolchain; fallback without explicit toolchain if needed
|
||||
rustup target add ${{ matrix.target }} --toolchain 1.100.1 || rustup target add ${{ matrix.target }}
|
||||
rustup target list --installed
|
||||
echo "Rust target ${{ matrix.target }} installed."
|
||||
|
||||
- name: Pnpm install and check
|
||||
if: github.event.inputs[matrix.input] == 'true'
|
||||
run: |
|
||||
@@ -125,6 +117,14 @@ jobs:
|
||||
if: github.event.inputs[matrix.input] == 'true'
|
||||
run: pnpm release-version ${{ env.TAG_NAME }}
|
||||
|
||||
- name: Add Rust Target
|
||||
if: github.event.inputs[matrix.input] == 'true'
|
||||
run: |
|
||||
# Ensure cross target is installed for the pinned toolchain; fallback without explicit toolchain if needed
|
||||
rustup target add ${{ matrix.target }} --toolchain 1.100.1 || rustup target add ${{ matrix.target }}
|
||||
rustup target list --installed
|
||||
echo "Rust target ${{ matrix.target }} installed."
|
||||
|
||||
- name: Tauri build
|
||||
if: github.event.inputs[matrix.input] == 'true'
|
||||
uses: tauri-apps/tauri-action@v1
|
||||
|
||||
+54
-47
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -42,9 +42,9 @@
|
||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -150,9 +150,9 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
@@ -558,7 +558,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -567,7 +567,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -614,7 +614,7 @@ jobs:
|
||||
script: "const fs = require('fs');\nconst number = process.env.PR_NUMBER;\nif (!/^[1-9][0-9]*$/.test(number)) throw new Error('A PR number is required');\nconst params = { ...context.repo, pull_number: Number(number) };\nconst { data: pr } = await github.rest.pulls.get(params);\nif (process.env.EXPECTED_HEAD && pr.head.sha !== process.env.EXPECTED_HEAD) {\n throw new Error('PR head changed after trigger; await the newer run');\n}\nconst { data: files } = await github.rest.pulls.listFiles({ ...params, per_page: 100 });\nconst body = pr.body || '';\nconst snapshot = {\n repository: `${context.repo.owner}/${context.repo.repo}`,\n number: pr.number, url: pr.html_url, state: pr.state, draft: pr.draft,\n title: pr.title, body: body.slice(0, 12000), body_truncated: body.length > 12000,\n created_at: pr.created_at, author: pr.user.login,\n base_sha: pr.base.sha, head_sha: pr.head.sha,\n head_repository: pr.head.repo?.full_name,\n labels: pr.labels.map(label => label.name),\n changed_files: pr.changed_files, files_truncated: pr.changed_files > files.length,\n files: files.map(({ filename, previous_filename, status, additions, deletions }) =>\n ({ filename, previous_filename, status, additions, deletions })),\n};\nfs.mkdirSync('/tmp/gh-aw/agent', { recursive: true });\nfs.writeFileSync('/tmp/gh-aw/agent/pr-context.json', JSON.stringify(snapshot));\n"
|
||||
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1088,7 +1088,7 @@ jobs:
|
||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
-- /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/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||
env:
|
||||
AWF_REFLECT_ENABLED: 1
|
||||
@@ -1104,7 +1104,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1265,6 +1265,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||
await main();
|
||||
- name: Print AWF reflect summary
|
||||
id: awf_reflect_summary
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
@@ -1314,7 +1315,7 @@ jobs:
|
||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
@@ -1395,7 +1396,7 @@ jobs:
|
||||
/tmp/gh-aw/awf-resolved-config.json
|
||||
/tmp/gh-aw/sandbox/firewall/logs/
|
||||
/tmp/gh-aw/sandbox/firewall/audit/
|
||||
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
|
||||
@@ -1436,7 +1437,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1445,7 +1446,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1552,6 +1553,9 @@ jobs:
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
with:
|
||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
@@ -1630,6 +1634,9 @@ jobs:
|
||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
GH_AW_MAX_AI_CREDITS: "60"
|
||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||
@@ -1689,10 +1696,6 @@ jobs:
|
||||
- name: Collect usage artifact files
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||
- name: Generate usage activity summary and unified session
|
||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||
@@ -1701,6 +1704,9 @@ jobs:
|
||||
env:
|
||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||
@@ -1808,6 +1814,8 @@ jobs:
|
||||
outputs:
|
||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||
@@ -1815,7 +1823,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1824,7 +1832,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1882,6 +1890,7 @@ jobs:
|
||||
run: |
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Check if detection needed
|
||||
@@ -1915,12 +1924,12 @@ jobs:
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version: '24'
|
||||
package-manager-cache: false
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1944,7 +1953,7 @@ jobs:
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -1986,7 +1995,7 @@ jobs:
|
||||
fi
|
||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||
@@ -2023,8 +2032,9 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
# shellcheck disable=SC1003,SC2016,SC2086
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
||||
- name: Copy detection firewall logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
@@ -2086,20 +2096,14 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
- name: Validate threat detection verdict files
|
||||
id: validate_detection_results
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
env:
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2119,6 +2123,7 @@ jobs:
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||
@@ -2152,6 +2157,8 @@ jobs:
|
||||
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-ai-slop-review"
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_ENGINE_ID: "copilot"
|
||||
@@ -2187,7 +2194,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -2196,7 +2203,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
|
||||
Generated
+56
-49
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -41,9 +41,9 @@
|
||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -163,9 +163,9 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -284,7 +284,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
@@ -596,7 +596,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -605,7 +605,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -656,7 +656,7 @@ jobs:
|
||||
script: "const fs = require('fs');\nconst root = '/tmp/gh-aw/agent';\nconst pr = JSON.parse(fs.readFileSync(`${root}/pr-context.json`, 'utf8'));\nconst rules = ['AGENTS.md', 'REVIEW.md', 'CONTRIBUTING.md'];\nfor (const dir of ['src', 'src-tauri']) {\n if (pr.files_truncated || pr.files.some(file =>\n [file.filename, file.previous_filename].some(name => name?.startsWith(`${dir}/`)))) {\n rules.push(`${dir}/AGENTS.md`);\n }\n}\nfor (const path of rules) {\n const { data } = await github.rest.repos.getContent({ ...context.repo, path, ref: pr.base_sha });\n if (data.encoding !== 'base64') throw new Error(`Cannot read base rules: ${path}`);\n const target = `${root}/rules/${path}`;\n fs.mkdirSync(require('path').dirname(target), { recursive: true });\n fs.writeFileSync(target, Buffer.from(data.content, 'base64'));\n}"
|
||||
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1090,7 +1090,7 @@ jobs:
|
||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
-- /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/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||
env:
|
||||
AWF_REFLECT_ENABLED: 1
|
||||
@@ -1105,7 +1105,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1267,6 +1267,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||
await main();
|
||||
- name: Print AWF reflect summary
|
||||
id: awf_reflect_summary
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
@@ -1316,7 +1317,7 @@ jobs:
|
||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
@@ -1397,7 +1398,7 @@ jobs:
|
||||
/tmp/gh-aw/awf-resolved-config.json
|
||||
/tmp/gh-aw/sandbox/firewall/logs/
|
||||
/tmp/gh-aw/sandbox/firewall/audit/
|
||||
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
|
||||
@@ -1438,7 +1439,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1447,7 +1448,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1554,6 +1555,9 @@ jobs:
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
with:
|
||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
@@ -1632,6 +1636,9 @@ jobs:
|
||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
GH_AW_MAX_AI_CREDITS: "60"
|
||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||
@@ -1691,10 +1698,6 @@ jobs:
|
||||
- name: Collect usage artifact files
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||
- name: Generate usage activity summary and unified session
|
||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||
@@ -1703,6 +1706,9 @@ jobs:
|
||||
env:
|
||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||
@@ -1810,6 +1816,8 @@ jobs:
|
||||
outputs:
|
||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||
@@ -1817,7 +1825,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1826,7 +1834,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1884,6 +1892,7 @@ jobs:
|
||||
run: |
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Check if detection needed
|
||||
@@ -1917,12 +1926,12 @@ jobs:
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version: '24'
|
||||
package-manager-cache: false
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1946,7 +1955,7 @@ jobs:
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -1988,7 +1997,7 @@ jobs:
|
||||
fi
|
||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||
@@ -2025,8 +2034,9 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
# shellcheck disable=SC1003,SC2016,SC2086
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
||||
- name: Copy detection firewall logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
@@ -2088,20 +2098,14 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
- name: Validate threat detection verdict files
|
||||
id: validate_detection_results
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
env:
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2121,6 +2125,7 @@ jobs:
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||
@@ -2150,14 +2155,14 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -2210,6 +2215,8 @@ jobs:
|
||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-verify-fix"
|
||||
GH_AW_COMMANDS: "[\"verify-fix\"]"
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_ENGINE_ID: "copilot"
|
||||
@@ -2245,7 +2252,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -2254,7 +2261,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
|
||||
@@ -333,6 +333,11 @@ jobs:
|
||||
node-version: '26.14.0'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Pnpm install and check
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run prebuild ${{ matrix.target }}
|
||||
|
||||
- name: 'Setup for linux'
|
||||
run: |-
|
||||
sudo ls -lR /etc/apt/
|
||||
@@ -377,11 +382,6 @@ jobs:
|
||||
gcc-arm-linux-gnueabihf \
|
||||
g++-arm-linux-gnueabihf
|
||||
|
||||
- name: Pnpm install and check
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run prebuild ${{ matrix.target }}
|
||||
|
||||
- name: Build for Linux
|
||||
run: |
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
||||
|
||||
+54
-47
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["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"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -41,9 +41,9 @@
|
||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -153,9 +153,9 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -274,7 +274,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
@@ -562,7 +562,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -571,7 +571,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -637,7 +637,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1078,7 +1078,7 @@ jobs:
|
||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
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_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||
-- /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/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-tool github --allow-tool safeoutputs --allow-tool shell --allow-tool write --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||
env:
|
||||
AWF_REFLECT_ENABLED: 1
|
||||
@@ -1094,7 +1094,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1261,6 +1261,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||
await main();
|
||||
- name: Print AWF reflect summary
|
||||
id: awf_reflect_summary
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
@@ -1310,7 +1311,7 @@ jobs:
|
||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
@@ -1391,7 +1392,7 @@ jobs:
|
||||
/tmp/gh-aw/awf-resolved-config.json
|
||||
/tmp/gh-aw/sandbox/firewall/logs/
|
||||
/tmp/gh-aw/sandbox/firewall/audit/
|
||||
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
|
||||
@@ -1432,7 +1433,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1441,7 +1442,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1548,6 +1549,9 @@ jobs:
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
with:
|
||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
@@ -1626,6 +1630,9 @@ jobs:
|
||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
||||
GH_AW_MAX_AI_CREDITS: "60"
|
||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||
@@ -1685,10 +1692,6 @@ jobs:
|
||||
- name: Collect usage artifact files
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||
- name: Generate usage activity summary and unified session
|
||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||
@@ -1697,6 +1700,9 @@ jobs:
|
||||
env:
|
||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||
@@ -1804,6 +1810,8 @@ jobs:
|
||||
outputs:
|
||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||
@@ -1811,7 +1819,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1820,7 +1828,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
@@ -1878,6 +1886,7 @@ jobs:
|
||||
run: |
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Check if detection needed
|
||||
@@ -1911,12 +1920,12 @@ jobs:
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version: '24'
|
||||
package-manager-cache: false
|
||||
- name: Install GitHub Copilot CLI
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
||||
env:
|
||||
GH_HOST: github.com
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
@@ -1940,7 +1949,7 @@ jobs:
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_AW_VERSION: v1.4.6
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -1982,7 +1991,7 @@ jobs:
|
||||
fi
|
||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||
@@ -2019,8 +2028,9 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
# shellcheck disable=SC1003,SC2016,SC2086
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
||||
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 COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/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 && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
||||
- name: Copy detection firewall logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
@@ -2082,20 +2092,14 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const path = require('path');
|
||||
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
- name: Validate threat detection verdict files
|
||||
id: validate_detection_results
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
env:
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2115,6 +2119,7 @@ jobs:
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||
@@ -2148,6 +2153,8 @@ jobs:
|
||||
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/renovate-minor-review"
|
||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||
GH_AW_ENGINE_ID: "copilot"
|
||||
@@ -2183,7 +2190,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -2192,7 +2199,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_VERSION: "1.0.115"
|
||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
|
||||
Generated
+14
-4
@@ -1342,8 +1342,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clash_verge_service_ipc"
|
||||
version = "2.8.3"
|
||||
source = "git+https://github.com/clash-verge-rev/clash-verge-service-ipc.git?rev=fd00f5af2363517e67de57a7ead67737175ac376#fd00f5af2363517e67de57a7ead67737175ac376"
|
||||
version = "2.8.2"
|
||||
source = "git+https://github.com/clash-verge-rev/clash-verge-service-ipc.git?branch=main#3e06ff153e9cb19ae20e0a61f861b371d3f7b2aa"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kode-bridge",
|
||||
@@ -3995,9 +3995,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kode-bridge"
|
||||
version = "0.6.1"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e125a6b7f2e7ce5d560ce9517083e27549345a6492ca68194cd96b42e3b27acb"
|
||||
checksum = "b17456ae84ba9c0da0f189bf00d13019805b89563ba846cd15ccd8c4bd6a2713"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures",
|
||||
@@ -4005,6 +4005,7 @@ dependencies = [
|
||||
"httparse",
|
||||
"libc",
|
||||
"parking_lot 0.13.0",
|
||||
"path-tree",
|
||||
"pin-project-lite",
|
||||
"rand 0.10.2",
|
||||
"serde",
|
||||
@@ -5156,6 +5157,15 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
|
||||
|
||||
[[package]]
|
||||
name = "path-tree"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a97453bc21a968f722df730bfe11bd08745cb50d1300b0df2bda131dece136"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathsearch"
|
||||
version = "0.2.0"
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ clash-verge-runtime-bundle = { path = "crates/clash-verge-runtime-bundle" }
|
||||
clash-verge-proxy-view = { path = "crates/clash-verge-proxy-view" }
|
||||
clash-verge-profile = { path = "crates/clash-verge-profile" }
|
||||
clash-verge-backup-archive = { path = "crates/clash-verge-backup-archive" }
|
||||
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", rev = "fd00f5af2363517e67de57a7ead67737175ac376", version = "2.8.3", default-features = false }
|
||||
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", branch = "main", version = "2.8.2", default-features = false }
|
||||
tracing-estuary = { git = "https://github.com/Tunglies/tracing-estuary.git", branch = "main" }
|
||||
tauri-plugin-clash-verge-sysinfo = { path = "crates/tauri-plugin-clash-verge-sysinfo" }
|
||||
tracing = "0.1.44"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
GitHub, so they never reach users. -->
|
||||
## v2.6.0
|
||||
|
||||
- 使用 2.6.x 服务模式时请安装随附的服务,2.5.x 客户端无法使用新版服务
|
||||
- **Mihomo 内核升级至 v1.19.34**
|
||||
|
||||
<details>
|
||||
@@ -50,7 +49,6 @@
|
||||
|
||||
**🖥️ Windows**
|
||||
|
||||
- 修复 Windows 服务启动失败后自动切换内核,现显示原因并等待用户选择
|
||||
- 修复 Windows 普通用户因权限不足无法开启「开机自启」
|
||||
|
||||
**🍎 macOS**
|
||||
|
||||
+17
-20
@@ -9,7 +9,7 @@ import AdmZip from 'adm-zip'
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent'
|
||||
import { extract } from 'tar'
|
||||
|
||||
import { resolveServiceBundle as serviceBundleFromMetadata } from './service-release.mjs'
|
||||
import { resolveServiceRelease } from './service-release.mjs'
|
||||
import { log_debug, log_error, log_info, log_success } from './utils.mjs'
|
||||
|
||||
/** Prepares platform resources, caching versions and unchanged files unless `--force` is used. */
|
||||
@@ -581,30 +581,23 @@ async function resolveServiceBundle() {
|
||||
}
|
||||
})
|
||||
|
||||
const metadata = JSON.parse(
|
||||
execFileSync(
|
||||
'cargo',
|
||||
[
|
||||
'metadata',
|
||||
'--locked',
|
||||
'--format-version',
|
||||
'1',
|
||||
'--filter-platform',
|
||||
SIDECAR_HOST,
|
||||
],
|
||||
{ cwd, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 },
|
||||
),
|
||||
const cargoManifest = await fsp.readFile(
|
||||
path.join(cwd, 'src-tauri', 'Cargo.toml'),
|
||||
'utf8',
|
||||
)
|
||||
const bundle = serviceBundleFromMetadata(metadata, SIDECAR_HOST, platform)
|
||||
if (bundle.manifest) {
|
||||
const serviceDependency = cargoManifest
|
||||
.split(/\r?\n/)
|
||||
.find((line) => line.trimStart().startsWith('clash_verge_service_ipc ='))
|
||||
const sourcePath = serviceDependency?.match(/\bpath\s*=\s*"([^"]+)"/)?.[1]
|
||||
if (sourcePath) {
|
||||
const manifest = path.resolve(cwd, 'src-tauri', sourcePath, 'Cargo.toml')
|
||||
const targetDirectory = path.join(cwd, 'target', 'bundled-service')
|
||||
execFileSync(
|
||||
'cargo',
|
||||
[
|
||||
'build',
|
||||
'--locked',
|
||||
'--manifest-path',
|
||||
bundle.manifest,
|
||||
manifest,
|
||||
'--target-dir',
|
||||
targetDirectory,
|
||||
'--target',
|
||||
@@ -612,7 +605,7 @@ async function resolveServiceBundle() {
|
||||
'--release',
|
||||
'--features',
|
||||
'standalone,client',
|
||||
...SERVICE_BINARIES.flatMap((name) => ['--bin', name]),
|
||||
'--bins',
|
||||
],
|
||||
{ stdio: 'inherit' },
|
||||
)
|
||||
@@ -627,7 +620,11 @@ async function resolveServiceBundle() {
|
||||
}
|
||||
return
|
||||
}
|
||||
const { archiveFile, downloadURL } = bundle
|
||||
const { archiveFile, downloadURL } = resolveServiceRelease(
|
||||
cargoManifest,
|
||||
SIDECAR_HOST,
|
||||
platform,
|
||||
)
|
||||
const tempDir = path.join(TEMP_DIR, 'clash-verge-service-ipc')
|
||||
const tempArchive = path.join(tempDir, archiveFile)
|
||||
|
||||
|
||||
+10
-23
@@ -1,35 +1,22 @@
|
||||
const SERVICE_URL_PREFIX =
|
||||
'https://github.com/clash-verge-rev/clash-verge-service-ipc/releases/download'
|
||||
|
||||
export function resolveServiceBundle(metadata, host, platform) {
|
||||
const app = metadata.packages.find(
|
||||
(pkg) =>
|
||||
pkg.name === 'clash-verge' && metadata.workspace_members.includes(pkg.id),
|
||||
)
|
||||
const dependency = app?.dependencies.find(
|
||||
(dep) => dep.name === 'clash_verge_service_ipc',
|
||||
)
|
||||
const edge = metadata.resolve.nodes
|
||||
.find((node) => node.id === app?.id)
|
||||
?.deps.find((dep) => dep.name === 'clash_verge_service_ipc')
|
||||
const service = metadata.packages.find((pkg) => pkg.id === edge?.pkg)
|
||||
if (!service || !dependency) {
|
||||
throw new Error('Cargo did not resolve the desktop IPC client dependency')
|
||||
}
|
||||
if (!service.source || new URL(service.source).searchParams.has('rev')) {
|
||||
return { manifest: service.manifest_path }
|
||||
}
|
||||
|
||||
const declared = dependency.req.replace(/^[=^]/, '')
|
||||
if (declared !== service.version) {
|
||||
export function resolveServiceRelease(cargoManifest, host, platform) {
|
||||
const dependency = cargoManifest
|
||||
.split(/\r?\n/)
|
||||
.find((line) => line.trimStart().startsWith('clash_verge_service_ipc ='))
|
||||
const packageVersion = dependency?.match(/\bversion\s*=\s*"([^"]+)"/)?.[1]
|
||||
if (!packageVersion) {
|
||||
throw new Error(
|
||||
`Service release version ${declared} differs from the resolved IPC client ${service.version}`,
|
||||
'clash_verge_service_ipc dependency must declare an inline version',
|
||||
)
|
||||
}
|
||||
const version = `v${declared}`
|
||||
|
||||
const version = `v${packageVersion}`
|
||||
const archiveExt = platform === 'win32' ? 'zip' : 'tar.gz'
|
||||
const archiveFile = `clash-verge-service-ipc-${version}-${host}.${archiveExt}`
|
||||
return {
|
||||
version,
|
||||
archiveFile,
|
||||
downloadURL: `${SERVICE_URL_PREFIX}/${version}/${archiveFile}`,
|
||||
}
|
||||
|
||||
@@ -8,7 +8,17 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
async fn execute_service_operation_sync(status: ServiceStatus, error_code: &str) -> CmdResult {
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize, specta::Type)]
|
||||
#[serde(tag = "status", rename_all = "camelCase")]
|
||||
pub enum ServiceInstallOutcome {
|
||||
Installed,
|
||||
#[cfg_attr(not(any(windows, test)), allow(dead_code))]
|
||||
Sidecar {
|
||||
reason: String,
|
||||
},
|
||||
}
|
||||
|
||||
async fn execute_service_operation_sync(status: ServiceStatus, error_code: &str) -> CmdResult<ServiceInstallOutcome> {
|
||||
let manager = CoreManager::global();
|
||||
let result = {
|
||||
let _lifecycle = manager.lifecycle_lock.lock().await;
|
||||
@@ -23,12 +33,56 @@ async fn execute_service_operation_sync(status: ServiceStatus, error_code: &str)
|
||||
}
|
||||
SERVICE_MANAGER.handle_service_status(status).await
|
||||
};
|
||||
result.map_err(|error| proxy_aware_coded_error(&error, error_code))
|
||||
#[cfg(windows)]
|
||||
return finish_service_installation(result, error_code, async |reason| {
|
||||
manager.continue_with_sidecar(Some(reason)).await
|
||||
})
|
||||
.await;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
result
|
||||
.map(|()| ServiceInstallOutcome::Installed)
|
||||
.map_err(|error| proxy_aware_coded_error(&error, error_code))
|
||||
}
|
||||
|
||||
#[cfg(any(windows, test))]
|
||||
async fn finish_service_installation<Fallback>(
|
||||
installation: anyhow::Result<()>,
|
||||
error_code: &str,
|
||||
fallback: Fallback,
|
||||
) -> CmdResult<ServiceInstallOutcome>
|
||||
where
|
||||
Fallback: AsyncFnOnce(&str) -> anyhow::Result<()>,
|
||||
{
|
||||
let Err(error) = installation else {
|
||||
return Ok(ServiceInstallOutcome::Installed);
|
||||
};
|
||||
let Some(failure) = error.downcast_ref::<clash_verge_service_ipc::management::InstallationVerificationError>()
|
||||
else {
|
||||
return Err(proxy_aware_coded_error(&error, error_code));
|
||||
};
|
||||
let reasons = failure
|
||||
.status
|
||||
.cores
|
||||
.iter()
|
||||
.filter_map(|core| match &core.availability {
|
||||
clash_verge_service_ipc::CoreAvailability::Rejected { reason } => Some(format!("{}: {reason}", core.name)),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
if reasons.is_empty() {
|
||||
return Err(proxy_aware_coded_error(&error, error_code));
|
||||
}
|
||||
let reason = reasons.join("\n");
|
||||
fallback(reason.as_str())
|
||||
.await
|
||||
.map_err(|error| proxy_aware_coded_error(&error, "SERVICE_SIDECAR_FAILED"))?;
|
||||
Ok(ServiceInstallOutcome::Sidecar { reason })
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn install_service() -> CmdResult {
|
||||
pub async fn install_service() -> CmdResult<ServiceInstallOutcome> {
|
||||
execute_service_operation_sync(ServiceStatus::InstallRequired, "SERVICE_INSTALL_FAILED").await
|
||||
}
|
||||
|
||||
@@ -43,13 +97,13 @@ pub async fn uninstall_service() -> CmdResult {
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn reinstall_service() -> CmdResult {
|
||||
pub async fn reinstall_service() -> CmdResult<ServiceInstallOutcome> {
|
||||
execute_service_operation_sync(ServiceStatus::ReinstallRequired, "SERVICE_REINSTALL_FAILED").await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn repair_service() -> CmdResult {
|
||||
pub async fn repair_service() -> CmdResult<ServiceInstallOutcome> {
|
||||
execute_service_operation_sync(ServiceStatus::ForceReinstallRequired, "SERVICE_REPAIR_FAILED").await
|
||||
}
|
||||
|
||||
@@ -57,7 +111,7 @@ pub async fn repair_service() -> CmdResult {
|
||||
#[specta::specta]
|
||||
pub async fn continue_with_sidecar() -> CmdResult {
|
||||
crate::core::CoreManager::global()
|
||||
.continue_with_sidecar()
|
||||
.continue_with_sidecar(None)
|
||||
.await
|
||||
.map_err(|error| proxy_aware_coded_error(&error, "SERVICE_SIDECAR_FAILED"))
|
||||
}
|
||||
@@ -68,6 +122,12 @@ pub fn get_sidecar_failure() -> crate::core::notification::SidecarFailureSnapsho
|
||||
crate::core::notification::sidecar_failure_snapshot()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn take_service_fallback_notice() -> Option<crate::core::service::ServiceFallbackNotice> {
|
||||
crate::core::service::take_service_fallback_notice()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn get_core_startup_error() -> Option<crate::core::manager::CoreFailure> {
|
||||
@@ -93,3 +153,72 @@ pub fn sync_runtime_providers() {
|
||||
request_runtime_provider_sync(timing::RUNTIME_PROVIDER_SETTLE);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::expect_used, reason = "tests assert by panicking")]
|
||||
mod tests {
|
||||
use super::{ServiceInstallOutcome, finish_service_installation};
|
||||
use clash_verge_service_ipc::{
|
||||
CoreAvailability, CoreInspection, InstallationStatus, ProtocolInfo, management::InstallationVerificationError,
|
||||
};
|
||||
use std::cell::Cell;
|
||||
|
||||
#[tokio::test]
|
||||
async fn rejected_installation_reports_sidecar_only_after_successful_continuation() {
|
||||
let reason = "core path C:\\ is writable by Everyone";
|
||||
for (availability, fallback_ready) in [
|
||||
(None, false),
|
||||
(Some(CoreAvailability::Missing), false),
|
||||
(Some(CoreAvailability::DigestMismatch), false),
|
||||
(Some(CoreAvailability::Rejected { reason: reason.into() }), false),
|
||||
(Some(CoreAvailability::Rejected { reason: reason.into() }), true),
|
||||
] {
|
||||
let fallback_called = Cell::new(false);
|
||||
let rejected = matches!(&availability, Some(CoreAvailability::Rejected { .. }));
|
||||
let error = match availability {
|
||||
Some(availability) => anyhow::Error::new(InstallationVerificationError {
|
||||
status: InstallationStatus {
|
||||
service_sha256: String::new(),
|
||||
protocol: ProtocolInfo::current(),
|
||||
cores: vec![CoreInspection {
|
||||
name: "verge-mihomo.exe".into(),
|
||||
availability,
|
||||
}],
|
||||
core_busy: false,
|
||||
},
|
||||
}),
|
||||
None => anyhow::anyhow!("{reason}"),
|
||||
}
|
||||
.context("install service failed");
|
||||
let result = finish_service_installation(Err(error), "SERVICE_INSTALL_FAILED", async |_| {
|
||||
fallback_called.set(true);
|
||||
anyhow::ensure!(fallback_ready, "another core is running");
|
||||
Ok(())
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(fallback_called.get(), rejected);
|
||||
if rejected && fallback_ready {
|
||||
assert_eq!(
|
||||
result,
|
||||
Ok(ServiceInstallOutcome::Sidecar {
|
||||
reason: format!("verge-mihomo.exe: {reason}")
|
||||
})
|
||||
);
|
||||
} else {
|
||||
let error = result.expect_err("an unavailable fallback must remain an error");
|
||||
assert_eq!(
|
||||
error.code.as_deref(),
|
||||
Some(if rejected {
|
||||
"SERVICE_SIDECAR_FAILED"
|
||||
} else {
|
||||
"SERVICE_INSTALL_FAILED"
|
||||
})
|
||||
);
|
||||
if rejected {
|
||||
assert!(error.detail.contains("another core is running"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ fn plan_config_application(attempt: &StageAttempt) -> ConfigApplication {
|
||||
}
|
||||
}
|
||||
|
||||
async fn ask_to_stage(path: &std::path::Path, session: &clash_verge_service_ipc::OwnerSessionProof) -> StageAttempt {
|
||||
match crate::core::service::stage_runtime_by_service(path, session).await {
|
||||
async fn ask_to_stage(path: &std::path::Path) -> StageAttempt {
|
||||
match crate::core::service::stage_runtime_by_service(path).await {
|
||||
Ok(StageRequest::Answered(outcome)) => StageAttempt::Answered(outcome),
|
||||
Ok(StageRequest::Refused { code, message }) => {
|
||||
let message = message.into();
|
||||
@@ -433,10 +433,10 @@ impl CoreManager {
|
||||
}
|
||||
|
||||
async fn attempt_staging(&self, path: &std::path::Path) -> StageAttempt {
|
||||
let Ok(session) = crate::core::service::active_service_session() else {
|
||||
if !crate::core::service::active_service_supports_runtime_staging() {
|
||||
return StageAttempt::Unsupported;
|
||||
};
|
||||
stage_with_confirmation(timing::STAGE_CONFIRM_TIMEOUT, || ask_to_stage(path, &session)).await
|
||||
}
|
||||
stage_with_confirmation(timing::STAGE_CONFIRM_TIMEOUT, || ask_to_stage(path)).await
|
||||
}
|
||||
|
||||
/// Reload the Core from `path`, and replace the Core if it will not take it.
|
||||
|
||||
@@ -188,6 +188,48 @@ where
|
||||
apply_proxy().await
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "windows", test))]
|
||||
async fn run_service_start_with_sidecar_fallback<Start, StartFuture, Check, CheckFuture, Fallback, FallbackFuture>(
|
||||
start_service: Start,
|
||||
confirm_idle: Check,
|
||||
start_sidecar: Fallback,
|
||||
record_unavailable: impl FnOnce(std::string::String),
|
||||
) -> Result<()>
|
||||
where
|
||||
Start: FnOnce() -> StartFuture,
|
||||
StartFuture: std::future::Future<Output = Result<()>>,
|
||||
Check: FnOnce() -> CheckFuture,
|
||||
CheckFuture: std::future::Future<Output = Result<()>>,
|
||||
Fallback: FnOnce(anyhow::Error) -> FallbackFuture,
|
||||
FallbackFuture: std::future::Future<Output = Result<()>>,
|
||||
{
|
||||
let Err(error) = start_service().await else {
|
||||
return Ok(());
|
||||
};
|
||||
let refusal = error.downcast_ref::<crate::core::service::ServiceStartRefusal>();
|
||||
let location_refused = refusal.is_some_and(|refusal| {
|
||||
refusal.code == clash_verge_service_ipc::ServiceErrorCode::InvalidInstallLocation as u16
|
||||
});
|
||||
if refusal.is_some() && !location_refused {
|
||||
return Err(error);
|
||||
}
|
||||
// A lost start response can hide a running core; the shared check must resolve occupancy.
|
||||
if let Err(probe_error) = confirm_idle().await {
|
||||
let error = error.context(format!("Sidecar fallback was not safe: {probe_error:#}"));
|
||||
record_unavailable(format!("{error:#}"));
|
||||
return Err(error);
|
||||
}
|
||||
logging!(
|
||||
warn,
|
||||
Type::Core,
|
||||
"Service could not start the core; falling back to Sidecar: {error:#}"
|
||||
);
|
||||
let reason = format!("{error:#}");
|
||||
start_sidecar(error)
|
||||
.await
|
||||
.map_err(|error| error.context(format!("Sidecar fallback failed after Service failure: {reason}")))
|
||||
}
|
||||
|
||||
async fn run_sidecar_termination_transition<Clear, ClearFuture, Terminate, TerminateFuture>(
|
||||
clear_proxy: Clear,
|
||||
terminate_sidecar: Terminate,
|
||||
@@ -284,7 +326,11 @@ where
|
||||
start_sidecar().await
|
||||
}
|
||||
|
||||
fn report_sidecar_failure(error: anyhow::Error) -> anyhow::Error {
|
||||
fn report_sidecar_failure(error: anyhow::Error, service_rejection: Option<&str>) -> anyhow::Error {
|
||||
let error = match service_rejection {
|
||||
Some(reason) => error.context(format!("Service core rejected: {reason}; Sidecar fallback failed")),
|
||||
None => error,
|
||||
};
|
||||
// Proxy failures have their own pending state and recovery dialog.
|
||||
if SysproxyFailure::from_chain(&error).is_none() {
|
||||
crate::core::notification::record_sidecar_failure(format!("{error:#}").into());
|
||||
@@ -322,11 +368,12 @@ impl CoreManager {
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all, level = "info", fields(status = tracing::field::Empty, tun_disabled = false, readiness_generation = tracing::field::Empty))]
|
||||
pub async fn continue_with_sidecar(&self) -> Result<()> {
|
||||
pub async fn continue_with_sidecar(&self, service_rejection: Option<&str>) -> Result<()> {
|
||||
if !self.try_start_config_update() {
|
||||
return Err(report_sidecar_failure(anyhow::anyhow!(
|
||||
"configuration update is already running"
|
||||
)));
|
||||
return Err(report_sidecar_failure(
|
||||
anyhow::anyhow!("configuration update is already running"),
|
||||
service_rejection,
|
||||
));
|
||||
}
|
||||
let _config_update = DropGuard::new((), |()| {
|
||||
self.finish_config_update();
|
||||
@@ -343,8 +390,11 @@ impl CoreManager {
|
||||
if !can_allow_sidecar_for_session(&mode, &status) {
|
||||
anyhow::bail!("Sidecar continuation is not allowed from {mode:?} / {status:?}");
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
if matches!(*mode, RunningMode::NotRunning) {
|
||||
crate::core::service::release_service_core_for_sidecar().await?;
|
||||
clash_verge_service_ipc::execution::check_sidecar_available()
|
||||
.await
|
||||
.map_err(super::state::explain_core_occupancy)?;
|
||||
}
|
||||
if !matches!(status, ServiceStatus::SidecarAllowed) {
|
||||
SERVICE_MANAGER.allow_sidecar_for_session()?;
|
||||
@@ -397,7 +447,7 @@ impl CoreManager {
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
result.map_err(report_sidecar_failure)
|
||||
result.map_err(|error| report_sidecar_failure(error, service_rejection))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all, level = "info", fields(readiness_generation = tracing::field::Empty))]
|
||||
@@ -413,7 +463,6 @@ impl CoreManager {
|
||||
let _life = self.lifecycle_lock.lock().await;
|
||||
|
||||
self.controlled_stop_core_inner().await?;
|
||||
crate::core::service::release_service_core_for_sidecar().await?;
|
||||
|
||||
let result = run_uninstall_transition(
|
||||
|| async {
|
||||
@@ -589,6 +638,8 @@ impl CoreManager {
|
||||
self.rollback_failed_start().await;
|
||||
#[cfg(target_os = "macos")]
|
||||
crate::utils::resolve::dns::sync_public_dns().await;
|
||||
#[cfg(target_os = "windows")]
|
||||
self.try_sidecar_after_service_unavailable().await?;
|
||||
return Ok(());
|
||||
}
|
||||
if Handle::global().is_exiting() {
|
||||
@@ -597,15 +648,27 @@ impl CoreManager {
|
||||
}
|
||||
|
||||
let result = match startup {
|
||||
StartupDecision::Service => self.start_core_by_service().await.inspect_err(|error| {
|
||||
if error
|
||||
.downcast_ref::<crate::core::service::ServiceStartRefusal>()
|
||||
.is_none()
|
||||
StartupDecision::Service => {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
crate::core::runstate::RUN_STATE
|
||||
.observe(crate::core::runstate::ServiceHealth::Unavailable(format!("{error:#}")));
|
||||
run_service_start_with_sidecar_fallback(
|
||||
|| self.start_core_by_service(),
|
||||
|| async {
|
||||
clash_verge_service_ipc::execution::check_sidecar_available()
|
||||
.await
|
||||
.map_err(super::state::explain_core_occupancy)
|
||||
},
|
||||
|error| self.start_sidecar_after_service_failure(error),
|
||||
|reason| {
|
||||
crate::core::runstate::RUN_STATE
|
||||
.observe(crate::core::runstate::ServiceHealth::Unavailable(reason));
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
}),
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
self.start_core_by_service().await
|
||||
}
|
||||
StartupDecision::Sidecar => self.start_core_by_sidecar().await,
|
||||
StartupDecision::Wait => Ok(()),
|
||||
};
|
||||
@@ -621,6 +684,53 @@ impl CoreManager {
|
||||
result
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
async fn try_sidecar_after_service_unavailable(&self) -> Result<()> {
|
||||
use crate::core::runstate::{RUN_STATE, ServiceHealth};
|
||||
|
||||
let state = RUN_STATE.state();
|
||||
if state.pending.is_some() || state.op_in_flight || Handle::global().is_exiting() {
|
||||
return Ok(());
|
||||
}
|
||||
let reason = match state.health {
|
||||
ServiceHealth::Unavailable(reason) => reason,
|
||||
ServiceHealth::VersionMismatch => "registered service is unavailable or incompatible".to_owned(),
|
||||
_ => return Ok(()),
|
||||
};
|
||||
if let Err(error) = clash_verge_service_ipc::execution::check_sidecar_available()
|
||||
.await
|
||||
.map_err(super::state::explain_core_occupancy)
|
||||
{
|
||||
logging!(
|
||||
warn,
|
||||
Type::Core,
|
||||
"Service unavailable ({reason}); Sidecar fallback withheld: {error:#}"
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
self.start_sidecar_after_service_failure(anyhow::anyhow!(reason)).await
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
async fn start_sidecar_after_service_failure(&self, error: anyhow::Error) -> Result<()> {
|
||||
use crate::core::runstate::RUN_STATE;
|
||||
|
||||
if Handle::global().is_exiting() {
|
||||
return Err(error.context("application exited before Sidecar fallback"));
|
||||
}
|
||||
let reason = format!("{error:#}");
|
||||
RUN_STATE.allow_sidecar_after_service_refusal(reason.clone())?;
|
||||
logging!(warn, Type::Core, "Starting Sidecar with Service unavailable: {reason}");
|
||||
let result = self.start_core_by_sidecar().await;
|
||||
if result.is_err() {
|
||||
SERVICE_MANAGER.withdraw_sidecar_allowance();
|
||||
self.rollback_failed_start().await;
|
||||
} else {
|
||||
crate::core::service::notify_service_fallback(&reason);
|
||||
}
|
||||
result.map_err(|error| error.context(format!("Service failure before Sidecar startup: {reason}")))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all, level = "info", fields(mode = ?*self.get_running_mode()))]
|
||||
pub async fn stop_core(&self) -> Result<()> {
|
||||
let _life = self.lifecycle_lock.lock().await;
|
||||
@@ -736,6 +846,13 @@ impl CoreManager {
|
||||
let is_admin = is_current_app_handle_admin(Handle::app_handle());
|
||||
|
||||
if !should_wait_for_service(tun_enabled, service_ready, is_admin) {
|
||||
if tun_enabled && !service_ready && is_admin {
|
||||
logging!(
|
||||
info,
|
||||
Type::Core,
|
||||
"service unavailable while app is elevated; starting sidecar immediately"
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -748,6 +865,8 @@ impl CoreManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// Failing to become ready is not fatal here: the caller falls back to Sidecar, and a
|
||||
// transient transport failure must not overwrite the last confirmed install state.
|
||||
let attempts = (timing::SERVICE_WAIT_MAX.as_millis() / timing::SERVICE_WAIT_INTERVAL.as_millis()) as usize;
|
||||
let wait = crate::core::runstate::RUN_STATE.await_ready(attempts, timing::SERVICE_WAIT_INTERVAL);
|
||||
let _ = tokio::time::timeout(timing::SERVICE_WAIT_MAX, wait).await;
|
||||
@@ -1291,6 +1410,46 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn blocked_windows_fallback_records_failure_without_starting_sidecar() {
|
||||
use crate::core::runstate::{FakeEnv, RunStateStore, ServiceHealth};
|
||||
|
||||
for idle in [false, true] {
|
||||
let store = RunStateStore::new(FakeEnv::new());
|
||||
store.observe(ServiceHealth::Ready);
|
||||
let started = AtomicBool::new(false);
|
||||
let result = super::run_service_start_with_sidecar_fallback(
|
||||
|| async {
|
||||
Err(crate::core::service::ServiceStartRefusal {
|
||||
code: clash_verge_service_ipc::ServiceErrorCode::InvalidInstallLocation as u16,
|
||||
core_path: "verge-mihomo.exe".into(),
|
||||
message: "no administrator-approved copy is installed".into(),
|
||||
}
|
||||
.into())
|
||||
},
|
||||
|| async move {
|
||||
anyhow::ensure!(idle, "another core is running");
|
||||
Ok(())
|
||||
},
|
||||
|_| async {
|
||||
started.store(true, Ordering::SeqCst);
|
||||
Ok(())
|
||||
},
|
||||
|reason| store.observe(ServiceHealth::Unavailable(reason)),
|
||||
)
|
||||
.await;
|
||||
|
||||
assert_eq!(started.load(Ordering::SeqCst), idle);
|
||||
assert_eq!(result.is_ok(), idle);
|
||||
assert!(!store.state().sidecar_allowed);
|
||||
if !idle {
|
||||
assert!(store.state().service_needs_attention());
|
||||
assert!(!store.state().service_usable());
|
||||
assert!(result.is_err_and(|error| format!("{error:#}").contains("another core is running")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_service_install_can_continue_with_an_existing_sidecar() {
|
||||
assert!(can_allow_sidecar_for_session(
|
||||
|
||||
@@ -11,14 +11,27 @@ use crate::{
|
||||
use anyhow::{Context as _, Result};
|
||||
use clash_verge_logging::Type;
|
||||
use clash_verge_task::retry::{RetryError, RetryPolicy, retry};
|
||||
use futures::{FutureExt as _, future::Shared};
|
||||
use futures::{
|
||||
FutureExt as _,
|
||||
future::{Map, Shared},
|
||||
};
|
||||
use log::Level;
|
||||
use std::num::NonZeroUsize;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use tauri_plugin_mihomo::MihomoExt as _;
|
||||
use tauri_plugin_shell::ShellExt as _;
|
||||
use tauri_plugin_shell::process::CommandChild;
|
||||
use tokio::sync::oneshot;
|
||||
use tokio::task::{JoinError, JoinHandle};
|
||||
|
||||
pub(super) fn explain_core_occupancy(error: anyhow::Error) -> anyhow::Error {
|
||||
let detail = error.to_string();
|
||||
if detail.starts_with("process verge-mihomo") && detail.ends_with("; refusing a second core") {
|
||||
error.context(clash_verge_i18n::t!("core.alreadyRunning").into_owned())
|
||||
} else {
|
||||
error
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn sidecar_config_without_tun(yaml: &str) -> Result<std::string::String> {
|
||||
@@ -133,10 +146,18 @@ fn should_clear_terminated_sidecar(
|
||||
matches!(running_mode, RunningMode::Sidecar) && current_generation == Some(terminated_generation)
|
||||
}
|
||||
|
||||
type ShareExitResult = fn(Result<(), JoinError>) -> Result<(), Arc<JoinError>>;
|
||||
type SidecarExit = Shared<Map<JoinHandle<()>, ShareExitResult>>;
|
||||
|
||||
fn share_exit(exit: JoinHandle<()>) -> SidecarExit {
|
||||
let share_error: ShareExitResult = |result| result.map_err(Arc::new);
|
||||
exit.map(share_error).shared()
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(super) struct SidecarSession {
|
||||
process: Option<SidecarProcess>,
|
||||
exit: Option<Shared<oneshot::Receiver<()>>>,
|
||||
exit: Option<SidecarExit>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -174,7 +195,10 @@ impl CoreManager {
|
||||
#[tracing::instrument(skip_all, level = "info", fields(pid = tracing::field::Empty))]
|
||||
pub(super) async fn start_core_by_sidecar(&self) -> Result<()> {
|
||||
self.wait_for_sidecar_exit().await?;
|
||||
service::require_service_core_released()?;
|
||||
let execution = clash_verge_service_ipc::execution::reserve_sidecar()
|
||||
.await
|
||||
.inspect_err(service::record_residual_service)
|
||||
.map_err(explain_core_occupancy)?;
|
||||
self.core_stopped();
|
||||
|
||||
let sidecar_ipc = dirs::sidecar_ipc_path()?;
|
||||
@@ -197,11 +221,13 @@ impl CoreManager {
|
||||
#[cfg(unix)]
|
||||
discard_unwritable_core_cache(&config_dir);
|
||||
|
||||
#[cfg(unix)]
|
||||
let previous_mask = unsafe { tauri_plugin_clash_verge_sysinfo::libc::umask(0o077) };
|
||||
let command = app_handle
|
||||
.shell()
|
||||
.sidecar(clash_core.as_str())
|
||||
.map_err(|error| anyhow::anyhow!("failed to build sidecar command for core {clash_core:?}: {error:#}"))?;
|
||||
let command = command.kill_on_drop(true).args([
|
||||
let command = command.args([
|
||||
"-d",
|
||||
dirs::path_to_str(&config_dir)?,
|
||||
"-f",
|
||||
@@ -218,13 +244,6 @@ impl CoreManager {
|
||||
"LISTEN_NAMEDPIPE_SDDL",
|
||||
crate::core::owner_identity::current_user_pipe_sddl()?,
|
||||
);
|
||||
#[cfg(unix)]
|
||||
let restore_mask = std::mem::DropGuard::new(
|
||||
unsafe { tauri_plugin_clash_verge_sysinfo::libc::umask(0o077) },
|
||||
|mask| {
|
||||
unsafe { tauri_plugin_clash_verge_sysinfo::libc::umask(mask) };
|
||||
},
|
||||
);
|
||||
let (mut rx, child) = command.spawn().map_err(|error| {
|
||||
anyhow::anyhow!(
|
||||
"failed to start sidecar core {clash_core:?} with config {} and data directory {}: {error:#}",
|
||||
@@ -232,10 +251,35 @@ impl CoreManager {
|
||||
config_dir.display()
|
||||
)
|
||||
})?;
|
||||
let (terminated, termination) = tokio::sync::oneshot::channel();
|
||||
let exit = execution.release_after_exit(child.pid(), termination);
|
||||
self.sidecar.lock().exit = Some(share_exit(exit));
|
||||
#[cfg(target_os = "windows")]
|
||||
let job = {
|
||||
match create_and_assign_sidecar_job(child.pid()) {
|
||||
Ok(job) => job,
|
||||
Err(job_error) => {
|
||||
let pid = child.pid();
|
||||
|
||||
let error = match child.kill() {
|
||||
Ok(()) => job_error,
|
||||
Err(kill_error) => anyhow::anyhow!(
|
||||
"failed to configure Job Object for sidecar PID {pid}: \
|
||||
{job_error:#}; failed to terminate child: {kill_error:#}"
|
||||
),
|
||||
};
|
||||
|
||||
logging!(error, Type::Core, "Failed to start sidecar: {error:#}");
|
||||
return Err(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(unix)]
|
||||
drop(restore_mask);
|
||||
let (terminated, termination) = oneshot::channel();
|
||||
self.sidecar.lock().exit = Some(termination.shared());
|
||||
unsafe {
|
||||
tauri_plugin_clash_verge_sysinfo::libc::umask(previous_mask)
|
||||
};
|
||||
|
||||
let pid = child.pid();
|
||||
tracing::Span::current().record("pid", pid);
|
||||
|
||||
@@ -273,30 +317,6 @@ impl CoreManager {
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let job = {
|
||||
match create_and_assign_sidecar_job(child.pid()) {
|
||||
Ok(job) => job,
|
||||
Err(job_error) => {
|
||||
let pid = child.pid();
|
||||
|
||||
let error = match child.kill() {
|
||||
Ok(()) => {
|
||||
self.sidecar.lock().exit.take();
|
||||
job_error
|
||||
}
|
||||
Err(kill_error) => anyhow::anyhow!(
|
||||
"failed to configure Job Object for sidecar PID {pid}: \
|
||||
{job_error:#}; failed to terminate child: {kill_error:#}"
|
||||
),
|
||||
};
|
||||
|
||||
logging!(error, Type::Core, "Failed to start sidecar: {error:#}");
|
||||
return Err(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let readiness = poll_sidecar_readiness(SIDECAR_READINESS_ATTEMPTS, SIDECAR_READINESS_INTERVAL, || async {
|
||||
tokio::time::timeout(SIDECAR_READINESS_PROBE_TIMEOUT, async {
|
||||
handle::Handle::mihomo().get_version().await
|
||||
@@ -310,10 +330,7 @@ impl CoreManager {
|
||||
proxy_control::stop_guard().await;
|
||||
self.core_stopped();
|
||||
return match child.kill() {
|
||||
Ok(()) => {
|
||||
self.sidecar.lock().exit.take();
|
||||
Err(readiness_error)
|
||||
}
|
||||
Ok(()) => Err(readiness_error),
|
||||
Err(kill_error) => Err(anyhow::anyhow!(
|
||||
"{readiness_error:#}; failed to terminate unready sidecar PID {pid}: {kill_error:#}"
|
||||
)),
|
||||
@@ -341,11 +358,8 @@ impl CoreManager {
|
||||
#[cfg(target_os = "windows")]
|
||||
drop(process.job);
|
||||
|
||||
match process.child.kill() {
|
||||
Ok(()) => {
|
||||
self.sidecar.lock().exit.take();
|
||||
}
|
||||
Err(error) => logging!(warn, Type::Core, "failed to terminate sidecar PID {pid}: {error:#}"),
|
||||
if let Err(error) = process.child.kill() {
|
||||
logging!(warn, Type::Core, "failed to terminate sidecar PID {pid}: {error:#}");
|
||||
}
|
||||
}
|
||||
let result = self.wait_for_sidecar_exit().await;
|
||||
@@ -379,13 +393,12 @@ impl CoreManager {
|
||||
|
||||
#[tracing::instrument(skip_all, level = "info", fields(config_file = %config_file.display()))]
|
||||
pub(super) async fn start_core_by_service_with_config(&self, config_file: &Path) -> Result<()> {
|
||||
self.wait_for_sidecar_exit().await?;
|
||||
let start = tokio::sync::OnceCell::new();
|
||||
// 交接时等待 sidecar 释放 ext-controller 通道。
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use crate::constants::timing;
|
||||
retry_service_start(timing::SERVICE_START_RETRIES, timing::SERVICE_START_RETRY_DELAY, || {
|
||||
service::run_core_by_service(config_file, &start)
|
||||
service::run_core_by_service(config_file)
|
||||
})
|
||||
.await?;
|
||||
self.mark_core_ready();
|
||||
@@ -397,7 +410,7 @@ impl CoreManager {
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
service::run_core_by_service(config_file, &start).await?;
|
||||
service::run_core_by_service(config_file).await?;
|
||||
self.mark_core_ready();
|
||||
self.core_started(RunningMode::Service);
|
||||
self.restore_selected_nodes().await;
|
||||
@@ -543,6 +556,20 @@ mod readiness_tests {
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn core_occupancy_explanation_preserves_the_original_error() {
|
||||
for detail in [
|
||||
"process verge-mihomo remains after IPC failure; refusing a second core",
|
||||
"process verge-mihomo-alpha.exe (PID 123) is still running; refusing a second core",
|
||||
] {
|
||||
let error = super::explain_core_occupancy(anyhow::anyhow!(detail));
|
||||
assert_eq!(error.to_string(), clash_verge_i18n::t!("core.alreadyRunning"));
|
||||
assert_eq!(error.root_cause().to_string(), detail);
|
||||
}
|
||||
let error = super::explain_core_occupancy(anyhow::anyhow!("could not inspect remaining cores"));
|
||||
assert_eq!(error.to_string(), "could not inspect remaining cores");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn sidecar_readiness_poll_is_bounded_and_accepts_a_real_api_response() -> anyhow::Result<()> {
|
||||
let attempts = Arc::new(AtomicUsize::new(0));
|
||||
@@ -703,65 +730,6 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn forced_parent_exit_releases_the_sidecar_job() -> Result<()> {
|
||||
use std::io::{BufRead as _, BufReader, Write as _};
|
||||
use std::os::windows::io::{AsRawHandle as _, FromRawHandle as _, OwnedHandle};
|
||||
use windows_sys::Win32::{
|
||||
Foundation::{WAIT_OBJECT_0, WAIT_TIMEOUT},
|
||||
System::Threading::{OpenProcess, PROCESS_SYNCHRONIZE, WaitForSingleObject},
|
||||
};
|
||||
|
||||
const HELPER: &str = "CVR_TEST_SIDECAR_JOB_PARENT";
|
||||
if std::env::var_os(HELPER).is_some() {
|
||||
let mut child = spawn_long_lived()?;
|
||||
let _job = create_and_assign_sidecar_job(child.id()).inspect_err(|_| {
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
})?;
|
||||
println!("\nSIDECAR_PID={}", child.id());
|
||||
std::io::stdout().flush()?;
|
||||
std::io::stdin().read_line(&mut String::new())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut parent = std::mem::DropGuard::new(
|
||||
Command::new(std::env::current_exe()?)
|
||||
.args(["forced_parent_exit_releases_the_sidecar_job", "--nocapture"])
|
||||
.env(HELPER, "1")
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?,
|
||||
|mut parent| {
|
||||
let _ = parent.kill();
|
||||
let _ = parent.wait();
|
||||
},
|
||||
);
|
||||
let stdout = parent
|
||||
.stdout
|
||||
.take()
|
||||
.ok_or_else(|| anyhow::anyhow!("missing helper stdout"))?;
|
||||
let mut pid = None;
|
||||
for line in BufReader::new(stdout).lines() {
|
||||
if let Some(value) = line?.strip_prefix("SIDECAR_PID=") {
|
||||
pid = Some(value.parse()?);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let pid = pid.ok_or_else(|| anyhow::anyhow!("helper did not report its child"))?;
|
||||
let raw = unsafe { OpenProcess(PROCESS_SYNCHRONIZE, 0, pid) };
|
||||
anyhow::ensure!(!raw.is_null(), "could not open helper child {pid}");
|
||||
let child = unsafe { OwnedHandle::from_raw_handle(raw) };
|
||||
assert_eq!(unsafe { WaitForSingleObject(child.as_raw_handle(), 0) }, WAIT_TIMEOUT);
|
||||
parent.kill()?;
|
||||
parent.wait()?;
|
||||
assert_eq!(
|
||||
unsafe { WaitForSingleObject(child.as_raw_handle(), 5000) },
|
||||
WAIT_OBJECT_0
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returns_err_for_invalid_pid() {
|
||||
// Windows PIDs are multiples of four; this one is effectively impossible.
|
||||
|
||||
@@ -19,6 +19,9 @@ pub enum NoticeStatus {
|
||||
ServiceCoreRepairRequired,
|
||||
#[serde(rename = "service_core::app_data_not_owned")]
|
||||
ServiceCoreAppDataNotOwned,
|
||||
#[serde(rename = "service_core::sidecar_fallback")]
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
ServiceCoreSidecarFallback,
|
||||
#[serde(rename = "dns_override::auto_disabled")]
|
||||
DnsOverrideAutoDisabled,
|
||||
#[serde(rename = "enhance::discarded_keys")]
|
||||
@@ -78,13 +81,14 @@ impl NoticeStatus {
|
||||
/// test both derive their variant list from here; expected strings stay
|
||||
/// hand-written in the test so renames cannot slip through.
|
||||
#[cfg(test)]
|
||||
pub const ALL: [Self; 32] = [
|
||||
pub const ALL: [Self; 33] = [
|
||||
Self::ImportSubUrlOk,
|
||||
Self::ImportSubUrlError,
|
||||
Self::SetConfigError,
|
||||
Self::CoreStartError,
|
||||
Self::ServiceCoreRepairRequired,
|
||||
Self::ServiceCoreAppDataNotOwned,
|
||||
Self::ServiceCoreSidecarFallback,
|
||||
Self::DnsOverrideAutoDisabled,
|
||||
Self::EnhanceDiscardedKeys,
|
||||
Self::TunModeAutoDisabled,
|
||||
@@ -128,6 +132,7 @@ mod tests {
|
||||
"core_start::error",
|
||||
"service_core::repair_required",
|
||||
"service_core::app_data_not_owned",
|
||||
"service_core::sidecar_fallback",
|
||||
"dns_override::auto_disabled",
|
||||
"enhance::discarded_keys",
|
||||
"tun_mode::auto_disabled",
|
||||
|
||||
@@ -390,10 +390,10 @@ fn service_proxy_config(verge: &IVerge, mixed_port: u16, pac_port: u16) -> Resul
|
||||
/// the write's, so it stays a failure.
|
||||
fn service_apply_result(requested: &MacosProxyConfig, outcome: ProxyApplyOutcome) -> Result<()> {
|
||||
match outcome {
|
||||
ProxyApplyOutcome::Applied => Ok(()),
|
||||
ProxyApplyOutcome::Applied | ProxyApplyOutcome::NotRequested => Ok(()),
|
||||
// Direct fallback satisfies a disable request.
|
||||
ProxyApplyOutcome::DirectFallback { .. } if matches!(requested, MacosProxyConfig::Disabled) => Ok(()),
|
||||
// The service reports a missing network service as fallback before any OS write.
|
||||
// Older helpers encode a failed service lookup as fallback even when no OS write occurred.
|
||||
#[cfg(target_os = "macos")]
|
||||
ProxyApplyOutcome::DirectFallback { message }
|
||||
if message == sysproxy::Error::NoActiveNetworkService.to_string() =>
|
||||
|
||||
@@ -67,9 +67,17 @@ impl RunStateEnv for RealEnv {
|
||||
}
|
||||
|
||||
async fn trusted_install_evidence(&self) -> Result<bool> {
|
||||
tokio::task::spawn_blocking(crate::core::service::trusted_service_evidence)
|
||||
let registered = tokio::task::spawn_blocking(crate::core::service::trusted_service_evidence)
|
||||
.await
|
||||
.context("service registration probe did not finish")?
|
||||
.context("service registration probe did not finish")??;
|
||||
// A helper that outlived its registration is a broken Service, not an absent one.
|
||||
#[cfg(unix)]
|
||||
if !registered && let Err(error) = clash_verge_service_ipc::execution::check_sidecar_available().await {
|
||||
return Ok(error
|
||||
.downcast_ref::<clash_verge_service_ipc::execution::ResidualServiceError>()
|
||||
.is_some());
|
||||
}
|
||||
Ok(registered)
|
||||
}
|
||||
|
||||
fn is_elevated(&self) -> bool {
|
||||
|
||||
@@ -24,7 +24,7 @@ pub use env::FakeEnv;
|
||||
pub use env::{RealEnv, RunStateEnv};
|
||||
pub use health::{PendingAction, RunState, RunStateView, ServiceHealth};
|
||||
pub use owner::{OwnerRecoveryReason, OwnerSample, OwnerStep, OwnerWatch};
|
||||
pub use probe::{ServiceVersionCheck, ServiceVersionReply, classify_service_version_reply};
|
||||
pub use probe::{CORE_REJECTED_PREFIX, ServiceVersionCheck, ServiceVersionReply, classify_service_version_reply};
|
||||
|
||||
use crate::core::manager::RunningMode;
|
||||
use health::StoredService;
|
||||
@@ -336,6 +336,21 @@ impl<E: RunStateEnv> RunStateStore<E> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn allow_sidecar_after_service_refusal(&self, reason: String) -> Result<()> {
|
||||
let mut state = self.service.lock();
|
||||
if state.operation_running || state.service.pending.is_some() {
|
||||
bail!("cannot fall back while a service operation is pending");
|
||||
}
|
||||
// Publish the refusal and allowance together so it never asks the UI for a repair.
|
||||
state.service.health = ServiceHealth::Unavailable(reason);
|
||||
state.service.allow_sidecar();
|
||||
state.bump();
|
||||
drop(state);
|
||||
self.announce();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Requests installation only for a confirmed absent Service.
|
||||
pub fn require_install_for_session(&self) -> Result<()> {
|
||||
let mut state = self.service.lock();
|
||||
|
||||
+164
-188
@@ -10,8 +10,8 @@ use crate::{
|
||||
owner_identity::current_owner_credentials,
|
||||
proxy_control,
|
||||
runstate::{
|
||||
OwnerRecoveryReason, OwnerSample, OwnerStep, OwnerWatch, PendingAction, RUN_STATE, ReadyWaitError,
|
||||
RunState, RunStateEnv, RunStateStore, ServiceHealth,
|
||||
CORE_REJECTED_PREFIX, OwnerRecoveryReason, OwnerSample, OwnerStep, OwnerWatch, PendingAction, RUN_STATE,
|
||||
ReadyWaitError, RunState, RunStateEnv, RunStateStore, ServiceHealth,
|
||||
},
|
||||
tray::Tray,
|
||||
},
|
||||
@@ -22,9 +22,9 @@ use clash_verge_draft::Draft;
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use clash_verge_runtime_bundle::{GEO_ASSETS, RemoteProviderRef, collect_runtime_bundle, remote_providers_of};
|
||||
use clash_verge_service_ipc::{
|
||||
MacosProxyConfig, OwnerCredentials, OwnerIdentity, OwnerSessionProof, ProxyApplyOutcome, RemoteProvider,
|
||||
RuntimeAsset, RuntimeBundle, RuntimeFileOutcome, RuntimeFileRequest, ServiceErrorCode, ServiceStatusSnapshot,
|
||||
StageRuntimeOutcome, StartClashRequest, WriterConfig,
|
||||
MacosProxyConfig, OwnerCredentials, OwnerIdentity, OwnerSessionProof, ProtocolInfo, ProxyApplyOutcome,
|
||||
RemoteProvider, RuntimeAsset, RuntimeBundle, RuntimeFileOutcome, RuntimeFileRequest, ServiceErrorCode,
|
||||
ServiceStatusSnapshot, StageRuntimeOutcome, StartClashRequest, WriterConfig,
|
||||
};
|
||||
use clash_verge_task::scheduled_task::{self, Mailbox, Next, ScheduledTask};
|
||||
use clash_verge_task::watch_task;
|
||||
@@ -44,21 +44,45 @@ use std::{
|
||||
use tokio::{sync::watch, time::Instant};
|
||||
|
||||
static OWNER_MONITOR_GENERATION: AtomicU64 = AtomicU64::new(0);
|
||||
static PENDING_SERVICE_START: Mutex<Option<PendingServiceStart>> = Mutex::new(None);
|
||||
static ACTIVE_SERVICE_SESSION: Mutex<Option<Arc<OwnerSessionProof>>> = Mutex::new(None);
|
||||
static ACTIVE_SERVICE_SESSION: Mutex<Option<ActiveServiceSession>> = Mutex::new(None);
|
||||
static PENDING_SERVICE_FALLBACK_NOTICE: Mutex<Option<String>> = Mutex::new(None);
|
||||
static PENDING_SERVICE_REPAIR_NOTICE: AtomicBool = AtomicBool::new(false);
|
||||
static PENDING_SERVICE_OWNER_NOTICE: Mutex<Option<String>> = Mutex::new(None);
|
||||
|
||||
#[cfg(windows)]
|
||||
/// Why the Service was unavailable when the core fell back to Sidecar.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, specta::Type)]
|
||||
#[serde(tag = "kind", content = "reason", rename_all = "camelCase")]
|
||||
pub enum ServiceFallbackNotice {
|
||||
Unavailable,
|
||||
CoreRejected(String),
|
||||
NotAutoStarted,
|
||||
}
|
||||
|
||||
/// The release installer registers AutoStart.
|
||||
const SERVICE_NOT_AUTO_STARTED: &str = "the Windows service is stopped and no longer starts with Windows";
|
||||
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn is_not_auto_started(reason: &str) -> bool {
|
||||
// Detection prefixes its own context to the reason.
|
||||
reason.contains(SERVICE_NOT_AUTO_STARTED)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub(crate) fn notify_service_fallback(reason: &str) {
|
||||
*PENDING_SERVICE_FALLBACK_NOTICE.lock() = Some(reason.to_owned());
|
||||
Handle::notice(NoticeStatus::ServiceCoreSidecarFallback, "");
|
||||
}
|
||||
|
||||
pub(crate) fn take_service_fallback_notice() -> Option<ServiceFallbackNotice> {
|
||||
let reason = PENDING_SERVICE_FALLBACK_NOTICE.lock().take()?;
|
||||
Some(if reason.starts_with(CORE_REJECTED_PREFIX) {
|
||||
ServiceFallbackNotice::CoreRejected(reason)
|
||||
} else if is_not_auto_started(&reason) {
|
||||
ServiceFallbackNotice::NotAutoStarted
|
||||
} else {
|
||||
ServiceFallbackNotice::Unavailable
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn take_service_repair_notice() -> bool {
|
||||
PENDING_SERVICE_REPAIR_NOTICE.swap(false, Ordering::Relaxed)
|
||||
}
|
||||
@@ -76,27 +100,14 @@ fn app_data_owner_command(credentials: &OwnerCredentials) -> Option<String> {
|
||||
Some(format!("sudo chown -R {uid}:{gid} '{path}'"))
|
||||
}
|
||||
|
||||
/// Capabilities of the service session that owns the running Core.
|
||||
/// They are discarded with that session rather than cached across service upgrades.
|
||||
#[derive(Clone)]
|
||||
struct PendingServiceStart {
|
||||
token: String,
|
||||
service_replaced: bool,
|
||||
}
|
||||
|
||||
impl PendingServiceStart {
|
||||
const fn new(token: String) -> Self {
|
||||
Self {
|
||||
token,
|
||||
service_replaced: false,
|
||||
}
|
||||
}
|
||||
|
||||
const fn released_after_repair(&self, status: &ServiceStatusSnapshot) -> bool {
|
||||
self.service_replaced
|
||||
&& !status.is_active
|
||||
&& status.active_generation.is_none()
|
||||
&& status.core_pid.is_none()
|
||||
&& !status.desired_core_should_be_running
|
||||
}
|
||||
struct ActiveServiceSession {
|
||||
proof: Arc<OwnerSessionProof>,
|
||||
supports_runtime_staging: bool,
|
||||
supports_runtime_file_read: bool,
|
||||
supports_runtime_geo_read: bool,
|
||||
}
|
||||
|
||||
fn generate_service_session_token() -> Result<String> {
|
||||
@@ -114,14 +125,89 @@ fn generate_service_session_token() -> Result<String> {
|
||||
pub(crate) fn active_service_session() -> Result<Arc<OwnerSessionProof>> {
|
||||
ACTIVE_SERVICE_SESSION
|
||||
.lock()
|
||||
.clone()
|
||||
.as_ref()
|
||||
.map(|session| Arc::clone(&session.proof))
|
||||
.context("service owner session is not active")
|
||||
}
|
||||
|
||||
/// Returns false unless the active service session explicitly supports in-place staging.
|
||||
pub(crate) fn active_service_supports_runtime_staging() -> bool {
|
||||
ACTIVE_SERVICE_SESSION
|
||||
.lock()
|
||||
.as_ref()
|
||||
.is_some_and(|session| session.supports_runtime_staging)
|
||||
}
|
||||
|
||||
pub(crate) fn active_service_supports_runtime_file_read() -> bool {
|
||||
ACTIVE_SERVICE_SESSION
|
||||
.lock()
|
||||
.as_ref()
|
||||
.is_some_and(|session| session.supports_runtime_file_read)
|
||||
}
|
||||
|
||||
fn active_service_supports_runtime_geo_read() -> bool {
|
||||
ACTIVE_SERVICE_SESSION
|
||||
.lock()
|
||||
.as_ref()
|
||||
.is_some_and(|session| session.supports_runtime_geo_read)
|
||||
}
|
||||
|
||||
pub(crate) fn clear_active_service_session() {
|
||||
ACTIVE_SERVICE_SESSION.lock().take();
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct ServiceCapabilities {
|
||||
runtime_staging: bool,
|
||||
runtime_file_read: bool,
|
||||
runtime_geo_read: bool,
|
||||
}
|
||||
|
||||
impl ServiceCapabilities {
|
||||
const fn of(info: &ProtocolInfo) -> Self {
|
||||
Self {
|
||||
runtime_staging: info.supports_runtime_staging(),
|
||||
runtime_file_read: info.supports_runtime_file_read(),
|
||||
runtime_geo_read: info.supports_runtime_geo_read(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Failed capability probes must not block startup.
|
||||
#[tracing::instrument(skip_all, level = "info", fields(supported = tracing::field::Empty))]
|
||||
async fn probe_service_capabilities() -> ServiceCapabilities {
|
||||
match clash_verge_service_ipc::get_version().await {
|
||||
Ok(response) if response.code == 0 => {
|
||||
let capabilities = response
|
||||
.data
|
||||
.as_ref()
|
||||
.map_or_else(ServiceCapabilities::default, ServiceCapabilities::of);
|
||||
tracing::Span::current().record("supported", capabilities.runtime_staging);
|
||||
capabilities
|
||||
}
|
||||
Ok(response) => {
|
||||
tracing::Span::current().record("supported", false);
|
||||
logging!(
|
||||
warn,
|
||||
Type::Service,
|
||||
"服务协议查询返回 {}: {};配置变更将走重启路径",
|
||||
response.code,
|
||||
response.message
|
||||
);
|
||||
ServiceCapabilities::default()
|
||||
}
|
||||
Err(error) => {
|
||||
tracing::Span::current().record("supported", false);
|
||||
logging!(
|
||||
warn,
|
||||
Type::Service,
|
||||
"无法查询服务协议版本: {error:#};配置变更将走重启路径"
|
||||
);
|
||||
ServiceCapabilities::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn session_matches_status(proof: &OwnerSessionProof, is_active: bool, active_generation: Option<u64>) -> bool {
|
||||
is_active && active_generation == Some(proof.generation)
|
||||
}
|
||||
@@ -514,26 +600,7 @@ pub(crate) fn run_privileged_service_action(action: PendingAction) -> Result<()>
|
||||
PendingAction::Reinstall => (reinstall_service, "reinstall service"),
|
||||
PendingAction::ForceReinstall => (force_reinstall_service, "force reinstall service"),
|
||||
};
|
||||
tokio::task::block_in_place(|| {
|
||||
let pending_token = match action {
|
||||
PendingAction::Reinstall | PendingAction::ForceReinstall => PENDING_SERVICE_START
|
||||
.lock()
|
||||
.as_ref()
|
||||
.map(|pending| pending.token.clone()),
|
||||
PendingAction::Install | PendingAction::Uninstall => None,
|
||||
};
|
||||
operation().with_context(|| format!("{label} failed"))?;
|
||||
// Full repair acquires the stopped-service guard before replacing the daemon.
|
||||
if let Some(token) = pending_token
|
||||
&& let Some(pending) = PENDING_SERVICE_START
|
||||
.lock()
|
||||
.as_mut()
|
||||
.filter(|pending| pending.token == token)
|
||||
{
|
||||
pending.service_replaced = true;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
tokio::task::block_in_place(operation).with_context(|| format!("{label} failed"))
|
||||
}
|
||||
|
||||
/// Builds the same runtime bundle description for both service start and staging.
|
||||
@@ -581,11 +648,12 @@ impl StageRequest {
|
||||
}
|
||||
|
||||
/// Requests in-place staging. `Err` means no answer; refusals are returned for caller policy.
|
||||
pub(super) async fn stage_runtime_by_service(config_file: &Path, session: &OwnerSessionProof) -> Result<StageRequest> {
|
||||
pub(super) async fn stage_runtime_by_service(config_file: &Path) -> Result<StageRequest> {
|
||||
let session = active_service_session()?;
|
||||
let credentials = current_owner_credentials()?;
|
||||
let runtime = collect_service_runtime_bundle(config_file).await?;
|
||||
|
||||
let response = clash_verge_service_ipc::stage_runtime(&credentials, session, &runtime)
|
||||
let response = clash_verge_service_ipc::stage_runtime(&credentials, &session, &runtime)
|
||||
.await
|
||||
.context("无法连接到Clash Verge Service")?;
|
||||
if response.code > 0 {
|
||||
@@ -632,86 +700,27 @@ fn record_service_start_refusal<E: RunStateEnv>(
|
||||
refusal.into()
|
||||
}
|
||||
|
||||
pub(super) fn require_service_core_released() -> Result<()> {
|
||||
anyhow::ensure!(
|
||||
PENDING_SERVICE_START.lock().is_none() && ACTIVE_SERVICE_SESSION.lock().is_none(),
|
||||
"the previous Service core has not confirmed exit"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) async fn release_service_core_for_sidecar() -> Result<()> {
|
||||
let pending = PENDING_SERVICE_START.lock().clone();
|
||||
if pending.is_none() {
|
||||
if active_service_session().is_ok() {
|
||||
return stop_core_by_service().await;
|
||||
}
|
||||
if matches!(RUN_STATE.state().health, ServiceHealth::NotInstalled) {
|
||||
return Ok(());
|
||||
}
|
||||
/// Sidecar stays blocked until a reinstall replaces the residual helper, so ask for repair.
|
||||
pub(super) fn record_residual_service(error: &anyhow::Error) {
|
||||
if let Some(residual) = error.downcast_ref::<clash_verge_service_ipc::execution::ResidualServiceError>() {
|
||||
RUN_STATE.observe(ServiceHealth::Unavailable(residual.to_string()));
|
||||
}
|
||||
let credentials = current_owner_credentials()?;
|
||||
let status = tokio::time::timeout(
|
||||
Duration::from_secs(2),
|
||||
clash_verge_service_ipc::get_status(&credentials),
|
||||
)
|
||||
.await
|
||||
.context("timed out confirming the previous Service core exited")??;
|
||||
anyhow::ensure!(status.code == 0, "Service status failed: {}", status.message);
|
||||
let status = status.data.context("Service omitted owner status")?;
|
||||
let Some(pending) = pending else {
|
||||
anyhow::ensure!(
|
||||
!status.is_active || (status.core_pid.is_none() && !status.desired_core_should_be_running),
|
||||
"the Service is running or recovering this owner's core; stop it before switching"
|
||||
);
|
||||
return Ok(());
|
||||
};
|
||||
if pending.released_after_repair(&status) {
|
||||
PENDING_SERVICE_START.lock().take();
|
||||
clear_active_service_session();
|
||||
return Ok(());
|
||||
}
|
||||
// A lost Start reply may have committed. Only its proposed token can stop that generation.
|
||||
let generation = status
|
||||
.active_generation
|
||||
.context("the previous Service start has not confirmed exit; repair the Service before switching")?;
|
||||
let stopped = clash_verge_service_ipc::stop_clash(
|
||||
&credentials,
|
||||
&OwnerSessionProof {
|
||||
generation,
|
||||
token: pending.token,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
anyhow::ensure!(
|
||||
stopped.code == 0,
|
||||
"could not confirm Service core exit: {}",
|
||||
stopped.message
|
||||
);
|
||||
PENDING_SERVICE_START.lock().take();
|
||||
clear_active_service_session();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 尝试使用服务启动core
|
||||
#[tracing::instrument(skip_all, level = "info", fields(generation = tracing::field::Empty, code = tracing::field::Empty, outcome = tracing::field::Empty))]
|
||||
async fn start_with_existing_service(
|
||||
config_file: &Path,
|
||||
start: &tokio::sync::OnceCell<StartClashRequest>,
|
||||
) -> Result<()> {
|
||||
#[tracing::instrument(skip_all, level = "info", fields(generation = tracing::field::Empty, staging = tracing::field::Empty, code = tracing::field::Empty, outcome = tracing::field::Empty))]
|
||||
pub(super) async fn start_with_existing_service(config_file: &Path) -> Result<()> {
|
||||
clear_active_service_session();
|
||||
|
||||
let credentials = current_owner_credentials()?;
|
||||
let request = start
|
||||
.get_or_try_init(|| async {
|
||||
Ok::<_, anyhow::Error>(StartClashRequest {
|
||||
runtime: collect_service_runtime_bundle(config_file).await?,
|
||||
proposed_session_token: generate_service_session_token()?,
|
||||
})
|
||||
})
|
||||
.await?;
|
||||
let previous = PENDING_SERVICE_START
|
||||
.lock()
|
||||
.replace(PendingServiceStart::new(request.proposed_session_token.clone()));
|
||||
let response = match clash_verge_service_ipc::start_clash(&credentials, request).await {
|
||||
let runtime = collect_service_runtime_bundle(config_file).await?;
|
||||
let request = StartClashRequest {
|
||||
runtime,
|
||||
proposed_session_token: generate_service_session_token()?,
|
||||
macos_proxy: None,
|
||||
};
|
||||
|
||||
let response = match clash_verge_service_ipc::start_clash(&credentials, &request).await {
|
||||
Ok(response) => response,
|
||||
Err(error) => {
|
||||
tracing::Span::current().record("outcome", "ipc-unreachable");
|
||||
@@ -723,16 +732,6 @@ async fn start_with_existing_service(
|
||||
if response.code > 0 {
|
||||
tracing::Span::current().record("code", response.code);
|
||||
tracing::Span::current().record("outcome", "refused");
|
||||
if matches!(response.code,
|
||||
code if code == ServiceErrorCode::InvalidInstallLocation as u16
|
||||
|| code == ServiceErrorCode::InvalidRuntimeAsset as u16
|
||||
|| code == ServiceErrorCode::AppDataRootNotOwned as u16
|
||||
|| code == ServiceErrorCode::UnauthorizedOwner as u16
|
||||
|| code == ServiceErrorCode::ProtocolMismatch as u16
|
||||
|| code == ServiceErrorCode::ProxyClearFailed as u16
|
||||
) {
|
||||
*PENDING_SERVICE_START.lock() = previous;
|
||||
}
|
||||
let err_msg = response.message;
|
||||
logging!(
|
||||
error,
|
||||
@@ -755,39 +754,43 @@ async fn start_with_existing_service(
|
||||
&RUN_STATE,
|
||||
ServiceStartRefusal {
|
||||
code: response.code,
|
||||
core_path: request.runtime.core_path.clone(),
|
||||
core_path: request.runtime.core_path,
|
||||
message: err_msg,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
let result = response.data.context("Clash Verge Service 未返回会话信息")?;
|
||||
tracing::Span::current().record("generation", result.generation);
|
||||
*ACTIVE_SERVICE_SESSION.lock() = Some(Arc::new(OwnerSessionProof {
|
||||
generation: result.generation,
|
||||
token: request.proposed_session_token.clone(),
|
||||
}));
|
||||
tracing::Span::current().record("generation", result.session.generation);
|
||||
let capabilities = probe_service_capabilities().await;
|
||||
tracing::Span::current().record("staging", capabilities.runtime_staging);
|
||||
*ACTIVE_SERVICE_SESSION.lock() = Some(ActiveServiceSession {
|
||||
proof: Arc::new(OwnerSessionProof {
|
||||
generation: result.session.generation,
|
||||
token: request.proposed_session_token,
|
||||
}),
|
||||
supports_runtime_staging: capabilities.runtime_staging,
|
||||
supports_runtime_file_read: capabilities.runtime_file_read,
|
||||
supports_runtime_geo_read: capabilities.runtime_geo_read,
|
||||
});
|
||||
|
||||
PENDING_SERVICE_START.lock().take();
|
||||
// PAC follows the Running Mode; the caller opens it via `core_started(Service)`.
|
||||
start_owner_monitor();
|
||||
tracing::Span::current().record("outcome", "started");
|
||||
PENDING_SERVICE_FALLBACK_NOTICE.lock().take();
|
||||
PENDING_SERVICE_REPAIR_NOTICE.store(false, Ordering::Relaxed);
|
||||
PENDING_SERVICE_OWNER_NOTICE.lock().take();
|
||||
logging!(
|
||||
info,
|
||||
Type::Service,
|
||||
"服务成功启动核心 (session generation {})",
|
||||
result.generation
|
||||
result.session.generation
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// 以服务启动core
|
||||
pub(super) async fn run_core_by_service(
|
||||
config_file: &Path,
|
||||
start: &tokio::sync::OnceCell<StartClashRequest>,
|
||||
) -> Result<()> {
|
||||
pub(super) async fn run_core_by_service(config_file: &Path) -> Result<()> {
|
||||
SERVICE_MANAGER.refresh().await?;
|
||||
|
||||
let status = SERVICE_MANAGER.current().await;
|
||||
@@ -796,7 +799,7 @@ pub(super) async fn run_core_by_service(
|
||||
}
|
||||
|
||||
logging!(info, Type::Service, "服务已运行且版本匹配,直接使用");
|
||||
start_with_existing_service(config_file, start).await
|
||||
start_with_existing_service(config_file).await
|
||||
}
|
||||
|
||||
async fn capture_generation_before<F, Fut, T>(generation: &AtomicU64, operation: F) -> (u64, T)
|
||||
@@ -953,10 +956,11 @@ type ProviderLoadTimes = HashMap<(&'static str, String), Option<u64>>;
|
||||
|
||||
#[tracing::instrument(level = "info", fields(synced = tracing::field::Empty, pending = tracing::field::Empty))]
|
||||
async fn sync_runtime_providers_by_service() -> Result<ProviderSync> {
|
||||
let Ok(session) = active_service_session() else {
|
||||
if !active_service_supports_runtime_file_read() {
|
||||
return Ok(ProviderSync::default());
|
||||
};
|
||||
}
|
||||
let credentials = current_owner_credentials()?;
|
||||
let session = active_service_session()?;
|
||||
let app_dir = dirs::app_home_dir()?;
|
||||
let runtime = Config::runtime().await;
|
||||
let mut outcome = ProviderSync::default();
|
||||
@@ -1042,10 +1046,14 @@ async fn sync_runtime_providers_by_service() -> Result<ProviderSync> {
|
||||
|
||||
/// Pulls geo databases the service core rewrote, because validation reads the app dir.
|
||||
pub(crate) async fn sync_runtime_geo_by_service() {
|
||||
let Ok(session) = active_service_session() else {
|
||||
if !active_service_supports_runtime_geo_read() {
|
||||
return;
|
||||
};
|
||||
let (Ok(credentials), Ok(app_dir)) = (current_owner_credentials(), dirs::app_home_dir()) else {
|
||||
}
|
||||
let (Ok(credentials), Ok(session), Ok(app_dir)) = (
|
||||
current_owner_credentials(),
|
||||
active_service_session(),
|
||||
dirs::app_home_dir(),
|
||||
) else {
|
||||
return;
|
||||
};
|
||||
for asset in GEO_ASSETS {
|
||||
@@ -1633,7 +1641,7 @@ fn session_matches_active_status(is_active: bool, active_generation: Option<u64>
|
||||
ACTIVE_SERVICE_SESSION
|
||||
.lock()
|
||||
.as_ref()
|
||||
.is_some_and(|session| session_matches_status(session, is_active, active_generation))
|
||||
.is_some_and(|session| session_matches_status(&session.proof, is_active, active_generation))
|
||||
}
|
||||
|
||||
fn cancel_owner_monitors() {
|
||||
@@ -1701,11 +1709,6 @@ async fn recover_after_owner_loss_while_locked(reason: OwnerRecoveryReason) {
|
||||
if policy.reset_system_proxy {
|
||||
clear_proxy_after_owner_loss().await;
|
||||
}
|
||||
if matches!(reason, OwnerRecoveryReason::TransportFailure)
|
||||
&& let Ok(session) = active_service_session()
|
||||
{
|
||||
*PENDING_SERVICE_START.lock() = Some(PendingServiceStart::new(session.token.clone()));
|
||||
}
|
||||
clear_active_service_session();
|
||||
CoreManager::global().core_stopped();
|
||||
// A displaced Service may still run TUN for its new owner, and DNS settings are system-wide.
|
||||
@@ -1992,33 +1995,6 @@ mod tests {
|
||||
ServiceStatus::from_run_state(&store.settled().await)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_idle_snapshot_releases_an_ambiguous_start_only_after_repair() {
|
||||
let mut pending = super::PendingServiceStart::new("lost-reply".into());
|
||||
let mut status = clash_verge_service_ipc::ServiceStatusSnapshot {
|
||||
is_active: false,
|
||||
active_generation: None,
|
||||
core_pid: None,
|
||||
desired_core_should_be_running: false,
|
||||
service_state: clash_verge_service_ipc::ServiceLifecycleState::Running,
|
||||
core_started_at: None,
|
||||
last_core_exit_reason: None,
|
||||
restart_count: 0,
|
||||
last_recovery_at: None,
|
||||
desired_generation: 0,
|
||||
desired_updated_at: 0,
|
||||
desired_persistence_error: None,
|
||||
};
|
||||
assert!(!pending.released_after_repair(&status));
|
||||
pending.service_replaced = true;
|
||||
assert!(pending.released_after_repair(&status));
|
||||
status.active_generation = Some(1);
|
||||
assert!(!pending.released_after_repair(&status));
|
||||
status.active_generation = None;
|
||||
status.desired_core_should_be_running = true;
|
||||
assert!(!pending.released_after_repair(&status));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mismatched_active_generation_displaces_local_session() {
|
||||
let proof = OwnerSessionProof {
|
||||
|
||||
@@ -51,6 +51,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
|
||||
cmd::apply_dns_config,
|
||||
cmd::set_dns_override,
|
||||
cmd::take_dns_override_notice,
|
||||
cmd::take_service_fallback_notice,
|
||||
cmd::get_core_startup_error,
|
||||
cmd::take_service_repair_notice,
|
||||
cmd::take_service_owner_notice,
|
||||
|
||||
@@ -60,20 +60,34 @@ it.each([
|
||||
},
|
||||
)
|
||||
|
||||
it('leaves the choice open when installation fails', async () => {
|
||||
store.runState = { service: 'notInstalled', mode: 'NotRunning' } as RunState
|
||||
const error = new Error('core path is writable by Everyone')
|
||||
vi.mocked(installService).mockRejectedValue(error)
|
||||
vi.mocked(getRuntimeState).mockResolvedValue(store.runState)
|
||||
it('reports the permission refusal and finishes after installation falls back to Sidecar', async () => {
|
||||
store.runState = {
|
||||
service: 'notInstalled',
|
||||
mode: 'NotRunning',
|
||||
} as unknown as RunState
|
||||
const reason = 'core path C:\\ is writable by Everyone'
|
||||
vi.mocked(installService).mockResolvedValue({ status: 'sidecar', reason })
|
||||
vi.mocked(getRuntimeState).mockResolvedValue({
|
||||
service: 'unavailable',
|
||||
mode: 'Sidecar',
|
||||
sidecarAllowed: true,
|
||||
serviceNeedsAttention: false,
|
||||
} as RunState)
|
||||
|
||||
const dialog = ServiceMigrationDialog()
|
||||
dialog.props.onOk()
|
||||
await vi.waitFor(() => {
|
||||
expect(showNotice.warning).toHaveBeenCalledWith(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason },
|
||||
0,
|
||||
)
|
||||
})
|
||||
|
||||
ServiceMigrationDialog().props.onOk()
|
||||
await vi.waitFor(() => expect(getRuntimeState).toHaveBeenCalled())
|
||||
expect(showNotice.error).toHaveBeenCalledWith(
|
||||
'layout.components.serviceMigration.errors.actionFailed',
|
||||
error,
|
||||
)
|
||||
expect(restartCore).not.toHaveBeenCalled()
|
||||
expect(vi.mocked(useState).mock.results[2].value[1]).not.toHaveBeenCalledWith(
|
||||
expect(showNotice.error).not.toHaveBeenCalled()
|
||||
expect(showNotice.success).not.toHaveBeenCalled()
|
||||
expect(vi.mocked(useState).mock.results[2].value[1]).toHaveBeenLastCalledWith(
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
reinstallService,
|
||||
repairService,
|
||||
restartCore,
|
||||
type ServiceInstallOutcome,
|
||||
} from '@/services/cmds'
|
||||
import { mutate } from '@/services/mutate'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
@@ -69,26 +70,26 @@ export const ServiceMigrationDialog = () => {
|
||||
const handleServiceAction = async () => {
|
||||
setLoading(true)
|
||||
setWorkflowIncomplete(true)
|
||||
let installed = false
|
||||
let outcome: ServiceInstallOutcome | undefined
|
||||
try {
|
||||
if (remedy === 'install') {
|
||||
const result = await mutate(() => installService(), {
|
||||
id: 'install-service',
|
||||
errorNotice: false,
|
||||
})
|
||||
installed = result.ok
|
||||
if (result.ok) outcome = result.value
|
||||
} else if (remedy === 'repair') {
|
||||
const result = await mutate(() => repairService(), {
|
||||
id: 'repair-service',
|
||||
errorNotice: false,
|
||||
})
|
||||
installed = result.ok
|
||||
if (result.ok) outcome = result.value
|
||||
} else {
|
||||
const result = await mutate(() => reinstallService(), {
|
||||
id: 'reinstall-service',
|
||||
errorNotice: false,
|
||||
})
|
||||
installed = result.ok
|
||||
if (result.ok) outcome = result.value
|
||||
}
|
||||
} catch (error) {
|
||||
showNotice.error(
|
||||
@@ -107,10 +108,21 @@ export const ServiceMigrationDialog = () => {
|
||||
error,
|
||||
)
|
||||
}
|
||||
if (!installed || !initialRefreshSucceeded) {
|
||||
if (!outcome || !initialRefreshSucceeded) {
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
if (outcome.status === 'sidecar') {
|
||||
setWorkflowIncomplete(false)
|
||||
setLoading(false)
|
||||
showNotice.warning(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason: outcome.reason },
|
||||
0,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
let restartSucceeded = false
|
||||
try {
|
||||
const result = await mutate(() => restartCore(), {
|
||||
@@ -202,9 +214,6 @@ export const ServiceMigrationDialog = () => {
|
||||
? 'layout.components.serviceMigration.message'
|
||||
: 'layout.components.serviceMigration.unavailableMessage',
|
||||
)}
|
||||
{!showCheckingMessage && runState?.serviceUnavailableReason && (
|
||||
<div>{runState.serviceUnavailableReason}</div>
|
||||
)}
|
||||
</Alert>
|
||||
</BaseDialog>
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
restartCore,
|
||||
type FailedOperation,
|
||||
type PendingFailure,
|
||||
type ServiceInstallOutcome,
|
||||
} from '@/services/cmds'
|
||||
import { mutate } from '@/services/mutate'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
type ServiceRequestReason,
|
||||
} from '@/services/service-request'
|
||||
import { useAppReads } from '@/store/app-store-context'
|
||||
import getSystem from '@/utils/get-system'
|
||||
|
||||
type Remedy = 'installAndRestart' | 'reinstallAndRestart' | 'restartOnly'
|
||||
|
||||
@@ -103,20 +105,30 @@ export const SysproxyPrivilegeDialog = () => {
|
||||
|
||||
const handleFix = async () => {
|
||||
try {
|
||||
let outcome: ServiceInstallOutcome | undefined
|
||||
if (remedy === 'reinstallAndRestart') {
|
||||
setStep('installing')
|
||||
const result = await mutate(() => reinstallService(), {
|
||||
id: 'reinstall-service',
|
||||
errorNotice: false,
|
||||
})
|
||||
if (!result.ok) return
|
||||
if (result.ok) outcome = result.value
|
||||
} else if (remedy === 'installAndRestart') {
|
||||
setStep('installing')
|
||||
const result = await mutate(() => installService(), {
|
||||
id: 'install-service',
|
||||
errorNotice: false,
|
||||
})
|
||||
if (!result.ok) return
|
||||
if (result.ok) outcome = result.value
|
||||
}
|
||||
if (outcome?.status === 'sidecar') {
|
||||
showNotice.warning(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason: outcome.reason },
|
||||
0,
|
||||
)
|
||||
close()
|
||||
return
|
||||
}
|
||||
setStep('restarting')
|
||||
await mutate(() => restartCore(), {
|
||||
@@ -125,7 +137,14 @@ export const SysproxyPrivilegeDialog = () => {
|
||||
})
|
||||
|
||||
const runState = await readRunState()
|
||||
if (runState.mode === 'Service') {
|
||||
const usingAdminFallback =
|
||||
remedy !== 'reinstallAndRestart' &&
|
||||
getSystem() === 'windows' &&
|
||||
runState.mode === 'Sidecar' &&
|
||||
runState.isAdmin &&
|
||||
runState.sidecarAllowed &&
|
||||
runState.service === 'unavailable'
|
||||
if (runState.mode === 'Service' || usingAdminFallback) {
|
||||
if (restoring !== undefined) {
|
||||
setStep('applying')
|
||||
await mutate(() => patchVergeConfig(restoring), {
|
||||
@@ -133,13 +152,15 @@ export const SysproxyPrivilegeDialog = () => {
|
||||
errorNotice: false,
|
||||
})
|
||||
}
|
||||
showNotice.success(
|
||||
remedy === 'reinstallAndRestart'
|
||||
? 'layout.components.serviceMigration.success'
|
||||
: restoring === undefined
|
||||
? 'settings.sections.proxyControl.messages.installedCheckProxy'
|
||||
: 'settings.sections.proxyControl.messages.installedProxyRestored',
|
||||
)
|
||||
if (!usingAdminFallback) {
|
||||
showNotice.success(
|
||||
remedy === 'reinstallAndRestart'
|
||||
? 'layout.components.serviceMigration.success'
|
||||
: restoring === undefined
|
||||
? 'settings.sections.proxyControl.messages.installedCheckProxy'
|
||||
: 'settings.sections.proxyControl.messages.installedProxyRestored',
|
||||
)
|
||||
}
|
||||
close()
|
||||
} else {
|
||||
showNotice.error(
|
||||
|
||||
@@ -33,6 +33,14 @@ export const useServiceInstaller = () => {
|
||||
'settings.statuses.clashService.installing',
|
||||
)
|
||||
if (!installResult.ok) return
|
||||
if (installResult.value.status === 'sidecar') {
|
||||
showNotice.warning(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason: installResult.value.reason },
|
||||
0,
|
||||
)
|
||||
return
|
||||
}
|
||||
showNotice.success(
|
||||
'settings.feedback.notifications.clashService.installSuccess',
|
||||
)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
"chooseFile": "Escolher arquivo"
|
||||
},
|
||||
"menu": {
|
||||
"home": "Início",
|
||||
"home": "Site da assinatura",
|
||||
"select": "Selecionar",
|
||||
"shareQrCode": "Compartilhar QR Code",
|
||||
"editInfo": "Editar informações",
|
||||
|
||||
@@ -44,10 +44,12 @@ export const commands = {
|
||||
getSidecarFailure: () =>
|
||||
__TAURI_INVOKE<SidecarFailureSnapshot_Serialize>('get_sidecar_failure'),
|
||||
entryLightweightMode: () => __TAURI_INVOKE<null>('entry_lightweight_mode'),
|
||||
installService: () => __TAURI_INVOKE<null>('install_service'),
|
||||
installService: () =>
|
||||
__TAURI_INVOKE<ServiceInstallOutcome>('install_service'),
|
||||
uninstallService: () => __TAURI_INVOKE<null>('uninstall_service'),
|
||||
reinstallService: () => __TAURI_INVOKE<null>('reinstall_service'),
|
||||
repairService: () => __TAURI_INVOKE<null>('repair_service'),
|
||||
reinstallService: () =>
|
||||
__TAURI_INVOKE<ServiceInstallOutcome>('reinstall_service'),
|
||||
repairService: () => __TAURI_INVOKE<ServiceInstallOutcome>('repair_service'),
|
||||
continueWithSidecar: () => __TAURI_INVOKE<null>('continue_with_sidecar'),
|
||||
syncRuntimeProviders: () => __TAURI_INVOKE<void>('sync_runtime_providers'),
|
||||
getClashInfo: () => __TAURI_INVOKE<ClashInfo_Serialize>('get_clash_info'),
|
||||
@@ -97,6 +99,10 @@ export const commands = {
|
||||
}),
|
||||
takeDnsOverrideNotice: () =>
|
||||
__TAURI_INVOKE<boolean>('take_dns_override_notice'),
|
||||
takeServiceFallbackNotice: () =>
|
||||
__TAURI_INVOKE<ServiceFallbackNotice | null>(
|
||||
'take_service_fallback_notice',
|
||||
),
|
||||
getCoreStartupError: () =>
|
||||
__TAURI_INVOKE<CoreFailure | null>('get_core_startup_error'),
|
||||
takeServiceRepairNotice: () =>
|
||||
@@ -621,6 +627,7 @@ export type NoticeStatus =
|
||||
| 'core_start::error'
|
||||
| 'service_core::repair_required'
|
||||
| 'service_core::app_data_not_owned'
|
||||
| 'service_core::sidecar_fallback'
|
||||
| 'dns_override::auto_disabled'
|
||||
| 'enhance::discarded_keys'
|
||||
| 'tun_mode::auto_disabled'
|
||||
@@ -1033,6 +1040,12 @@ export type SaveProxyPortsOutcome =
|
||||
| { status: 'saved' }
|
||||
| { status: 'conflict'; port: number; transport: ListenerTransport }
|
||||
|
||||
/** Why the Service was unavailable when the core fell back to Sidecar. */
|
||||
export type ServiceFallbackNotice =
|
||||
| { kind: 'unavailable' }
|
||||
| { kind: 'coreRejected'; reason: string }
|
||||
| { kind: 'notAutoStarted' }
|
||||
|
||||
export type ServiceHealthKind =
|
||||
| 'unknown'
|
||||
| 'ready'
|
||||
@@ -1040,6 +1053,10 @@ export type ServiceHealthKind =
|
||||
| 'versionMismatch'
|
||||
| 'unavailable'
|
||||
|
||||
export type ServiceInstallOutcome =
|
||||
| { status: 'installed' }
|
||||
| { status: 'sidecar'; reason: string }
|
||||
|
||||
/** A removal has a revision too, so a delayed read cannot restore a resolved failure. */
|
||||
export type SidecarFailureSnapshot =
|
||||
| SidecarFailureSnapshot_Serialize
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type RunState,
|
||||
getCoreStartupError,
|
||||
takeDnsOverrideNotice,
|
||||
takeServiceFallbackNotice,
|
||||
takeServiceRepairNotice,
|
||||
} from '@/services/cmds'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
@@ -23,6 +24,7 @@ vi.mock('@/services/cmds', () => ({
|
||||
getPendingFailures: vi.fn().mockResolvedValue([]),
|
||||
takeDiscardedKeysNotice: vi.fn().mockResolvedValue(null),
|
||||
takeDnsOverrideNotice: vi.fn().mockResolvedValue(false),
|
||||
takeServiceFallbackNotice: vi.fn().mockResolvedValue(null),
|
||||
takeServiceRepairNotice: vi.fn().mockResolvedValue(false),
|
||||
takeServiceOwnerNotice: vi.fn().mockResolvedValue(null),
|
||||
}))
|
||||
@@ -177,3 +179,22 @@ it('offers service reinstallation for a startup path refusal even before listene
|
||||
reason: 'serviceLocationRefused',
|
||||
})
|
||||
})
|
||||
|
||||
it('explains a startup core rejection instead of the generic fallback notice', async () => {
|
||||
const reason =
|
||||
'approved core was rejected: core path "C:\\" has an untrusted write ACE'
|
||||
vi.mocked(takeServiceFallbackNotice)
|
||||
.mockResolvedValueOnce({ kind: 'coreRejected', reason })
|
||||
.mockResolvedValue(null)
|
||||
|
||||
const bus = await mountBus()
|
||||
bus.onSubscribed()
|
||||
bus.handlers['verge://notice-message'](['service_core::sidecar_fallback', ''])
|
||||
await flush()
|
||||
|
||||
expect(showNotice.warning).toHaveBeenCalledExactlyOnceWith(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason },
|
||||
0,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -92,6 +92,7 @@ export const createEventBus = (deps: BusHandlerDeps) => {
|
||||
deps.readPendingFailures()
|
||||
deps.handleNotice(['dns_override::auto_disabled', ''])
|
||||
deps.handleNotice(['enhance::discarded_keys', ''])
|
||||
deps.handleNotice(['service_core::sidecar_fallback', ''])
|
||||
deps.handleNotice(['service_core::repair_required', ''])
|
||||
deps.handleNotice(['service_core::app_data_not_owned', ''])
|
||||
deps.handleNotice(['core_start::error', ''])
|
||||
|
||||
@@ -23,6 +23,7 @@ export type {
|
||||
FailedOperation,
|
||||
PendingFailure,
|
||||
SidecarFailureSnapshot,
|
||||
ServiceInstallOutcome,
|
||||
ProxyPortSettings,
|
||||
ListenerTransport,
|
||||
ListenerProbe,
|
||||
@@ -233,6 +234,10 @@ export async function takeDnsOverrideNotice() {
|
||||
return commands.takeDnsOverrideNotice()
|
||||
}
|
||||
|
||||
export async function takeServiceFallbackNotice() {
|
||||
return commands.takeServiceFallbackNotice()
|
||||
}
|
||||
|
||||
export async function getCoreStartupError() {
|
||||
return commands.getCoreStartupError()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
getCoreStartupError,
|
||||
takeDiscardedKeysNotice,
|
||||
takeDnsOverrideNotice,
|
||||
takeServiceFallbackNotice,
|
||||
takeServiceOwnerNotice,
|
||||
takeServiceRepairNotice,
|
||||
} from '@/services/cmds'
|
||||
@@ -110,6 +111,30 @@ const handlers: Record<
|
||||
console.error('Failed to read the pending service owner notice', error)
|
||||
})
|
||||
},
|
||||
'service_core::sidecar_fallback': () => {
|
||||
void takeServiceFallbackNotice()
|
||||
.then((notice) => {
|
||||
if (notice?.kind === 'coreRejected') {
|
||||
showNotice.warning(
|
||||
'settings.feedback.notifications.clashService.permissionFallback',
|
||||
{ reason: notice.reason },
|
||||
0,
|
||||
)
|
||||
} else if (notice?.kind === 'notAutoStarted') {
|
||||
requestService({ reason: 'serviceNotAutoStarted' })
|
||||
} else if (notice) {
|
||||
showNotice.warning(
|
||||
'settings.feedback.notifications.clashService.sidecarFallback',
|
||||
)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to read the pending service fallback notice',
|
||||
error,
|
||||
)
|
||||
})
|
||||
},
|
||||
'dns_override::auto_disabled': () => {
|
||||
void takeDnsOverrideNotice()
|
||||
.then((pending) => {
|
||||
|
||||
Reference in New Issue
Block a user