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

@@ -218,11 +218,11 @@ pub async fn follow_up(
// Clear the draft follow-up scratch on successful spawn
// This ensures the scratch is wiped even if the user navigates away quickly
if let Err(e) = Scratch::delete(pool, workspace.id, &ScratchType::DraftFollowUp).await {
if let Err(e) = Scratch::delete(pool, session.id, &ScratchType::DraftFollowUp).await {
// Log but don't fail the request - scratch deletion is best-effort
tracing::debug!(
"Failed to delete draft follow-up scratch for attempt {}: {}",
workspace.id,
"Failed to delete draft follow-up scratch for session {}: {}",
session.id,
e
);
}

View File

@@ -31,7 +31,7 @@ pub async fn queue_message(
let queued = deployment
.queued_message_service()
.queue_message(session.workspace_id, data);
.queue_message(session.id, data);
deployment
.track_if_analytics_allowed(
@@ -55,7 +55,7 @@ pub async fn cancel_queued_message(
) -> Result<ResponseJson<ApiResponse<QueueStatus>>, ApiError> {
deployment
.queued_message_service()
.cancel_queued(session.workspace_id);
.cancel_queued(session.id);
deployment
.track_if_analytics_allowed(
@@ -75,9 +75,7 @@ pub async fn get_queue_status(
Extension(session): Extension<Session>,
State(deployment): State<DeploymentImpl>,
) -> Result<ResponseJson<ApiResponse<QueueStatus>>, ApiError> {
let status = deployment
.queued_message_service()
.get_status(session.workspace_id);
let status = deployment.queued_message_service().get_status(session.id);
Ok(ResponseJson(ApiResponse::success(status)))
}