|
28 | 28 | description: Exact fork PR head SHA approved for this secret-bearing run |
29 | 29 | required: false |
30 | 30 | type: string |
| 31 | + request_source: |
| 32 | + description: Dispatcher request source; ignored for manual runs |
| 33 | + required: false |
| 34 | + default: workflow_dispatch |
| 35 | + type: string |
31 | 36 |
|
32 | 37 | permissions: |
33 | 38 | actions: read |
|
49 | 54 | resolve_request: |
50 | 55 | name: Resolve Mantis request |
51 | 56 | runs-on: ubuntu-24.04 |
| 57 | + environment: qa-live-shared |
52 | 58 | outputs: |
53 | 59 | baseline_ref: ${{ steps.resolve.outputs.baseline_ref }} |
54 | 60 | baseline_revision: ${{ steps.resolve.outputs.baseline_revision }} |
|
61 | 67 | pr_number: ${{ steps.resolve.outputs.pr_number }} |
62 | 68 | request_source: ${{ steps.resolve.outputs.request_source }} |
63 | 69 | should_run: ${{ steps.resolve.outputs.should_run }} |
| 70 | + visibility_decision: ${{ steps.read_decision.outputs.decision }} |
64 | 71 | steps: |
65 | 72 | - name: Resolve refs and target PR |
66 | 73 | id: resolve |
|
80 | 87 | } |
81 | 88 |
|
82 | 89 | const body = inputs.instructions || ""; |
83 | | -
|
| 90 | + const dispatcherSources = new Set(["clawsweeper_label", "issue_comment"]); |
| 91 | + const requestSource = |
| 92 | + context.actor === "github-actions[bot]" && |
| 93 | + dispatcherSources.has(inputs.request_source) |
| 94 | + ? inputs.request_source |
| 95 | + : "workflow_dispatch"; |
84 | 96 | const { owner, repo } = context.repo; |
85 | 97 | const { data: pr } = await github.rest.pulls.get({ |
86 | 98 | owner, |
@@ -138,7 +150,8 @@ jobs: |
138 | 150 |
|
139 | 151 | if (pr.head.repo.full_name !== `${owner}/${repo}`) { |
140 | 152 | const allowFork = |
141 | | - inputs.allow_fork_candidate === true || inputs.allow_fork_candidate === "true"; |
| 153 | + inputs.allow_fork_candidate === true || |
| 154 | + inputs.allow_fork_candidate === "true"; |
142 | 155 | if (!allowFork) { |
143 | 156 | core.setFailed( |
144 | 157 | "Fork PR heads require explicit allow_fork_candidate approval for this secret-bearing run.", |
@@ -166,12 +179,91 @@ jobs: |
166 | 179 | setOutput("instructions", body); |
167 | 180 | setOutput("publish_artifact_name", publishArtifactName); |
168 | 181 | setOutput("publish_run_id", inputs.publish_run_id || ""); |
169 | | - setOutput("request_source", "workflow_dispatch"); |
| 182 | + setOutput("request_source", requestSource); |
| 183 | + setOutput( |
| 184 | + "requires_preflight", |
| 185 | + requestSource === "clawsweeper_label" || publishArtifactName ? "false" : "true", |
| 186 | + ); |
| 187 | +
|
| 188 | + - name: Checkout preflight refs |
| 189 | + id: checkout |
| 190 | + if: ${{ steps.resolve.outputs.should_run == 'true' && steps.resolve.outputs.requires_preflight == 'true' }} |
| 191 | + continue-on-error: true |
| 192 | + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 193 | + with: |
| 194 | + ref: ${{ github.workflow_sha }} |
| 195 | + persist-credentials: false |
| 196 | + fetch-depth: 1 |
| 197 | + |
| 198 | + - name: Fetch exact PR head |
| 199 | + id: fetch |
| 200 | + if: ${{ steps.checkout.outcome == 'success' }} |
| 201 | + continue-on-error: true |
| 202 | + env: |
| 203 | + BASELINE_SHA: ${{ steps.resolve.outputs.baseline_revision }} |
| 204 | + CANDIDATE_SHA: ${{ steps.resolve.outputs.candidate_revision }} |
| 205 | + MANTIS_PR_NUMBER: ${{ steps.resolve.outputs.pr_number }} |
| 206 | + shell: bash |
| 207 | + run: | |
| 208 | + set -euo pipefail |
| 209 | + git fetch --no-tags --depth=1 origin \ |
| 210 | + "$BASELINE_SHA" \ |
| 211 | + "+refs/pull/${MANTIS_PR_NUMBER}/head:refs/remotes/origin/mantis-preflight" |
| 212 | + git cat-file -e "${BASELINE_SHA}^{commit}" |
| 213 | + test "$(git rev-parse refs/remotes/origin/mantis-preflight)" = "$CANDIDATE_SHA" |
| 214 | +
|
| 215 | + - name: Classify visible behavior |
| 216 | + id: classify |
| 217 | + if: ${{ steps.fetch.outcome == 'success' }} |
| 218 | + continue-on-error: true |
| 219 | + uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 |
| 220 | + env: |
| 221 | + BASELINE_SHA: ${{ steps.resolve.outputs.baseline_revision }} |
| 222 | + CANDIDATE_SHA: ${{ steps.resolve.outputs.candidate_revision }} |
| 223 | + MANTIS_INSTRUCTIONS: ${{ steps.resolve.outputs.instructions }} |
| 224 | + MANTIS_PR_CONTEXT: ${{ steps.resolve.outputs.pr_context }} |
| 225 | + with: |
| 226 | + openai-api-key: ${{ secrets.OPENCLAW_MANTIS_AGENT_OPENAI_API_KEY || secrets.OPENAI_API_KEY }} |
| 227 | + codex-version: 0.148.0 |
| 228 | + prompt-file: .github/codex/prompts/mantis-telegram-desktop-preflight.md |
| 229 | + output-schema: | |
| 230 | + { |
| 231 | + "type": "object", |
| 232 | + "additionalProperties": false, |
| 233 | + "required": ["decision"], |
| 234 | + "properties": { |
| 235 | + "decision": { "type": "string", "enum": ["run", "skip"] } |
| 236 | + } |
| 237 | + } |
| 238 | + model: ${{ vars.OPENCLAW_CI_OPENAI_MODEL_BARE }} |
| 239 | + effort: low |
| 240 | + sandbox: read-only |
| 241 | + codex-args: '["-c","service_tier=\"fast\""]' |
| 242 | + safety-strategy: drop-sudo |
| 243 | + allow-bot-users: github-actions[bot] |
| 244 | + |
| 245 | + - name: Read visibility decision |
| 246 | + id: read_decision |
| 247 | + if: ${{ always() }} |
| 248 | + env: |
| 249 | + CLASSIFIER_OUTCOME: ${{ steps.classify.outcome }} |
| 250 | + CLASSIFIER_RESULT: ${{ steps.classify.outputs.final-message }} |
| 251 | + shell: bash |
| 252 | + run: | |
| 253 | + set -euo pipefail |
| 254 | + decision=run |
| 255 | + if [[ "$CLASSIFIER_OUTCOME" == success ]] && |
| 256 | + jq -e '.decision == "run" or .decision == "skip"' <<<"$CLASSIFIER_RESULT" >/dev/null; then |
| 257 | + decision="$(jq -r '.decision' <<<"$CLASSIFIER_RESULT")" |
| 258 | + else |
| 259 | + echo "::notice::Mantis visibility preflight was unavailable; continuing with proof." |
| 260 | + fi |
| 261 | + echo "decision=$decision" >> "$GITHUB_OUTPUT" |
170 | 262 |
|
171 | 263 | run_telegram_desktop_proof: |
172 | 264 | name: Run agentic native Telegram proof |
173 | 265 | needs: resolve_request |
174 | | - if: needs.resolve_request.outputs.should_run == 'true' && needs.resolve_request.outputs.publish_artifact_name == '' |
| 266 | + if: needs.resolve_request.outputs.should_run == 'true' && needs.resolve_request.outputs.publish_artifact_name == '' && needs.resolve_request.outputs.visibility_decision != 'skip' |
175 | 267 | runs-on: blacksmith-16vcpu-ubuntu-2404 |
176 | 268 | timeout-minutes: 360 |
177 | 269 | environment: qa-live-shared |
@@ -1110,6 +1202,61 @@ jobs: |
1110 | 1202 | echo "Mantis Telegram desktop proof failed: comparison=${COMPARISON_STATUS:-unset}." >&2 |
1111 | 1203 | exit 1 |
1112 | 1204 |
|
| 1205 | + report_no_visible_change: |
| 1206 | + name: Report no visible Telegram change |
| 1207 | + needs: resolve_request |
| 1208 | + if: needs.resolve_request.outputs.should_run == 'true' && needs.resolve_request.outputs.visibility_decision == 'skip' |
| 1209 | + runs-on: ubuntu-24.04 |
| 1210 | + environment: qa-live-shared |
| 1211 | + permissions: {} |
| 1212 | + steps: |
| 1213 | + - name: Create Mantis GitHub App token |
| 1214 | + id: mantis_app_token |
| 1215 | + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3 |
| 1216 | + with: |
| 1217 | + app-id: ${{ secrets.MANTIS_GITHUB_APP_ID }} |
| 1218 | + private-key: ${{ secrets.MANTIS_GITHUB_APP_PRIVATE_KEY }} |
| 1219 | + owner: ${{ github.repository_owner }} |
| 1220 | + repositories: ${{ github.event.repository.name }} |
| 1221 | + permission-pull-requests: write |
| 1222 | + |
| 1223 | + - name: Comment that no visible proof applies |
| 1224 | + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 |
| 1225 | + env: |
| 1226 | + TARGET_PR: ${{ needs.resolve_request.outputs.pr_number }} |
| 1227 | + with: |
| 1228 | + github-token: ${{ steps.mantis_app_token.outputs.token }} |
| 1229 | + script: | |
| 1230 | + const marker = "<!-- mantis-telegram-desktop-proof -->"; |
| 1231 | + const body = `${marker}\nThere was nothing visible to test in this PR at all.`; |
| 1232 | + const { owner, repo } = context.repo; |
| 1233 | + const issueNumber = Number(process.env.TARGET_PR); |
| 1234 | + const comments = await github.paginate(github.rest.issues.listComments, { |
| 1235 | + owner, |
| 1236 | + repo, |
| 1237 | + issue_number: issueNumber, |
| 1238 | + per_page: 100, |
| 1239 | + }); |
| 1240 | + const existing = comments.findLast( |
| 1241 | + (comment) => |
| 1242 | + comment.user?.login === "openclaw-mantis[bot]" && |
| 1243 | + comment.body?.includes(marker), |
| 1244 | + ); |
| 1245 | + if (existing) { |
| 1246 | + try { |
| 1247 | + await github.rest.issues.updateComment({ |
| 1248 | + owner, |
| 1249 | + repo, |
| 1250 | + comment_id: existing.id, |
| 1251 | + body, |
| 1252 | + }); |
| 1253 | + return; |
| 1254 | + } catch { |
| 1255 | + core.warning(`Could not update Mantis comment ${existing.id}; creating a new one.`); |
| 1256 | + } |
| 1257 | + } |
| 1258 | + await github.rest.issues.createComment({ owner, repo, issue_number: issueNumber, body }); |
| 1259 | +
|
1113 | 1260 | publish_existing_telegram_desktop_proof: |
1114 | 1261 | name: Publish existing native Telegram proof |
1115 | 1262 | needs: resolve_request |
|
0 commit comments