[Feature]: Move an existing desktop session into an existing project (workspace rebind + artifact relocation)

未关闭
#614 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
desktop

调研方向

Start by tracing the existing “Move to project” action and canUseCloudProjects gate in the desktop sidebar, then inspect the local runtime session and project assignment logic described in the issue. Follow how workspace paths are stored for turn diffs, diff journals, and session assets. Done means a local session can be rebound to a directory-backed project while preserving its conversation and keeping its workspace files, delivered-file cards, and change/undo records usable.

由索引模型根据 Issue 内容生成。

描述

desktop
Product or interface

Desktop app

Use case and problem

I want to keep a session that started in the default workspace (no project) and later promote it into a real project directory: the session keeps its conversation and the files it produced, and from then on it runs inside that project.

Today the desktop app has no way to do this.

What exists today, and why none of it covers this case:

  • Create a new task inside the project (onNewTaskInProject in the sidebar) — binds a new conversation to the project directory. It does not carry over the existing conversation, and the old session stays where it was.
  • "Move to project" in the session menu — the entry exists in the UI bundle (sidebar.action_move_to_project) but it is cloud-only. The action is gated by canUseCloudProjects, which is computed as source === "cloud", and returns early for local sessions; the submenu entries are rendered with a cloud project icon (target: { source: "cloud", id }); the underlying call is PATCH /session/{id} { project_id } against the cloud API, and the local runtime explicitly rejects project_id with project_id is not supported by desktop local-runtime.
  • "Move to section" (sidebar.action_section) only changes a front-end grouping inside the sidebar store (assignments / sections / sessionOrder). It does not touch the session's workspace or its project, and the runtime does not know about it.
  • Dragging a session in the sidebar drops it into a section as well, not into a project.

So for a local desktop session there is currently no action that changes which project (that is, which directory) the session belongs to.

Why this is not only a UI toggle

In the local runtime model a workspace project is its directory, so moving a session into a project is a change of the session's run location rather than a metadata edit:

  • local_runtime_projects constrains project_kind='workspace' rows to exactly one non-empty workspace_dir, with a unique index on it; the default kind holds no directory at all.
  • local_runtime_sessions.project_workspace_dir + is_default_workspace determine project_id through the trg_local_runtime_project_session_assignment_v5 trigger, and the runtime raises Session Project associations are incomplete when a session's project_id does not match a project row with the same directory.
  • resolveWorkspace() prefers the session's explicit workspace directory over the agent/session default, so the bound directory is also the agent's working directory.

Consequences of a local move, which a metadata-only implementation would miss:

  1. Rebind the session — workspace_dir / project_workspace_dir / is_default_workspace; project_id is then re-derived by the existing trigger, so it stays consistent.
  2. Relocate the artifacts the session produced; they live in the old session workspace folder (~/.minimax/sessions/<session-id>/workspace/).
  3. Repoint historical path references. local_runtime_turn_diffs and local_runtime_turn_diff_journal store the workspace directory used for each captured change (they back the "review changes / undo" panel), and local_runtime_session_assets stores the absolute path of every delivered file (the file cards in the chat). The runtime never updates workspace_dir on those rows, and there is no UPDATE statement for local_runtime_session_assets.path at all — so after a rebind the delivered-file cards and the undo records still point at the old directory and become dead links.
Desired behavior
  • A local session's context menu offers a working Move to project, listing local (directory-backed) projects.
  • Selecting a project rebinds the session: it stays the same conversation (same session id, same history and attachments) and its working directory becomes the project directory for subsequent turns.
  • The user is asked whether to relocate the workspace files that session produced into the project directory, or is clearly told that they remain in the old folder.
  • After the move, the delivered-file cards and the change/undo panel of that session resolve to the new location.
  • Moving one session does not affect other sessions of the same project, and deleting a project still behaves as it does today.
Platform

Windows

Alternatives and additional context
  • Workaround used locally: update runtime-state.sqlite directly (with a backup) to rebind the session, copy the produced files into the project directory, and repair the path fields in local_runtime_turn_diffs / local_runtime_turn_diff_journal / local_runtime_session_assets by hand. This shows the operation is feasible, but it is unsupported, it touches a runtime-owned database, and step 3 is easy to miss — which is the reason a supported action would help.
  • Related: #136 (closed as not_planned in a backlog cleanup; it asked for the same move, including moving the workspace data) and #554 (projects with several directories).

Environment: MiniMax Code 3.1.16.226, Windows 10 x64.


中文摘要

桌面端目前无法把一个已存在的本地会话迁入已有项目。会话菜单里的「移动到项目」是云端专用:canUseCloudProjects 仅在 source === "cloud" 时为真,本地会话点了直接 return;子菜单图标写死 source: "cloud";底层是云端 PATCH /session/{id} { project_id },而本地运行时会明确拒绝 project_id。「移动到分区」只是侧边栏的纯前端分组,拖拽落到的也是分区。

由于本地项目在数据模型里就等于它的目录,迁移实际包含三件事:① 改绑会话(workspace_dir / project_workspace_dir / is_default_workspace,project_id 由既有触发器自动重算);② 搬迁会话产出的文件;③ 修正历史路径引用——local_runtime_turn_diffs / turn_diff_journal(撤销/回滚面板)与 local_runtime_session_assets(交付文件卡片)仍指向旧目录,改绑后即成死链,而运行时从不更新这些行。

希望官方提供受支持的「将会话移动到项目」入口,并一并处理产物搬迁与历史引用修正。

主要语言
TypeScript
星标
2.3k
派生
315
平均合并
3 小时 54 分钟
30 天内合并 PR
9

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MiniMax-AI/minimax-code 的其他 Issue

查看 MiniMax-AI/minimax-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。