fix(claude-cli): --resume for continuing turns (reusing --session-id errored on turn 2)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,11 @@ spacesScopedRouter.post('/turn',
|
||||
const { agent, convo } = await resolveConversation(req.params.space_id);
|
||||
const { text, view } = req.body;
|
||||
|
||||
// Resume the claude session if this conversation already had turns (the CLI
|
||||
// keys session history by --session-id; first turn creates it, rest --resume).
|
||||
const priorTurns = (await messages.listByConversation(convo.id)).length;
|
||||
const resume = priorTurns > 0;
|
||||
|
||||
await messages.append(convo.id, { role: 'user', body: text });
|
||||
|
||||
res.writeHead(200, {
|
||||
@@ -105,6 +110,7 @@ spacesScopedRouter.post('/turn',
|
||||
try {
|
||||
result = await runClaudeTurn({
|
||||
sessionId: convo.id,
|
||||
resume,
|
||||
systemPrompt: SYSTEM,
|
||||
userText: text,
|
||||
mcpConfigPath,
|
||||
|
||||
Reference in New Issue
Block a user