fix: Pulling and pushing bug (#535)

This commit is contained in:
Brace Sproul 2025-07-25 15:46:26 -07:00 • committed by GitHub
parent 2d17904153
commit 248957ae62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -146,22 +146,26 @@ export async function checkoutBranchAndCommit(
},
{ retries: 3, delay: 0 },
);
const gitStatus = await sandbox.git.status(absoluteRepoDir);
const errorFields = {
...(pushRes2 instanceof Error
? {
name: pushRes2.name,
message: pushRes2.message,
stack: pushRes2.stack,
cause: pushRes2.cause,
}
: pushRes2),
};
logger.error("Failed to push changes", {
...errorFields,
gitStatus: JSON.stringify(gitStatus, null, 2),
});
throw new Error("Failed to push changes");
if (pushRes2 instanceof Error) {
const gitStatus = await sandbox.git.status(absoluteRepoDir);
const errorFields = {
...(pushRes2 instanceof Error
? {
name: pushRes2.name,
message: pushRes2.message,
stack: pushRes2.stack,
cause: pushRes2.cause,
}
: pushRes2),
};
logger.error("Failed to push changes", {
...errorFields,
gitStatus: JSON.stringify(gitStatus, null, 2),
});
throw new Error("Failed to push changes");
} else {
logger.info("Pulling changes before pushing succeeded");
}
} else {
logger.info("Successfully pushed changes");
}