Skip to content

Commit f73da36

Browse files
committed
update: mods
1 parent 1ec1021 commit f73da36

File tree

4 files changed

+69
-26
lines changed

4 files changed

+69
-26
lines changed

apps/open-swe/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export default {
1616
extensionsToTreatAsEsm: [".ts"],
1717
setupFiles: ["dotenv/config"],
1818
passWithNoTests: true,
19-
testTimeout: 20_000,
19+
testTimeout: 7200_000,
2020
testMatch: ["<rootDir>/src/**/*.test.ts"],
2121
};

apps/open-swe/langbench/evaluator.eval.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,19 @@ async function runOpenSWEWithStreamTracking(inputs: {
158158
return result; // instead of skipping, we should award 0 points
159159
}
160160

161+
logger.info("✅ Successfully detected planner session", {
162+
thread_id: threadId,
163+
plannerSessionId: plannerSession.threadId,
164+
plannerRunId: plannerSession.runId,
165+
});
166+
161167
let plannerRun;
162168
try {
163169
plannerRun = await withRetry(() =>
164170
lgClient.runs.join(plannerSession.threadId, plannerSession.runId),
165171
);
166172

167-
logger.info("Agent joined planner session", {
173+
logger.info("✅ Successfully joined planner session", {
168174
plannerSession,
169175
});
170176
} catch (error) {
@@ -194,15 +200,21 @@ async function runOpenSWEWithStreamTracking(inputs: {
194200
return result; // instead of skipping, we should award 0 points
195201
}
196202

197-
logger.info("Agent joined programmer session", {
198-
programmerSession,
203+
logger.info("✅ Successfully detected programmer session", {
204+
thread_id: threadId,
205+
programmerSessionId: programmerSession.threadId,
206+
programmerRunId: programmerSession.runId,
199207
});
200208

201209
let programmerRun;
202210
try {
203211
programmerRun = await withRetry(() =>
204212
lgClient.runs.join(programmerSession.threadId, programmerSession.runId),
205213
);
214+
215+
logger.info("✅ Successfully joined programmer session", {
216+
programmerSession,
217+
});
206218
} catch (error) {
207219
logger.error("Error joining programmer run", {
208220
thread_id: threadId,
@@ -435,6 +447,6 @@ ls.describe(DATASET_NAME, () => {
435447
throw new Error(`PR processing failed: ${result.error}`);
436448
}
437449
},
438-
300_000, // 5 minute timeout per PR
450+
0, // No timeout - run forever
439451
);
440452
});

apps/open-swe/src/graphs/programmer/nodes/open-pr.ts

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ import {
3535
getActivePlanItems,
3636
getPullRequestNumberFromActiveTask,
3737
} from "@open-swe/shared/open-swe/tasks";
38+
import {
39+
isLocalMode,
40+
getLocalWorkingDirectory,
41+
} from "@open-swe/shared/open-swe/local-mode";
3842
import { createOpenPrToolFields } from "@open-swe/shared/open-swe/tools";
3943
import { trackCachePerformance } from "../../../utils/caching.js";
4044
import { getModelManager } from "../../../utils/llms/model-manager.js";
@@ -43,7 +47,6 @@ import {
4347
GitHubPullRequestList,
4448
GitHubPullRequestUpdate,
4549
} from "../../../utils/github/types.js";
46-
import { getRepoAbsolutePath } from "@open-swe/shared/git";
4750

4851
const logger = createLogger(LogLevel.INFO, "Open PR");
4952

@@ -114,26 +117,29 @@ export async function openPullRequest(
114117
let branchName = state.branchName;
115118
let updatedTaskPlan: TaskPlan | undefined;
116119

117-
const repoPath = getRepoAbsolutePath(state.targetRepository);
118-
const changedFiles = await getChangedFilesStatus(repoPath, sandbox, config);
120+
// Only check for changed files and commit in local mode
121+
if (isLocalMode(config)) {
122+
const repoPath = getLocalWorkingDirectory();
123+
const changedFiles = await getChangedFilesStatus(repoPath, sandbox, config);
119124

120-
if (changedFiles.length > 0) {
121-
logger.info(`Has ${changedFiles.length} changed files. Committing.`, {
122-
changedFiles,
123-
});
124-
const result = await checkoutBranchAndCommit(
125-
config,
126-
state.targetRepository,
127-
sandbox,
128-
{
129-
branchName,
130-
githubInstallationToken,
131-
taskPlan: state.taskPlan,
132-
githubIssueId: state.githubIssueId,
133-
},
134-
);
135-
branchName = result.branchName;
136-
updatedTaskPlan = result.updatedTaskPlan;
125+
if (changedFiles.length > 0) {
126+
logger.info(`Has ${changedFiles.length} changed files. Committing.`, {
127+
changedFiles,
128+
});
129+
const result = await checkoutBranchAndCommit(
130+
config,
131+
state.targetRepository,
132+
sandbox,
133+
{
134+
branchName,
135+
githubInstallationToken,
136+
taskPlan: state.taskPlan,
137+
githubIssueId: state.githubIssueId,
138+
},
139+
);
140+
branchName = result.branchName;
141+
updatedTaskPlan = result.updatedTaskPlan;
142+
}
137143
}
138144

139145
const openPrTool = createOpenPrToolFields();
@@ -197,7 +203,7 @@ export async function openPullRequest(
197203
title,
198204
body: `Fixes #${state.githubIssueId}\n\n${body}`,
199205
githubInstallationToken,
200-
baseBranch: state.targetRepository.branch,
206+
baseBranch: state.targetRepository.baseCommit ?? state.targetRepository.branch,
201207
});
202208
} else {
203209
// Ensure the PR is ready for review

apps/open-swe/src/utils/github/git.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,31 @@ async function performClone(
560560
});
561561

562562
if (targetRepository.baseCommit) {
563+
// When cloning from a baseCommit, we're in detached HEAD state
564+
// Create a branch if we have a branchName
565+
if (branchName) {
566+
try {
567+
logger.info("Creating branch from baseCommit", {
568+
branch: branchName,
569+
baseCommit: targetRepository.baseCommit,
570+
});
571+
572+
await sandbox.git.createBranch(absoluteRepoDir, branchName);
573+
574+
logger.info("Successfully created branch from baseCommit", {
575+
branch: branchName,
576+
});
577+
578+
return branchName;
579+
} catch (error) {
580+
logger.error("Failed to create branch from baseCommit", {
581+
branchName,
582+
baseCommit: targetRepository.baseCommit,
583+
error,
584+
});
585+
throw error;
586+
}
587+
}
563588
return targetRepository.baseCommit;
564589
}
565590

0 commit comments

Comments
 (0)