fix: work arounds with the round number checks

This commit is contained in:
2025-05-01 15:29:19 -03:00
parent 3129af3e6e
commit acbbb91bbf
2 changed files with 8 additions and 4 deletions

View File

@ -59,14 +59,16 @@ export async function routes() {
const signature = req.body.signature;
const prUrl = req.body.prUrl;
// Modified round number not fetch from the input instead fetch from the namespace
const roundNumber = await namespaceWrapper.getRound();
const roundNumber = req.body.roundNumber;
const success = req.body.success;
const message = req.body.message;
console.log("[TASK] req.body", req.body);
try {
if (!success){
// TODO: Need to call the server to cancel the task
await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
// It cannot be round number based, becasue the current round might already missed the submission window
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
console.error("[TASK] Error summarizing repository:", message);
return;
}
@ -137,11 +139,12 @@ export async function routes() {
if (middleServerResponse.status !== 200) {
throw new Error(`Posting to middle server failed: ${middleServerResponse.statusText}`);
}
await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_SUCCEEDED);
await namespaceWrapper.storeSet(`shouldMakeSubmission`, "true");
await namespaceWrapper.storeSet(`submissionRoundNumber`, roundNumber.toString());
res.status(200).json({ result: "Successfully saved PR" });
} catch (error) {
console.error("[TASK] Error adding PR to summarizer todo:", error);
await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_FAILED);
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_FAILED);
res.status(400).json({ error: "Failed to save PR" });
}
});

View File

@ -17,6 +17,7 @@ export const status = {
SAVING_TODO_PR_FAILED: "Summarizer todo PR not saved",
SAVING_TODO_PR_SUCCEEDED: "Summarizer todo PR saved",
NOT_FINISHED_TASK: "Not finished task",
NO_SUBMISSION_BUT_SUBMISSION_CALLED: "No submission but submission called",
};
export const errorMessage = {