Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/scripts/detect-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ async function detectChanges({ github, context, core, files, fetchFiles } = {})
doc_only: 'false',
run_core: 'true',
reason: 'rate_limited',
docker_changed: 'true',
docker_changed: 'false', // Don't assume docker changes - causes failures in repos without Dockerfile
workflow_changed: 'true',
};
const warn = core?.warning ? core.warning.bind(core) : console.warn.bind(console);
warn('Rate limit reached while determining changed files; assuming code changes.');
warn('Rate limit reached while determining changed files; assuming code changes (but not docker).');
if (core) {
for (const [key, value] of Object.entries(outputs)) {
core.setOutput(key, value);
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/agents-autofix-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,34 @@ jobs:

const body = prData.body || '';
const configMatch = body.match(/autofix\s*:\s*(true|false)/i);
const autofixEnabled = configMatch
let autofixEnabled = configMatch
? configMatch[1].toLowerCase() === 'true'
: hasAgentLabel;

// Auto-escalation: If basic autofix ran but Gate still fails, auto-add agent:codex
// This ensures non-agent PRs can be fixed by Codex when ruff/black isn't enough
if (!autofixEnabled && !configMatch) {
const hasAutofixApplied = labels.includes('autofix:applied') || labels.includes('autofix');
const gateConclusion = (run.conclusion || '').toLowerCase();
const gateFailed = gateConclusion === 'failure';

if (hasAutofixApplied && gateFailed) {
core.info('🔄 Auto-escalation: Basic autofix ran but Gate still failing. Adding agent:codex label...');
try {
await github.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels: ['agent:codex', 'autofix:escalated'],
});
core.info('✅ Added agent:codex and autofix:escalated labels for Codex escalation');
autofixEnabled = true;
} catch (error) {
core.warning(`Failed to add escalation labels: ${error.message}`);
}
}
}

if (!autofixEnabled) {
return stop('autofix disabled for this pull request');
}
Expand All @@ -197,7 +221,9 @@ jobs:
});

const workflowFile = 'agents-autofix-loop.yml';
const maxAttempts = Number(outputs.max_attempts);
// Reduce attempts for auto-escalated PRs (they weren't agent-initiated)
const isEscalated = labels.includes('autofix:escalated');
const maxAttempts = isEscalated ? Math.min(2, Number(outputs.max_attempts)) : Number(outputs.max_attempts);
const previousRuns = await github.paginate(github.rest.actions.listWorkflowRuns, {
owner,
repo,
Expand Down
Loading