Skip to content

Adjust new task button to create new task#4063

Draft
TheodoreSpeaks wants to merge 6 commits intostagingfrom
feat/new-task-behavior
Draft

Adjust new task button to create new task#4063
TheodoreSpeaks wants to merge 6 commits intostagingfrom
feat/new-task-behavior

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

@TheodoreSpeaks TheodoreSpeaks commented Apr 8, 2026

Summary

Adjust create task behavior to create a new task instead of redirecting to home to be in line with create workflow

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Tested locally

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 10, 2026 0:42am

Request Review

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

@BugBot review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 8, 2026

PR Summary

Medium Risk
Adds task-creation write path (POST /api/mothership/chats) and changes navigation/stream handling around new chats, which could affect task list consistency and chat routing if edge cases occur.

Overview
New-task flow now creates an actual empty task record instead of routing to Home. The sidebar “New task” action calls a new POST /api/mothership/chats, pre-warms React Query detail cache via useCreateTask, and then navigates to /workspace/:id/task/:taskId (reusing an existing empty task when present).

The tasks list API now returns messageCount (computed from stored messages) so the client can flag isEmpty. The Home/task chat UI also waits for history to load (isHistoryReady) before showing the empty-state greeting, and useChat switches to router.replace plus abort/reset when a new chat ID is assigned to avoid stale streaming/UI state.

Reviewed by Cursor Bugbot for commit 2ba89a7. Bugbot is set up for automated code reviews on this repo. Configure here.

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

@BugBot review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2ba89a7. Configure here.

}, [hasMessages])

if (!hasMessages && !chatId) {
if (!hasMessages && isHistoryReady) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greeting screen flashes on task page navigation

Medium Severity

The condition changed from !hasMessages && !chatId to !hasMessages && isHistoryReady. The messages state is initialized as [] via useState and only populated from chatHistory via a useEffect that runs after the render. When navigating to a task page with existing messages, isHistoryReady becomes true (cache hit) before the effect populates messages, so for at least one render frame !hasMessages && isHistoryReady evaluates to true, causing the "What should we get done?" greeting to flash. The old !chatId guard prevented this because chatId is always set on the task page.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ba89a7. Configure here.

)
router.replace(`/workspace/${workspaceId}/task/${parsed.chatId}`)
abortControllerRef.current?.abort()
streamGenRef.current++
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Router navigation aborts active SSE message stream

Medium Severity

Replacing window.history.replaceState with router.replace causes a full Next.js route transition that unmounts the component during active streaming. The stream is explicitly aborted and the generation counter incremented, interrupting the assistant's response mid-generation. The task page must then reconnect from event 0, replaying the entire response from scratch, causing a visible disruption where the partial response disappears and then rapidly replays.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ba89a7. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant