Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 5 additions & 8 deletions .github/scripts/__tests__/agents-pr-meta-update-body.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ test('extractExplicitIssueSyncNumbers returns only explicit issue references', (
);
});

test('resolveNonIssueWorkflowSourceContextForBodySync honors explicit non-issue markers over heuristics', () => {
test('resolveNonIssueWorkflowSourceContextForBodySync yields to branch-inferred issue numbers', () => {
const branchHeuristicContext = resolveNonIssueWorkflowSourceContextForBodySync(
{
body: [
Expand All @@ -577,8 +577,7 @@ test('resolveNonIssueWorkflowSourceContextForBodySync honors explicit non-issue
123,
);

assert.equal(branchHeuristicContext.sourceType, 'local_request');
assert.equal(branchHeuristicContext.sourceRef, 'codex-thread-2026-04-26');
assert.equal(branchHeuristicContext, null);

const prReferenceContext = resolveNonIssueWorkflowSourceContextForBodySync(
{
Expand All @@ -591,8 +590,7 @@ test('resolveNonIssueWorkflowSourceContextForBodySync honors explicit non-issue
123,
);

assert.equal(prReferenceContext.sourceType, 'review_followup');
assert.equal(prReferenceContext.sourceRef, 'PR #123');
assert.equal(prReferenceContext, null);
});

Comment thread
stranske marked this conversation as resolved.
test('resolveNonIssueWorkflowSourceContextForBodySync yields to explicit issue references', () => {
Expand All @@ -610,7 +608,7 @@ test('resolveNonIssueWorkflowSourceContextForBodySync yields to explicit issue r
assert.equal(context, null);
});

test('resolveNonIssueWorkflowSourceContextForBodySync preserves non-issue context when explicit issue differs from heuristic', () => {
test('resolveNonIssueWorkflowSourceContextForBodySync yields to issue numbers even when explicit issue differs', () => {
const context = resolveNonIssueWorkflowSourceContextForBodySync(
{
body: [
Expand All @@ -623,8 +621,7 @@ test('resolveNonIssueWorkflowSourceContextForBodySync preserves non-issue contex
99,
);

assert.equal(context.sourceType, 'local_request');
assert.equal(context.sourceRef, 'codex-thread-2026-04-26');
assert.equal(context, null);
});

test('resolveSourceContextRepairComment updates an existing warning once', async () => {
Expand Down
14 changes: 14 additions & 0 deletions .github/scripts/__tests__/source-context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,20 @@ automation: no_automation
}), true);
});

test('resolvePrSourceContext preserves legacy human-only no-automation wording', () => {
const context = resolvePrSourceContext({
body: `
## Workflow Source

Started from:
- [x] Human-only
`,
});

assert.equal(context.sourceType, SOURCE_TYPES.MANUAL_REMOTE);
assert.equal(context.noAutomation, true);
});

test('sourceTypeFromCheckedTemplate rejects ambiguous checked source choices', () => {
const body = `
## Workflow Source
Expand Down
3 changes: 1 addition & 2 deletions .github/scripts/agents_pr_meta_update_body.js
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,7 @@ function resolveNonIssueWorkflowSourceContextForBodySync(pr = {}, issueNumber =
if (!explicitNonIssueSourceContext) {
return null;
}
const explicitIssueNumbers = extractExplicitIssueSyncNumbers(pr);
if (issueNumber && explicitIssueNumbers.has(Number(issueNumber))) {
if (issueNumber != null) {
return null;
}
return explicitNonIssueSourceContext;
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/source_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CHECKBOX_SOURCE_PATTERNS = Object.freeze([
[SOURCE_TYPES.DEPENDABOT, /\bdependabot\b|\bdependency\s+update\b/i],
]);

const NO_AUTOMATION_CHECKBOX_PATTERN = /\bdo\s+not\s+automate\b/i;
const NO_AUTOMATION_CHECKBOX_PATTERN = /\bdo\s+not\s+automate\b|\bhuman[- ]only\b/i;

function cleanString(value) {
return String(value || '').trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,7 @@ function resolveNonIssueWorkflowSourceContextForBodySync(pr = {}, issueNumber =
if (!explicitNonIssueSourceContext) {
return null;
}
const explicitIssueNumbers = extractExplicitIssueSyncNumbers(pr);
if (issueNumber && explicitIssueNumbers.has(Number(issueNumber))) {
if (issueNumber != null) {
return null;
}
return explicitNonIssueSourceContext;
Expand Down
2 changes: 1 addition & 1 deletion templates/consumer-repo/.github/scripts/source_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CHECKBOX_SOURCE_PATTERNS = Object.freeze([
[SOURCE_TYPES.DEPENDABOT, /\bdependabot\b|\bdependency\s+update\b/i],
]);

const NO_AUTOMATION_CHECKBOX_PATTERN = /\bdo\s+not\s+automate\b/i;
const NO_AUTOMATION_CHECKBOX_PATTERN = /\bdo\s+not\s+automate\b|\bhuman[- ]only\b/i;

function cleanString(value) {
return String(value || '').trim();
Expand Down
Loading