Skip to content

fix: suppress spurious error annotations in push_repo_memory for expected git failures#19979

Merged
pelikhan merged 5 commits intomainfrom
copilot/fix-repo-memory-errors
Mar 7, 2026
Merged

fix: suppress spurious error annotations in push_repo_memory for expected git failures#19979
pelikhan merged 5 commits intomainfrom
copilot/fix-repo-memory-errors

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

On first run, push_repo_memory generates 5 GitHub Actions error annotations from git fetch and git pull failures that are entirely expected — the memory branch simply doesn't exist yet. These show up as real errors in the annotations UI, causing confusion.

Root cause

execGitSync unconditionally calls core.error(...) on any non-zero git exit, even when the caller catches and handles the failure. That produces GitHub Actions annotations regardless of whether the failure was anticipated.

Changes

  • git_helpers.cjs — Added suppressLogs option to execGitSync. When true, non-zero exit-status failure details are routed to core.debug instead of core.error, suppressing annotations while preserving debuggability. Spawn-level errors (result.error, e.g. ENOENT/EACCES) always use core.error regardless of suppressLogs since those are unexpected system failures. Removed unnecessary typeof core !== "undefined" guards — core is always available via shim.cjs. The option is destructured out before spreading into spawnSync to avoid passing an unknown option to it.

    // Before: always called core.error on failure → annotations
    execGitSync(["fetch", repoUrl, `${branchName}:${branchName}`], { stdio: "pipe" });
    
    // After: expected failure, no annotation
    execGitSync(["fetch", repoUrl, `${branchName}:${branchName}`], { stdio: "pipe", suppressLogs: true });
  • push_repo_memory.cjs — Applied suppressLogs: true to three call sites where failure is expected:

    • sparse-checkout disable (no-op when sparse checkout isn't active)
    • git fetch for branch existence probe (fails on first run)
    • git pull before push (fails on first run when branch doesn't exist)
    • Downgraded the "Pull failed" core.warning to core.info — it's not a warning, it's normal.
  • git_helpers.test.cjs — Added tests verifying suppressLogs: true prevents core.error calls (for non-zero exits) and routes details to core.debug instead. Added a beforeEach/afterEach that provides a minimal core stub so all tests pass without requiring manual global.core setup.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Changeset

  • Type: patch
  • Description: Silence expected git fetch/git pull failures during push_repo_memory so they don’t produce GitHub Actions error annotations.

Generated by Changeset Generator for issue #19979 ·

Warning

⚠️ Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • ab.chatgpt.com
  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"
    - "github.com"

See Network Configuration for more information.



✨ PR Review Safe Output Test - Run 22807560229

💥 [THE END] — Illustrated by Smoke Claude ·

…po-memory

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix repo-memory noisy errors that are expected fix: suppress spurious error annotations in push_repo_memory for expected git failures Mar 7, 2026
Copilot finished work on behalf of dsyme March 7, 2026 18:37
@pelikhan pelikhan marked this pull request as ready for review March 7, 2026 19:52
Copilot AI review requested due to automatic review settings March 7, 2026 19:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces noisy GitHub Actions error annotations produced by push_repo_memory during first-run scenarios where certain git failures are expected (e.g., the memory branch doesn’t exist yet).

Changes:

  • Added a suppressLogs flag to execGitSync to route expected-failure details to core.debug instead of core.error.
  • Updated push_repo_memory.cjs to use suppressLogs: true for git operations where failure is expected, and downgraded the pull-failure message from warning to info.
  • Added unit tests ensuring suppressLogs prevents core.error calls and uses core.debug for expected failures.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/git_helpers.cjs Introduces suppressLogs option and changes failure logging behavior to avoid error annotations for expected git failures.
actions/setup/js/push_repo_memory.cjs Applies suppressLogs: true to expected-failure git calls and downgrades pull-failure logging to core.info.
actions/setup/js/git_helpers.test.cjs Adds tests covering the new suppressLogs behavior (debug vs error logging).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pelikhan
Copy link
Contributor

pelikhan commented Mar 7, 2026

@copilot core is always available because a shim.cjs is loaded if needed. Update JavaScript.

…ilures

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

Copilot AI commented Mar 7, 2026

@copilot core is always available because a shim.cjs is loaded if needed. Update JavaScript.

Done in 92641df. Removed all typeof core !== "undefined" guards from git_helpers.cjscore is relied on directly. Also took the opportunity to keep core.error for spawn-level failures (result.error, e.g. ENOENT/EACCES) regardless of suppressLogs, since those are always unexpected. Only non-zero git exit-status failures are silenced to core.debug when suppressLogs: true. Tests updated with a beforeEach stub so the basic tests (that don't mock core themselves) continue to pass.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq 4.52.4
curl 8.5.0
gh 2.87.3
node 20.20.0
python3 3.12.3
go 1.24.13
java 10.0.102
dotnet 10.0.102

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Commit pushed: 75c078e

Generated by Changeset Generator

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🤖 Smoke test §22807560248⚠️ PARTIAL PASS (11/12)

Test
GitHub MCP
safeinputs-gh CLI
Serena MCP ❌ (tools unavailable)
Playwright
Web Fetch
File Write
Bash
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Author: @Copilot · Assignees: @dsyme, @Copilot

📰 BREAKING: Report filed by Smoke Copilot ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR cleanly fixes the spurious error annotations on first-run scenarios. The suppressLogs option is well-designed — destructured before spreading avoids polluting spawnSync, and spawn-level errors still always surface via core.error. The test additions in git_helpers.test.cjs give good coverage of both the suppressed and unsuppressed paths.

📰 BREAKING: Report filed by Smoke Copilot

// spurious GitHub Actions error annotations for expected failures (e.g., when
// a branch does not yet exist).
const { suppressLogs = false, ...spawnOptions } = options;

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice pattern — destructuring suppressLogs before spreading ...spawnOptions ensures the custom flag never leaks into spawnSync options. Clean and safe.

} catch (error) {
// Pull might fail if branch doesn't exist yet or on conflicts - this is acceptable
core.warning(`Pull failed (this may be expected): ${getErrorMessage(error)}`);
core.info(`Pull failed (this is expected when branch does not exist yet): ${getErrorMessage(error)}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Downgrading from core.warning to core.info here is correct — a pull failing on first run (no branch yet) is expected behavior, not a warning. This prevents unnecessary orange annotations in the Actions UI.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Smoke Test Results - Run §22807560229

Overall: PARTIAL (1 failed, 2 skipped)

Core Tests (#1-10): ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅

PR Review Tests (#11-17): ✅ ✅ ✅ ⚠️ ✅ ❌ ⚠️

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

@pelikhan pelikhan merged commit 6ddb0d3 into main Mar 7, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/fix-repo-memory-errors branch March 7, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo-memory is a bit noisy with "errors" that are really expected

4 participants