Skip to content

Stop retrying Copilot cybersecurity-policy rejections - #77351

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-github-actions-job
Nov 13, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-github-actions-job

Conversation

Copilot AI commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The failing Actions job received a provider HTTP 422 cybersecurity-policy rejection. The harness classified it as partial execution and retried the unchanged request three times.

  • Terminal classification: Recognize the exact rejection prefix in top-level SDK query and sdk_driver error events; reuse the existing content_filter stop path.
  • Preserved behavior: Retain failure status even when noop output exists. Exclude quoted, unrelated, and sub-agent errors.
  • Regression coverage: Cover both observed error formats and single-attempt subprocess behavior.

This addresses futile retries, not the underlying provider-access restriction.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot extend this to any harness using GitHub provider

Copilot AI changed the title [WIP] Fix failing GitHub Actions job Stop retrying Copilot cybersecurity-policy rejections Nov 13, 2026
Copilot AI requested a review from pelikhan November 13, 2026 05:04
@pelikhan
pelikhan marked this pull request as ready for review November 13, 2026 05:04
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 05:04
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Matt Pocock Skills Reviewer · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 182 · ◷

Generated by Ponytail Reviewer for #77351

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Commit pushed: 226a1b5

Generated by PR Specification Reviewer for #77351

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the changed content-filter classification and regression coverage. The exact top-level query/sdk_driver policy rejection handling is scoped to root sessions and preserves retry behavior for unrelated or nested events. No blocking correctness issues found.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed head c37225a against Copilot SDK Driver Specification v1.0.2. The PR intentionally extends main-session content-filter evidence to top-level session.error events for errorType query/sdk_driver with the exact cybersecurity-risk 422 prefix, while preserving nested, quoted, unrelated, and failure/noop semantics. Synchronized docs/src/content/docs/specs/copilot-sdk-driver-specification.md to v1.0.3: updated Section 7.2, added T-CSD-301..305 and checklist coverage, and changelog entry. The specification commit is queued for publication to the same-repository PR branch. No blocking conformance findings.

Generated by PR Specification Reviewer for #77351 · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the provider policy-rejection handling change.

No open issues 🎉

What changed in this PR

This PR updates the Copilot harness to stop retrying explicit provider cybersecurity-policy rejections, reusing the existing terminal content_filter handling.

Changes:

  • Recognize the exact rejection prefix in top-level query and sdk_driver error events.
  • Preserve failure status even when noop output exists, while excluding quoted, unrelated, and sub-agent errors.
  • Extend regression coverage for both error formats and single-attempt subprocess behavior.
File Description
actions/​setup/​js/​copilot_harness.test.cjs Adds policy-rejection classification cases and expands retry/noop regression coverage.
actions/​setup/​js/​copilot_harness.cjs Classifies matching top-level provider policy errors as terminal content-filter failures.

Review effort: Balanced (dynamic)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /codebase-design. The fix is correct and the change is small. Two non-blocking suggestions are inline.

📋 Key Themes & Highlights

Key Themes

  • Terminal classification: the new session.error branch correctly reuses the existing content_filter stop path, so the retry is suppressed and the attempt stays failed.
  • Trust boundary: the new branch is not gated the way assistant.message is (rte: true). Impact looks bounded, but it should be stated in the PR description.
  • Duplicated literal: the policy prefix is hand-copied between the harness and the tests.

Positive Highlights

  • ✅ Nested and sub-agent errors are excluded through copilotSessionContext, and the tests cover that.
  • ✅ The sdk_driver event shape matches the producer in copilot_sdk_session.cjs, so the new branch matches real output.
  • ✅ The subprocess test checks single-attempt behavior with both noop states.

Validation Note

vitest is not installed in this environment (npm ci failed on a TLS certificate error), so I could not run the suite. I exercised the predicate directly with Node: all 3 positive cases return true, and all 9 negative cases from the test table return false. Please confirm CI runs copilot_harness.test.cjs.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread actions/setup/js/copilot_harness.cjs Outdated
if (context.agentId === undefined && !context.parentToolUseId && getCopilotMessageRefusal(event.data)?.reason === "content_filter") return true;
if (context.agentId !== undefined || context.parentToolUseId) continue;
if (event.type === "assistant.message" && getCopilotMessageRefusal(event.data)?.reason === "content_filter") return true;
if (event.type === "session.error" && ["query", "sdk_driver"].includes(event.data?.errorType) && typeof event.data?.message === "string" && /^422 This content was flagged for possible cybersecurity risk\./.test(event.data.message))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/codebase-design] The provider rejection prefix is now inline in this regex, and the same wording is hand-copied into the test file. Hoist it into a named constant beside COPILOT_CONTENT_FILTER_MESSAGE in copilot_session.cjs (the existing pattern for this failure class) and reuse it in the tests, so a provider wording change is a one-line edit. Pulling the compound condition into a named helper would also make this 235-character line easier to read.

💡 Suggested shape
// copilot_session.cjs
const COPILOT_CYBERSECURITY_POLICY_PREFIX = "422 This content was flagged for possible cybersecurity risk.";

Then check event.data.message.startsWith(COPILOT_CYBERSECURITY_POLICY_PREFIX). For a literal prefix this is equivalent to the current ^-anchored regex.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exported CYBERSECURITY_POLICY_REJECTION_PREFIX from the shared provider detector and reused it across the Copilot, Claude, Codex, and shared detector tests. This also keeps the literal centralized for future wording changes. Commit: a682537.

Comment thread actions/setup/js/copilot_harness.cjs Outdated
function isCopilotContentFilterError(output) {
for (const event of iterateJsonl(output)) {
if (event?.type !== "assistant.message") continue;
if (event?.type !== "assistant.message" && event?.type !== "session.error") continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] Question on the trust boundary: this scan runs over combined stdout/stderr, which can include tool output. A tool result that echoes a session.error JSON line with this prefix would now suppress retries. The assistant.message branch requires rte: true, but the new session.error branch has no equivalent gate. The impact looks bounded (it only suppresses a retry on an attempt that already failed, and the attempt is still marked failed), so this is probably acceptable. Please confirm that and state the assumption in the PR description.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed: because the classifier scans combined process output, tool output could echo a matching top-level session.error and suppress a retry. The consequence is limited to not retrying an attempt that already failed; content_filter remains a failure and cannot become success/noop. I cannot edit the PR description through the available GitHub interface, so this assumption still needs to be copied into the description before merge.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot extend this to any harness using GitHub provider

Extended terminal cybersecurity-policy rejection handling to Copilot, Claude, and Codex when routed through a GitHub provider, with regression coverage. Commit: f2ea18c8.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Ran the PR finisher. The shared-prefix test cleanup is committed as a682537, and local validation passed (955 targeted tests). Current CI is still running on this commit; mergeability is blocked while checks/review threads remain unresolved. I replied to both outstanding review threads; the available interface cannot resolve them or edit the PR description.

*/
function isTopLevelEvent(event) {
const data = event?.data ?? {};
return ![event?.agentId, event?.agent_id, data.agentId, data.agent_id, event?.parentToolUseId, event?.parent_tool_use_id, data.parentToolUseId, data.parent_tool_use_id, event?.parentToolCallId, data.parentToolCallId].some(
@pelikhan
pelikhan merged commit d55f3ed into main Nov 13, 2026
51 checks passed
@pelikhan
pelikhan deleted the copilot/fix-github-actions-job branch November 13, 2026 06:29
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants