Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
407 changes: 312 additions & 95 deletions .github/scripts/keepalive_orchestrator_gate_runner.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/agents-81-gate-followups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ jobs:
per_page: 100,
});

const workflowFile = 'agents-autofix-loop.yml';
const workflowFile = 'agents-81-gate-followups.yml';
// Reduce attempts for auto-escalated PRs (they weren't agent-initiated)
const isEscalated = labels.includes('autofix:escalated');
const maxAttempts = isEscalated
Comment on lines +884 to 887

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Count only autofix runs when enforcing retry limit

Switching workflowFile to agents-81-gate-followups.yml makes previousRuns include every completed run of the consolidated workflow for the same head_sha, not just autofix attempts. In this file, keepalive/manual followup runs can complete on the same commit and inflate attemptCount, which can trip attemptCount > maxAttempts and skip autofix before it actually gets its intended number of retries.

Useful? React with 👍 / 👎.

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/agents-auto-pilot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2742,39 +2742,40 @@ jobs:
? `✅ Added labels: \`agent:${agentKey}\`, \`agents:keepalive\`, \`autofix\``
: '⚠️ Could not add labels (add manually)';

// Dispatch PR meta workflow to build Automated Status Summary
// Dispatch PR event hub to build Automated Status Summary
// (GITHUB_TOKEN actions do not trigger workflow runs automatically)
try {
await withRetry((client) => client.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'agents-pr-meta.yml',
workflow_id: 'agents-80-pr-event-hub.yml',
ref: baseBranch,
inputs: {
pr_number: pr.number.toString(),
handler: 'pr-meta',
debug: 'false'
}
}));
core.info(`Dispatched PR meta update for PR #${pr.number}`);
core.info(`Dispatched PR event hub update for PR #${pr.number}`);
} catch (dispatchError) {
core.warning(`Could not dispatch PR meta update: ${dispatchError?.message}`);
core.warning(`Could not dispatch PR event hub update: ${dispatchError?.message}`);
}

// Dispatch keepalive workflow since GITHUB_TOKEN labels don't trigger it
// Dispatch gate followups workflow since GITHUB_TOKEN labels don't trigger it
try {
await withRetry((client) => client.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'agents-keepalive-loop.yml',
workflow_id: 'agents-81-gate-followups.yml',
ref: baseBranch,
inputs: {
pr_number: pr.number.toString(),
force_retry: 'true'
}
}));
core.info(`Dispatched keepalive for PR #${pr.number}`);
core.info(`Dispatched gate followups for PR #${pr.number}`);
} catch (dispatchError) {
core.warning(`Could not dispatch keepalive: ${dispatchError?.message}`);
core.warning(`Could not dispatch gate followups: ${dispatchError?.message}`);
}

// Add PR link comment to the issue with full URL for visibility
Expand Down
43 changes: 6 additions & 37 deletions .github/workflows/agents-autofix-dispatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ jobs:
secrets: ${{ toJSON(secrets) }}
github_token: ${{ steps.app_token.outputs.token || github.token }}

- name: Dispatch autofix workflow
- name: Acknowledge consolidated autofix handling
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
github-token: ${{ steps.app_token.outputs.token || github.token }}
script: |
const { createTokenAwareRetry } = require('./.github/scripts/github-api-with-retry.js');
const { withRetry } = await createTokenAwareRetry({
github,
core,
task: 'dispatch-autofix-loop',
});

const payload = context.payload.client_payload || {};
const prNumber = Number(payload.pr_number);
const gateRunId = String(payload.gate_run_id || '');
Expand All @@ -65,32 +58,8 @@ jobs:
core.setFailed('Missing gate_run_id in payload');
return;
}
const owner = context.repo.owner;
const repo = context.repo.repo;
const defaultBranch = context.payload.repository?.default_branch || 'main';
const ref = `refs/heads/${defaultBranch}`;
try {
await withRetry((client) =>
client.request(
'POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches',
{
owner,
repo,
workflow_id: 'agents-autofix-loop.yml',
ref,
inputs: {
gate_run_id: gateRunId,
pr_number: String(prNumber),
head_sha: headSha,
},
}
)
);
const shaNote = headSha ? `, headSha=${headSha}` : '';
const trace = `gateRunId=${gateRunId}${shaNote}`;
core.info(
`Triggered agents-autofix-loop for PR #${prNumber} (${trace}).`
);
} catch (error) {
core.setFailed(`Failed to dispatch autofix workflow: ${error.message}`);
}
const shaNote = headSha ? `, headSha=${headSha}` : '';
const trace = `gateRunId=${gateRunId}${shaNote}`;
core.info(
`Autofix for PR #${prNumber} is handled by agents-81-gate-followups via Gate workflow_run (${trace}).`
);
Loading
Loading