Skip to content

test: isolate update checks from agent CI environment - #50918

Merged
pelikhan merged 1 commit into
mainfrom
copilot/fix-update-check-test-env
Aug 6, 2026
Merged

test: isolate update checks from agent CI environment#50918
pelikhan merged 1 commit into
mainfrom
copilot/fix-update-check-test-env

Conversation

@pelikhan

@pelikhan pelikhan commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • clear COPILOT_AGENT_SESSION_ID in update-check tests that require a non-CI environment
  • prevent caller environment from disabling background update-check test paths

Validation

  • make test-unit-all
  • make agent-report-progress

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

Copilot-Session: 67bef6e0-d62a-4050-aa8e-42e75327fb7d
@pelikhan
pelikhan marked this pull request as ready for review August 6, 2026 17:45
Copilot AI balanced review requested due to automatic review settings August 6, 2026 17:45
@pelikhan
pelikhan merged commit d90074a into main Aug 6, 2026
11 checks passed
@pelikhan
pelikhan deleted the copilot/fix-update-check-test-env branch August 6, 2026 17:45

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.

Pull request overview

Isolates update-check tests from Copilot agent CI environment variables.

Changes:

  • Clears COPILOT_AGENT_SESSION_ID in non-CI test paths.
  • Restores the original environment after testing.
Show a summary per file
File Description
pkg/cli/update_check_test.go Isolates general update-check tests.
pkg/cli/compile_update_check_test.go Isolates compile update-check tests.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Matt Pocock Skills Reviewer. Review the logs for details.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for PR Code Quality Reviewer. Review the logs for details.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Test Quality Sentinel. Review the logs for details.

Test Quality Sentinel: Infrastructure-only PR with proper environment isolation. No new behavioral tests, no violations. 8 lines added for COPILOT_AGENT_SESSION_ID environment variable isolation across compile_update_check_test.go and update_check_test.go.

@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 /tdd — the changes are correct and well-targeted.

📋 Summary

Key Themes

  • Test isolation improved: COPILOT_AGENT_SESSION_ID is now cleared in 6 test functions across 2 files, preventing the agent CI environment from silently disabling update-check code paths under test.
  • Pattern consistency: Tests that already use t.Setenv get the new env var via t.Setenv (automatic restore). The one test that uses manual os.Getenv/os.Setenv save-restore (TestShouldCheckForUpdate) is handled correctly.

Positive Highlights

  • t.Setenv used where possible — automatic cleanup, no risk of leaking state between subtests.
  • ✅ Minimal, surgical change — exactly what was needed.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 25.1 AIC · ⊞ 7.1K
Comment /matt to run again

@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.

Verdict: Approve — minor consistency change

This PR mechanically extends existing env-var isolation (already used for CI, GITHUB_ACTIONS, CONTINUOUS_INTEGRATION) to also cover COPILOT_AGENT_SESSION_ID. No logic changes, no new risk introduced.

Review notes
  • The restore pattern in update_check_test.go (os.Setenv("COPILOT_AGENT_SESSION_ID", origCopilotAgentSessionID)) will set the var to empty string rather than unset it if it was originally unset — but this exactly mirrors the pre-existing origCI handling on the same lines, so it is not a new defect introduced by this diff.
  • Coverage of the new env var is consistent across all affected test functions in both files.
  • No correctness, security, or performance concerns within the diff.

🔎 Code quality review by PR Code Quality Reviewer · auto · 10.5 AIC · ⊞ 7.8K
Comment /review to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.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.

2 participants