diff --git a/.github/workflows/reusable-agents-verifier.yml b/.github/workflows/reusable-agents-verifier.yml index 488899bb4..32d7f5b79 100644 --- a/.github/workflows/reusable-agents-verifier.yml +++ b/.github/workflows/reusable-agents-verifier.yml @@ -647,7 +647,7 @@ jobs: # Use verify:create-issue label on PRs with CONCERNS to manually create follow-up issues - name: Open follow-up issue on verifier failure id: failure_issue - # Disabled - use agents-verify-to-issue-v2.yml with verify:create-issue label instead + if: false # Disabled - use agents-verify-to-issue-v2.yml with verify:create-issue label instead uses: actions/github-script@v8 env: PR_URL: ${{ steps.context.outputs.pr_html_url }} diff --git a/scripts/check_issue_consistency.py b/scripts/check_issue_consistency.py index 2c8df4c00..39baf4ef6 100755 --- a/scripts/check_issue_consistency.py +++ b/scripts/check_issue_consistency.py @@ -73,6 +73,15 @@ def extract_head_ref_issue_numbers(head_ref: str) -> set[int]: return extract_issue_numbers(head_ref or "", include_hash=False) +def resolve_head_ref_issue_number(head_ref: str) -> tuple[int | None, bool]: + numbers = extract_head_ref_issue_numbers(head_ref) + if len(numbers) == 1: + return next(iter(numbers)), False + if len(numbers) > 1: + return None, True + return None, False + + def _is_merge_commit_subject(message: str) -> bool: return MERGE_COMMIT_PATTERN.search(message or "") is not None @@ -402,19 +411,17 @@ def main() -> int: pr_title, head_ref = resolve_pr_context(args.pr_title, args.head_ref) pr_issue = extract_title_issue_number(pr_title) if not pr_issue: - head_numbers = extract_head_ref_issue_numbers(head_ref) - head_numbers_present = False - if len(head_numbers) == 1: - pr_issue = next(iter(head_numbers)) - elif len(head_numbers) > 1: + pr_issue, head_ambiguous = resolve_head_ref_issue_number(head_ref) + if head_ambiguous: + print( + "Warning: Multiple issue numbers detected in head ref; " + "ignoring head ref and falling back to commits/headers.", + file=sys.stderr, + ) + if not pr_issue: if is_autofix_context(pr_title, head_ref): print("Skipping issue consistency check: autofix context with no issue number.") return 0 - head_numbers_present = True - elif is_autofix_context(pr_title, head_ref): - print("Skipping issue consistency check: autofix context with no issue number.") - return 0 - if not pr_issue: commit_messages, commit_fallback = collect_commit_messages( args.base_ref, base_sha, base_remote ) @@ -436,12 +443,6 @@ def main() -> int: if len(combined_issue_numbers) == 1: pr_issue = next(iter(combined_issue_numbers)) elif not combined_issue_numbers: - if head_numbers_present: - print( - "Skipping issue consistency check: multiple issue numbers detected in head ref " - "without additional issue references." - ) - return 0 print("Skipping issue consistency check: no issue references found.") return 0 else: diff --git a/tests/scripts/test_issue_consistency_check.py b/tests/scripts/test_issue_consistency_check.py index fb41aba6a..d48be6009 100644 --- a/tests/scripts/test_issue_consistency_check.py +++ b/tests/scripts/test_issue_consistency_check.py @@ -113,34 +113,26 @@ def fake_run_git(args: list[str]) -> str: assert calls == [["log"], ["log", "-n", "1"]] -def test_main_skips_on_multiple_head_ref_issue_numbers(monkeypatch, capsys) -> None: - def fake_collect_commit_messages(base_ref, base_sha, base_remote): - return [], False - - def fake_collect_changed_files(base_ref, base_sha, base_remote): - return [], False - - # Ensure GITHUB_EVENT_PATH doesn't interfere with autofix detection +def test_main_skips_ambiguous_head_ref(monkeypatch, capsys) -> None: monkeypatch.delenv("GITHUB_EVENT_PATH", raising=False) + monkeypatch.setenv("PR_TITLE", "") + monkeypatch.setenv("HEAD_REF", "codex/issue-101-issue-202") + monkeypatch.setenv("BASE_REF", "") + monkeypatch.setenv("BASE_SHA", "") + monkeypatch.setenv("BASE_REMOTE", "origin") + monkeypatch.setattr(sys, "argv", ["check_issue_consistency.py"]) monkeypatch.setattr( check_issue_consistency, "collect_commit_messages", - fake_collect_commit_messages, + lambda *args, **kwargs: ([], False), ) monkeypatch.setattr( check_issue_consistency, "collect_changed_files", - fake_collect_changed_files, - ) - monkeypatch.setattr( - sys, - "argv", - ["check_issue_consistency.py", "--pr-title", "", "--head-ref", "codex/issue-12-issue-34"], + lambda *args, **kwargs: ([], False), ) - exit_code = check_issue_consistency.main() + assert check_issue_consistency.main() == 0 captured = capsys.readouterr() - - assert exit_code == 0 - assert "multiple issue numbers detected in head ref" in captured.out + assert "Skipping issue consistency check: no issue references found." in captured.out diff --git a/tests/workflows/fixtures/keepalive/harness.js b/tests/workflows/fixtures/keepalive/harness.js index b66b9a637..612bc9315 100755 --- a/tests/workflows/fixtures/keepalive/harness.js +++ b/tests/workflows/fixtures/keepalive/harness.js @@ -383,6 +383,8 @@ async function runScenario(scenario) { Boolean(scenario.clearTokenDefaults) || Boolean(scenarioEnv.CLEAR_TOKEN_DEFAULTS) || Boolean(scenarioEnv.clear_token_defaults) || + Boolean(process.env.CLEAR_TOKEN_DEFAULTS) || + Boolean(process.env.clear_token_defaults) || allExplicitTokensBlank; const envOverrides = { diff --git a/tests/workflows/test_keepalive_workflow.py b/tests/workflows/test_keepalive_workflow.py index e8561ded1..3129321a5 100644 --- a/tests/workflows/test_keepalive_workflow.py +++ b/tests/workflows/test_keepalive_workflow.py @@ -564,6 +564,8 @@ def test_keepalive_requires_instruction_token() -> None: assert scenario_path.exists(), "Scenario fixture missing" command = ["node", str(HARNESS), str(scenario_path)] env = _clean_token_env(os.environ.copy()) + env["CLEAR_TOKEN_DEFAULTS"] = "true" + env["clear_token_defaults"] = "true" result = subprocess.run(command, capture_output=True, text=True, env=env) assert result.returncode != 0, "Expected harness to fail without dispatch token" combined_output = (result.stderr or "") + (result.stdout or "")