Skip to content

[WIP] Fix context is not defined error in safe output MCP server#19544

Merged
pelikhan merged 5 commits intomainfrom
copilot/fix-safe-output-context-error
Mar 4, 2026
Merged

[WIP] Fix context is not defined error in safe output MCP server#19544
pelikhan merged 5 commits intomainfrom
copilot/fix-safe-output-context-error

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

  • Analyze the safe-outputs MCP server code for unguarded context global accesses
  • Fix safe_output_helpers.cjs: guard resolveIssueNumber's direct global context.payload?.issue?.number access (used typeof context !== "undefined" check to avoid ReferenceError in environments without GitHub Actions context)
  • Fix safe_outputs_mcp_server_http.cjs: load shim.cjs at module top as belt-and-suspenders to ensure global.context is always set even when loaded without the entry point (e.g. schedule events or direct startup)
  • Fix safe_output_helpers.test.cjs: import missing beforeEach from vitest (was causing all 65 tests in the file to fail to register)
  • Add test coverage for resolveIssueNumber when context is undefined (schedule event scenario, no-context case, fallback to global context)
  • Run lint/fmt/tests: no new failures introduced; 65 additional tests now pass

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 4, 2026 08:39
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 4, 2026 09:01
Copilot AI review requested due to automatic review settings March 4, 2026 09:01
@pelikhan pelikhan merged commit 4861bef into main Mar 4, 2026
44 checks passed
@pelikhan pelikhan deleted the copilot/fix-safe-output-context-error branch March 4, 2026 09:06
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