Skip to content

feat(app): drag-and-drop between groups + session management UI controls - #2039

Merged
benjaminshafii merged 1 commit into
devfrom
feat/session-drag-and-controls
Jun 2, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
feat/session-drag-and-controls

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Drag-and-drop between groups

Sessions can now be dragged onto group headers (or the "Ungrouped" zone) to reassign them. Uses native HTML5 DnD — no new dependencies.

  • Root sessions (depth 0) get draggable + onDragStart setting the session ID
  • Group separator headers (+ an "Ungrouped" drop zone) handle onDragOver/onDrop
  • Visual highlight (ring + bg accent) on drag-over
  • Works in both grouped and ungrouped views

Session management UI control actions

Seven new control actions, auto-discovered by the opencode plugin and openwork-ui-mcp:

Action ID Description
session.pin Toggle pin on a session
session.archive Archive/unarchive a session
session.group.create Create a new group in a workspace
session.group.move Move a session to a group (or ungrouped)
session.group.remove Remove a group (sessions become ungrouped)
session.group.list List groups + assignments for a workspace

This enables natural language workflows like:

  • "create a Done folder for this workspace"
  • "when you're done, move this task to the Done folder"
  • "archive all sessions from yesterday"

No changes needed in openwork-extensions-preview.ts, openwork-ui-mcp, or main.mjs — they are generic and automatically surface whatever actions are registered.

Tests run

pnpm --filter @openwork/app run typecheck   # exit 0
pnpm --filter @openwork/app run build        # exit 0

Diff

+191/-5 across 3 files (i18n, control actions, sidebar).

Drag-and-drop:
- Sessions can be dragged onto group headers to reassign them (HTML5 DnD)
- Each group separator and an 'Ungrouped' zone act as drop targets
- Visual highlight on drag-over (ring + bg accent)
- Root sessions (depth 0) are draggable in both grouped and ungrouped views

UI control actions (auto-discovered by the opencode plugin + openwork-ui-mcp):
- session.pin — toggle pin on a session
- session.archive — archive/unarchive a session
- session.group.create — create a new group in a workspace
- session.group.move — move a session to a group (or ungrouped)
- session.group.remove — remove a group (sessions become ungrouped)
- session.group.list — list groups + assignments for a workspace

This enables natural language workflows like:
  'create a Done folder for this workspace'
  'move this task to the Done folder when you're done'
  'remove the Backlog group'
@vercel

vercel Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jun 2, 2026 3:13am
openwork-den Ready Ready Preview, Comment Jun 2, 2026 3:13am
openwork-den-worker-proxy Ready Ready Preview, Comment Jun 2, 2026 3:13am
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 2, 2026 3:13am

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

5 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/app/src/react-app/domains/session/control/session-control-actions.ts">

<violation number="1" location="apps/app/src/react-app/domains/session/control/session-control-actions.ts:244">
P2: `session.archive` does not validate the required `archived` boolean and silently treats missing input as `false` (unarchive).</violation>

<violation number="2" location="apps/app/src/react-app/domains/session/control/session-control-actions.ts:265">
P3: Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot remove a group in another workspace when no workspace is selected.</violation>

<violation number="3" location="apps/app/src/react-app/domains/session/control/session-control-actions.ts:265">
P3: Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot create a group in another workspace when no workspace is selected.</violation>
</file>

<file name="apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx">

<violation number="1" location="apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx:1206">
P2: The ungrouped drop zone is hidden when empty, preventing drag-and-drop moves back to ungrouped.</violation>

<violation number="2" location="apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx:1268">
P2: Native HTML5 dragging should not be enabled for rows that are still used by `Reorder.Group`, or ungrouped-session reordering becomes fragile.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

disabled: !opencodeClient,
execute: async (args) => {
const sessionId = stringArg(args, "sessionId");
const archived = booleanArg(args, "archived");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: session.archive does not validate the required archived boolean and silently treats missing input as false (unarchive).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/domains/session/control/session-control-actions.ts, line 244:

<comment>`session.archive` does not validate the required `archived` boolean and silently treats missing input as `false` (unarchive).</comment>

<file context>
@@ -202,4 +204,143 @@ export function useSessionControlActions(input: UseSessionControlActionsInput) {
+    disabled: !opencodeClient,
+    execute: async (args) => {
+      const sessionId = stringArg(args, "sessionId");
+      const archived = booleanArg(args, "archived");
+      if (!sessionId) return { ok: false, error: "sessionId is required" };
+      if (!opencodeClient) return { ok: false, error: "OpenCode client is not connected" };
</file context>
Suggested change
const archived = booleanArg(args, "archived");
const archivedValue = objectArgs(args).archived;
if (archivedValue !== true && archivedValue !== false) return { ok: false, error: "archived must be true or false" };
const archived = archivedValue;

Comment on lines +1206 to +1211
{ungroupedRows.length > 0 ? (
<>
<SessionGroupSeparator label={t("session_management.ungrouped")} groupId={null} workspaceId={workspaceId} />
{ungroupedRows.map(renderRow)}
</>
) : null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The ungrouped drop zone is hidden when empty, preventing drag-and-drop moves back to ungrouped.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx, line 1206:

<comment>The ungrouped drop zone is hidden when empty, preventing drag-and-drop moves back to ungrouped.</comment>

<file context>
@@ -1172,7 +1203,12 @@ function GroupedSessionList({ sessionRows, groups, assignments, pinnedIds, tree,
         );
       })}
-      {ungroupedRows.length > 0 ? ungroupedRows.map(renderRow) : null}
+      {ungroupedRows.length > 0 ? (
+        <>
+          <SessionGroupSeparator label={t("session_management.ungrouped")} groupId={null} workspaceId={workspaceId} />
</file context>
Suggested change
{ungroupedRows.length > 0 ? (
<>
<SessionGroupSeparator label={t("session_management.ungrouped")} groupId={null} workspaceId={workspaceId} />
{ungroupedRows.map(renderRow)}
</>
) : null}
<>
<SessionGroupSeparator label={t("session_management.ungrouped")} groupId={null} workspaceId={workspaceId} />
{ungroupedRows.map(renderRow)}
</>

};

const dragProps = depth === 0 ? {
draggable: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Native HTML5 dragging should not be enabled for rows that are still used by Reorder.Group, or ungrouped-session reordering becomes fragile.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx, line 1268:

<comment>Native HTML5 dragging should not be enabled for rows that are still used by `Reorder.Group`, or ungrouped-session reordering becomes fragile.</comment>

<file context>
@@ -1228,13 +1264,21 @@ function SessionMenuItem({
   };
 
+  const dragProps = depth === 0 ? {
+    draggable: true,
+    onDragStart: (e: React.DragEvent) => {
+      e.dataTransfer.setData(SESSION_DRAG_TYPE, session.id);
</file context>

{ name: "label", type: "string", required: true, description: "Group name (e.g. 'Done', 'In progress', 'Backlog')." },
{ name: "workspaceId", type: "string", required: false, description: "Workspace ID. Defaults to the selected workspace." },
],
disabled: !selectedWorkspaceId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot remove a group in another workspace when no workspace is selected.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/domains/session/control/session-control-actions.ts, line 265:

<comment>Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot remove a group in another workspace when no workspace is selected.</comment>

<file context>
@@ -202,4 +204,143 @@ export function useSessionControlActions(input: UseSessionControlActionsInput) {
+      { name: "label", type: "string", required: true, description: "Group name (e.g. 'Done', 'In progress', 'Backlog')." },
+      { name: "workspaceId", type: "string", required: false, description: "Workspace ID. Defaults to the selected workspace." },
+    ],
+    disabled: !selectedWorkspaceId,
+    execute: (args) => {
+      const label = stringArg(args, "label");
</file context>
Suggested change
disabled: !selectedWorkspaceId,
disabled: false,

{ name: "label", type: "string", required: true, description: "Group name (e.g. 'Done', 'In progress', 'Backlog')." },
{ name: "workspaceId", type: "string", required: false, description: "Workspace ID. Defaults to the selected workspace." },
],
disabled: !selectedWorkspaceId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot create a group in another workspace when no workspace is selected.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/react-app/domains/session/control/session-control-actions.ts, line 265:

<comment>Don't disable this action solely on selectedWorkspaceId; it already accepts workspaceId and can validate at التنفيذ time. As written, callers cannot create a group in another workspace when no workspace is selected.</comment>

<file context>
@@ -202,4 +204,143 @@ export function useSessionControlActions(input: UseSessionControlActionsInput) {
+      { name: "label", type: "string", required: true, description: "Group name (e.g. 'Done', 'In progress', 'Backlog')." },
+      { name: "workspaceId", type: "string", required: false, description: "Workspace ID. Defaults to the selected workspace." },
+    ],
+    disabled: !selectedWorkspaceId,
+    execute: (args) => {
+      const label = stringArg(args, "label");
</file context>
Suggested change
disabled: !selectedWorkspaceId,
disabled: false,

@benjaminshafii
benjaminshafii merged commit e968d6d into dev Jun 2, 2026
7 checks passed

This branch was successfully deployed

4 active deployments
Preview – openwork-den-worker-proxy — 97fe7aae Deployed Jun 2, 2026 by vercel[bot]
Preview – openwork-landing — 97fe7aae Deployed Jun 2, 2026 by vercel[bot]
Preview – openwork-den — 97fe7aae Deployed Jun 2, 2026 by vercel[bot]
Preview – openwork-app — 97fe7aae Deployed Jun 2, 2026 by vercel[bot]
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