Skip to content

feat: support pipeline_branch param to load pipeline YAML from a specific git branch#200

Merged
thisrohangupta merged 4 commits into
harness:mainfrom
mehulparmariitr:feat/pipeline-branch-param
May 15, 2026
Merged

feat: support pipeline_branch param to load pipeline YAML from a specific git branch#200
thisrohangupta merged 4 commits into
harness:mainfrom
mehulparmariitr:feat/pipeline-branch-param

Conversation

@mehulparmariitr
Copy link
Copy Markdown
Contributor

@mehulparmariitr mehulparmariitr commented May 14, 2026

Description

Adds support for specifying which git branch to load the pipeline YAML from when executing a pipeline via MCP.

Problem

Passing pipelineBranchName to harness_execute was silently ignored. The queryParams map for the pipeline run action had no entry for it, so the value was placed in the YAML request body where Harness ignores it. Harness only reads pipelineBranchName as a URL query parameter.

Fix

Added pipeline_branch: "pipelineBranchName" to the queryParams mapping in src/registry/toolsets/pipelines.ts. Updated actionDescription and bodySchema.fields so the param is discoverable via harness_describe.

Usage

harness_execute(
  url="<pipeline URL>",
  action="run",
  params={"pipeline_branch": "feature/my-fix"}
)

When pipeline_branch is omitted, ?pipelineBranchName= is not sent and Harness falls back to the pipeline's configured default branch.

Tests

6 new tests covering the fix:

Test Location What it verifies
pipeline execute sends pipeline_branch as ?pipelineBranchName= query param tests/registry/registry.test.ts Registry queryParams mapping
pipeline execute omits pipelineBranchName when pipeline_branch not provided tests/registry/registry.test.ts Param absent when not passed
pipeline execute omits pipelineBranchName when pipeline_branch is empty string tests/registry/registry.test.ts Empty string treated as absent (guards value !== "" filter)
pipeline execute sends both pipeline_branch and inputs.branch independently tests/registry/registry.test.ts pipelineBranchName goes to URL query string; inputs.branch expands into body build structure — no interference
passes pipeline_branch from params as ?pipelineBranchName= query param tests/tools/tool-handlers.test.ts Full tool handler path
pipeline_branch coexists with other params without clobbering tests/tools/tool-handlers.test.ts Multi-key params Object.assign path; pipeline_branch + module both arrive on the POST

Type of Change

  • Bug fix
  • New feature

Checklist

  • Tests pass
  • Typecheck passes

mehulparmariitr and others added 4 commits May 14, 2026 22:36
Passing pipelineBranchName to harness_execute was silently ignored
because it wasn't in the queryParams map — it landed in the YAML body
where Harness ignores it.

Adding pipeline_branch: "pipelineBranchName" to the execute action's
queryParams ensures it is sent as ?pipelineBranchName= on the API URL,
which is the only way the Harness pipeline execute endpoint respects it.

Also updates actionDescription and bodySchema.fields to document the
new param so agents and users can discover it via harness_describe.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…am mapping

Verifies that passing pipeline_branch to dispatchExecute sends
?pipelineBranchName= on the API URL, and that omitting it leaves
the param absent (Harness falls back to the pipeline's default branch).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… tool handler

The registry-level test (dispatchExecute directly) already covered the
queryParams mapping. This test covers the full tool handler path:
params={pipeline_branch} → Object.assign into input → dispatchExecute
→ ?pipelineBranchName= on the POST request.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…-param cases

Adds two registry-level tests:
- empty string pipeline_branch is correctly omitted from query params
  (guards the value !== "" filter in registry/index.ts:646)
- pipeline_branch + inputs.branch coexist: pipelineBranchName lands in
  the URL query string while inputs.branch expands into the body build
  structure independently

Adds one tool-handler-level test:
- pipeline_branch coexists with module param without either being dropped
  (tests the multi-key Object.assign path through the execute handler)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@thisrohangupta thisrohangupta merged commit 7207fa6 into harness:main May 15, 2026
8 checks passed
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