(args: {
client: OpencodeClient;
config: RunnerConfig;
question: LongMemEvalQuestion;
datasetIndex: number;
state: RunnerStateFile;
resultsMap: Map<string, QuestionResultRecord>;
})
| 788 | } |
| 789 | |
| 790 | async function processQuestion(args: { |
| 791 | client: OpencodeClient; |
| 792 | config: RunnerConfig; |
| 793 | question: LongMemEvalQuestion; |
| 794 | datasetIndex: number; |
| 795 | state: RunnerStateFile; |
| 796 | resultsMap: Map<string, QuestionResultRecord>; |
| 797 | }): Promise<void> { |
| 798 | const { client, config, question, datasetIndex, state, resultsMap } = args; |
| 799 | const resumedState = state.inProgress[question.question_id]; |
| 800 | if (resultsMap.has(question.question_id)) { |
| 801 | if (resumedState) { |
| 802 | await cleanupSessions({ |
| 803 | client, |
| 804 | config, |
| 805 | questionState: resumedState, |
| 806 | state, |
| 807 | questionId: question.question_id, |
| 808 | }); |
| 809 | await markQuestionCompleted({ config, state, questionState: resumedState }); |
| 810 | } |
| 811 | return; |
| 812 | } |
| 813 | if (state.completedQuestionIds.includes(question.question_id)) { |
| 814 | return; |
| 815 | } |
| 816 | |
| 817 | const questionState = resumedState ?? createQuestionState(question, datasetIndex); |
| 818 | questionState.attemptCount += 1; |
| 819 | questionState.updatedAt = nowIso(); |
| 820 | state.inProgress[question.question_id] = questionState; |
| 821 | await persistState(config, state); |
| 822 | |
| 823 | try { |
| 824 | await appendLog(config.paths.logFile, `Starting question ${question.question_id} (${question.question_type})`); |
| 825 | await replayHaystack({ client, config, question, questionState, state }); |
| 826 | await askFinalQuestion({ client, config, question, questionState, state }); |
| 827 | await judgeQuestion({ config, question, questionState, state, resultsMap }); |
| 828 | await cleanupSessions({ client, config, questionState, state, questionId: question.question_id }); |
| 829 | await markQuestionCompleted({ config, state, questionState }); |
| 830 | await appendLog(config.paths.logFile, `Completed question ${question.question_id}`); |
| 831 | } catch (error) { |
| 832 | updateErrorState(questionState, "process-question", error); |
| 833 | state.inProgress[question.question_id] = questionState; |
| 834 | await persistState(config, state); |
| 835 | await appendLog( |
| 836 | config.paths.logFile, |
| 837 | `Question ${question.question_id} failed: ${questionState.lastError?.message ?? "unknown"}`, |
| 838 | ); |
| 839 | throw error; |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | function buildSummary(results: QuestionResultRecord[], selectedCount: number, config: RunnerConfig): RunSummary { |
| 844 | const rows: RunSummaryRow[] = LONGMEMEVAL_QUESTION_TYPES.map((category) => { |
no test coverage detected