Skip to content

[aw]: Follow-up to #1453: create-pull-request MCP-preflight still fails on shallow/detached-HEAD checkouts in the Agent job #1457

Description

@jamesadevine

Follow-up to #1453

While fixing #1453 (emitting the prepare-pr-base step in the SafeOutputs
job so the Stage 3 executor's git worktree add origin/<target> resolves), an
external comment on #1453 reported that the Agent-job MCP-preflight also
fails on shallow / detached-HEAD checkouts — i.e. the prepare-pr-base step
running in its own (Agent) job still isn't leaving the diff base resolvable
for the host-side SafeOutputs MCP server.

From the #1453 comment (Agent-job safeoutputs.log):

[WARN] [rmcp::service] ... "Cannot determine diff base: no remote tracking branch found.
This can happen with shallow clones (fetchDepth: 1). Ensure the pipeline fetches full history
or push a tracking branch."

Scope

The #1453 fix covers the SafeOutputs-job executor path only (option a:
the prepare-pr-base bundle is now emitted before ado-aw execute). This
follow-up tracks the Agent-job MCP-preflight path.

Hypotheses to investigate

  • The prepare-pr-base step's fetch/deepen isn't landing
    refs/remotes/origin/<target> on a detached-HEAD shallow checkout (ADO's
    default checkout mode), OR
  • src/mcp.rs::find_merge_base wants the current branch's upstream, which a
    detached-HEAD checkout doesn't have, rather than resolving purely via
    refs/remotes/origin/HEADorigin/<target>.

Acceptance

  • The create-pull-request diff base resolves at agent time on a
    shallow and detached-HEAD checkout (no origin/<current> upstream), and
  • the MCP-preflight no longer emits "Cannot determine diff base" in that setup.

Related: #1413, #1425, #1453.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentic-workflowsbugSomething isn't workingrustPull requests that update rust code

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions