Skip to content

Commit dbc0be1

Browse files
Copilotjoshspicer
andauthored
Add optional head_ref property to RemoteAgentJobPayload for async branching support (#7088)
* Initial plan * Add optional head_ref property to RemoteAgentJobPayload for async branching Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> * Update async branch naming to follow copilot/vscode<TIMESTAMP> spec Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> * Remove low-value tests for RemoteAgentJobPayload interface Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
1 parent 37a5d34 commit dbc0be1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/github/copilotApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface RemoteAgentJobPayload {
1919
body_placeholder?: string;
2020
body_suffix?: string;
2121
base_ref?: string;
22+
head_ref?: string;
2223
};
2324
run_name?: string;
2425
}

src/github/copilotRemoteAgent.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class CopilotRemoteAgentManager extends Disposable {
213213
if (!this.autoCommitAndPushEnabled()) {
214214
return { error: vscode.l10n.t('Uncommitted changes detected. Please commit or stash your changes before starting the remote agent. Enable \'{0}\' to push your changes automatically.', CODING_AGENT_AUTO_COMMIT_AND_PUSH), state: 'error' };
215215
}
216-
const asyncBranch = `continue-from-${Date.now()}`;
216+
const asyncBranch = `copilot/vscode${Date.now()}`;
217217
try {
218218
await repository.createBranch(asyncBranch, true);
219219
await repository.add([]);
@@ -256,7 +256,8 @@ export class CopilotRemoteAgentManager extends Disposable {
256256
pull_request: {
257257
title,
258258
body_placeholder: problemContext,
259-
base_ref: ref,
259+
base_ref: hasChanges && autoPushAndCommit ? baseRef : ref,
260+
...(hasChanges && autoPushAndCommit && { head_ref: ref })
260261
}
261262
};
262263
const { pull_request } = await capiClient.postRemoteAgentJob(owner, repo, payload);

0 commit comments

Comments
 (0)