diff --git a/.github/workflows/cursor-automation.yml b/.github/workflows/cursor-automation.yml index cea4bc752..1ec3f14ee 100644 --- a/.github/workflows/cursor-automation.yml +++ b/.github/workflows/cursor-automation.yml @@ -4244,7 +4244,7 @@ jobs: github-token: ${{ secrets.TRIAGE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | const pull_number = Number(process.env.PULL_NUMBER); - const marker = ``; + const marker = ``; const trustedAuthors = new Set( process.env.OWN_ACTORS.split(',').map((login) => login.trim().toLowerCase()), ); @@ -4735,7 +4735,7 @@ jobs: }); if (['fix', 'give_up', 'mark_ready'].includes(decision.action)) { const markerPrefix = - `\s*$/, ''); + .match(/;dispatch=([^\s]+)\s*-->\s*$/)?.[1] || ''; const workflowRuns = await github.paginate( github.rest.actions.listWorkflowRuns, { @@ -4767,7 +4766,8 @@ jobs: }); } const dispatchId = crypto.randomUUID(); - const marker = `${markerPrefix}${dispatchId} -->`; + const marker = + `${markerPrefix}review-id=${latestCodexReview.review.id};dispatch=${dispatchId} -->`; const { data: markerComment } = await github.rest.issues.createComment({ ...context.repo, diff --git a/scripts/cursor-automation.test.cjs b/scripts/cursor-automation.test.cjs index 833c05608..a30760dfe 100644 --- a/scripts/cursor-automation.test.cjs +++ b/scripts/cursor-automation.test.cjs @@ -80,7 +80,8 @@ test('Codex polling dispatches actionable submitted reviews to the fix loop', () assert.match(poll, /DISPATCH_TOKEN:/); assert.match(poll, /latestCodexReview/); assert.match(poll, /\['fix', 'give_up', 'mark_ready'\]\.includes\(decision\.action\)/); - assert.match(poll, /cursor-codex-dispatch:review-id=/); + assert.match(poll, /cursor-codex-dispatch:head=/); + assert.match(poll, /cursor-codex-dispatch:head=\$\{pr\.head\.sha\};/); assert.match(poll, /const priorDispatch/); assert.match(poll, /github\.paginate\(\s*github\.rest\.actions\.listWorkflowRuns/); assert.match(poll, /const dispatchedRunIsActive/); @@ -114,7 +115,7 @@ test('Codex poll dispatch markers are cleared only after the dispatched workflow assert.match(workflow, /run-name:/); assert.match(cleanup, /needs: \[codex_loop, publish_codex_fix\]/); assert.match(cleanup, /if: always\(\)/); - assert.match(cleanup, /cursor-codex-dispatch:review-id=/); + assert.match(cleanup, /cursor-codex-dispatch:head=/); assert.match(cleanup, /CODEX_DISPATCH_ID/); assert.match(cleanup, /trustedAuthors/); assert.match(cleanup, /github\.rest\.issues\.deleteComment/);