Skip to content

[plan] Fix create_pull_request "context is not defined" error in safeoutputs MCP backend #18643

Closed

Description

@github-actions

Objective

Fix the create_pull_request tool in the safeoutputs MCP backend that fails with context is not defined error.

Context

From audit discussion #18635 (2026-02-26→2026-02-27):

The Daily Documentation Updater successfully committed changes to branch docs/update-android-arm64-stem-commands-2026-02-27 but could not open a PR because create_pull_request failed 3 times with:

context is not defined

This is a backend error in the safeoutputs MCP server's create_pull_request handler.

Investigation Steps

  1. Open actions/setup/js/safe_outputs_handlers.cjs (or equivalent handler file)
  2. Find the create_pull_request handler function
  3. Identify where context is referenced without being defined/passed
  4. Check if context should be derived from the request parameters, environment, or a module import

Files to Investigate

  • actions/setup/js/safe_outputs_handlers.cjs — handler implementation
  • pkg/workflow/js/safe_outputs_handlers.cjs — if it exists
  • Any file containing create_pull_request handler logic in actions/setup/js/

Approach

  1. Locate the create_pull_request handler in the safeoutputs JS codebase
  2. Identify the undefined context variable reference
  3. Fix the reference (likely needs to be extracted from the handler's parameters or from a GitHub client initialization)
  4. Run make fmt-cjs && make lint-cjs to validate
  5. Run make agent-finish before committing

Acceptance Criteria

  • create_pull_request handler no longer throws context is not defined
  • The handler correctly creates a PR in the target repository
  • make lint-cjs passes with no errors
  • Existing safe-output tests still pass

Generated by Plan Command for issue #discussion #18635

  • expires on Mar 1, 2026, 6:38 AM UTC

Activity

  1. pelikhan commented on Feb 27, 2026

    @pelikhan
    Collaborator

    @copilot context is a global object that only exists in actions/github-script.

    Add to shim.cjs

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions