Skip to content

trial: --logical-repo leaves <github-context>.repository pointing at the host repo #50580

Description

@loganrosen

Summary

gh aw trial --logical-repo owner/target rewrites checkout and safe-output targeting to the logical target, but the agent prompt's <github-context> block still reports the host repository. GitHub MCP calls that omit explicit owner/repo therefore operate against the host repo, silently.

Environment

  • gh-aw: observed on v0.84.3; code path still present on main (v0.85.1)
  • OS: macOS

Expected

With --logical-repo owner/target, the agent's notion of "the repository" should be owner/target, consistent with how checkout and safe outputs are already redirected.

Actual

  • actions/checkout → logical target ✅
  • Safe-output processing → logical target ✅
  • Agent prompt <github-context>.repositoryhost repo
  • GitHub MCP calls without explicit owner/repohost repo

Observed symptoms: an issue-intake workflow could not find the target issue, and a scheduled workflow groomed host-repo issues instead of logical-target issues. The run still concluded green.

Reproduction

gh aw trial ./issue-workflow.md \
  --host-repo owner/host \
  --logical-repo owner/target \
  --trigger-context https://github.com/owner/target/issues/123 \
  --yes --json

Then inspect the downloaded agent/aw-prompts/prompt.txt. The workspace/checkout note names owner/target, while the <github-context> block names owner/host.

Code pointers (on main)

  • pkg/workflow/prompts/github_context_prompt.md renders - **repository**: ${{ github.repository }} unconditionally. In trial mode github.repository is the host repo, and there is no logical-repo substitution.
  • WorkflowData.TrialLogicalRepo is only consumed in pkg/workflow/safe_outputs_env.go (GH_AW_TARGET_REPO_SLUG) and the checkout generation path — it never reaches prompt rendering or the GitHub MCP server's default owner/repo.

Impact

The agent can read and reason about one repository while staged safe outputs target another. A successful workflow run is not sufficient to detect the mismatch, so this fails silently in exactly the scenario --logical-repo exists to support.

Suggested behavior

When TrialLogicalRepo is set, render the logical repo in <github-context>.repository (or add an explicit logical-repository field plus a prompt directive), and/or set the GitHub MCP server's default owner/repo to the logical target so tool calls that omit owner/repo resolve correctly.

Workaround

Append a trial-only instruction requiring every GitHub MCP call to pass the logical target's explicit owner and repo.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions