Use session IDs for scratches and queued messages (Vibe Kanban) (#1613)

* All changes have been completed. Here's a summary of what was done:

## Summary

Changed both scratches and queued messages to use session IDs instead of workspace IDs:

### Files Modified

1. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`**
   - Changed `useScratch(ScratchType.DRAFT_FOLLOW_UP, workspaceId ?? '')` → `useScratch(ScratchType.DRAFT_FOLLOW_UP, sessionId ?? '')`

2. **`crates/server/src/routes/sessions/queue.rs`**
   - Changed `session.workspace_id` → `session.id` in all three queue operations (queue, cancel, get status)

3. **`crates/services/src/services/queued_message.rs`**
   - Renamed `task_attempt_id` → `session_id` in `QueuedMessage` struct
   - Updated all method parameters and comments

4. **`crates/local-deployment/src/container.rs`**
   - Changed `ctx.workspace.id` → `ctx.session.id` for queue lookups and scratch deletion
   - Updated log messages to reference "session" instead of "workspace"

5. **`shared/types.ts`** (auto-generated)
   - `QueuedMessage.task_attempt_id` → `QueuedMessage.session_id`

* Cleanup script changes for task attempt 4df90bcd-f261-41ca-bac3-8f7c2fc576c5

* Build passes. The fix has been applied. Found and fixed one missed instance in `sessions/mod.rs` where `Scratch::delete` was using `workspace.id` instead of `session.id`.
This commit is contained in:
Alex Netsch
2025-12-21 21:19:06 +00:00
committed by GitHub
parent 033ae2f1c6
commit 3c35b92a97
6 changed files with 39 additions and 42 deletions

View File

@@ -473,20 +473,19 @@ impl LocalContainerService {
ExecutionProcessStatus::Failed | ExecutionProcessStatus::Killed
);
if let Some(queued_msg) = container
.queued_message_service
.take_queued(ctx.workspace.id)
if let Some(queued_msg) =
container.queued_message_service.take_queued(ctx.session.id)
{
if should_execute_queued {
tracing::info!(
"Found queued message for workspace {}, starting follow-up execution",
ctx.workspace.id
"Found queued message for session {}, starting follow-up execution",
ctx.session.id
);
// Delete the scratch since we're consuming the queued message
if let Err(e) = Scratch::delete(
&db.pool,
ctx.workspace.id,
ctx.session.id,
&ScratchType::DraftFollowUp,
)
.await
@@ -509,8 +508,8 @@ impl LocalContainerService {
} else {
// Execution failed or was killed - discard the queued message and finalize
tracing::info!(
"Discarding queued message for workspace {} due to execution status {:?}",
ctx.workspace.id,
"Discarding queued message for session {} due to execution status {:?}",
ctx.session.id,
ctx.execution_process.status
);
container.finalize_task(publisher.as_ref().ok(), &ctx).await;