mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 03:39:33 +01:00
fix: address the release-prep review of #680
Claude history merges, never overwriting, into a project directory a deleted case of the new name left behind, instead of staying orphaned under the old key. The free-target pre-check also refuses a dangling symlink (lstat), so stopSessions no longer ends sessions before a 409 EXISTS. The rename dialog says stopped sessions are closed (their tabs go away) and, after a failed rename, how many were already closed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ac6d4aa2db
commit
d1e0e0aea6
10 files changed
+185
-39
No files matched your search
@@ -1135,7 +1135,7 @@ A local case whose folder is the top of a git repository can keep **worktrees**
|
||||
|
||||
A non-admin's `POST /api/quick-start` and `POST /api/ralph-loop/start` work as before but do not record their case as `lastUsedCase` (a server-wide key).
|
||||
|
||||
`POST /api/cases/:name/rename` renames a case. A case under the cases directory is its folder, so it always moves; a linked case renames its alias in `linked-cases.json` and moves its real folder (next to the old one, named `newName`) only with `renameFolder: true`. Remote and Docker cases are `400`. The new name must be free in every namespace the list merges (`409`). Live sessions whose working directory is at or inside the folder that would move make it `409` with `requiresStop: true` and `sessions: [{ id, name }]`; retry with `stopSessions: true` to end them first (nothing is restarted); another user's session is `403`. The folder is held by an in-process lock for the whole operation (an overlapping rename is `409 BUSY`, and `new Session` refuses a working directory inside it), the move is retried for a transient `EBUSY`/`EPERM`/`EACCES` and then answers `423` with `renameCode: "LOCKED"`, a cross-device move is `400`, and if the registries cannot be written afterwards `settings.json` and the folder are put back (when the folder cannot be moved back, the `500` says it is now at the new path). An error from the rename itself carries `stoppedSessions`: how many sessions it ended before it failed. On success the response is `{ oldName, newName, oldPath, newPath, folderMoved, stoppedSessions }`; `caseOrder`, `lastUsedCase`, `linked-cases.json` and Claude Code's `projects/<path>` history are updated, and `case:renamed` is broadcast. A linked case is admin only in multi-user mode.
|
||||
`POST /api/cases/:name/rename` renames a case. A case under the cases directory is its folder, so it always moves; a linked case renames its alias in `linked-cases.json` and moves its real folder (next to the old one, named `newName`) only with `renameFolder: true`. Remote and Docker cases are `400`. The new name must be free in every namespace the list merges (`409`). Live sessions whose working directory is at or inside the folder that would move make it `409` with `requiresStop: true` and `sessions: [{ id, name }]`; retry with `stopSessions: true` to end them first (they are closed as by `DELETE /api/sessions/:id`, nothing is restarted); another user's session is `403`. The folder is held by an in-process lock for the whole operation (an overlapping rename is `409 BUSY`, and `new Session` refuses a working directory inside it), the move is retried for a transient `EBUSY`/`EPERM`/`EACCES` and then answers `423` with `renameCode: "LOCKED"`, a cross-device move is `400`, and if the registries cannot be written afterwards `settings.json` and the folder are put back (when the folder cannot be moved back, the `500` says it is now at the new path). An error from the rename itself carries `stoppedSessions`: how many sessions it ended before it failed. On success the response is `{ oldName, newName, oldPath, newPath, folderMoved, stoppedSessions }`; `caseOrder`, `lastUsedCase`, `linked-cases.json` and Claude Code's `projects/<path>` history are updated (history already at the new path is merged into, never overwritten), and `case:renamed` is broadcast. A linked case is admin only in multi-user mode.
|
||||
|
||||
### System operations
|
||||
|
||||
|
||||
@@ -38,13 +38,17 @@ folder on disk** in the rename dialog: then its real folder is renamed too, next
|
||||
Remote and Docker cases cannot be renamed. Renaming does the following for you:
|
||||
|
||||
- **Sessions are never moved from under you.** If live sessions have the folder open, the rename is
|
||||
refused and lists them; you can then choose to stop them (nothing is restarted). While a rename runs,
|
||||
Codeman holds the folder so no session can start inside it half-moved.
|
||||
refused and lists them; you can then choose to stop them. That closes them the way closing their tabs
|
||||
does (nothing is restarted, and the last one to close removes the files attached to prompts in the
|
||||
case's `.codeman-uploads`). While a rename runs, Codeman holds the folder so no session can start
|
||||
inside it half-moved.
|
||||
- **A folder another program holds open is reported, not forced.** On Windows, SMB shares and some FUSE
|
||||
mounts a directory with an open handle cannot be renamed; Codeman retries briefly, then says the folder
|
||||
is in use and to close whatever has it (a terminal, an editor, a file browser, a sync client).
|
||||
- **Claude Code's history follows.** It keys conversations by the folder's path, so the rename moves
|
||||
`<claude config>/projects/<old path>` to the new path and `--resume` still finds them. Other CLIs'
|
||||
`<claude config>/projects/<old path>` to the new path and `--resume` still finds them. When the new
|
||||
path already has history (a case deleted earlier under that name leaves its history behind), the
|
||||
conversations are merged into it without overwriting anything. Other CLIs'
|
||||
history, Docker mounts and `git worktree` links that point at the old path are not updated. The
|
||||
Resume list uses the renamed folder too, and the case's default session group follows the new name.
|
||||
- **Not migrated.** Scheduled (cron) jobs keep the old `workingDir` and fail at their next run until you
|
||||
|
||||
Reference in new issue
Block a user