fix(research): backtest correction turn passes typed history messages

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-10-02 00:46:48 +08:00
co-authored by Claude Opus 5.5
parent 955bab691a
commit 071a196d11
@@ -291,7 +291,9 @@ async function runJob(job: Job, resolved: ResolvedLanguageModel) {
const runId = ctx.requestId;
// route.ts consultationBaseMessages: stored history as plain messages, then this turn.
const baseMessages = [
...historyOf(job.followUp).map((message) => ({ role: message.role, content: message.text })),
...historyOf(job.followUp).map((message) => (message.role === "user"
? { role: "user" as const, content: message.text }
: { role: "assistant" as const, content: message.text })),
{ role: "user" as const, content: userTurn(job.question, job.followUp) },
];
const streamOptions = {