fix: remove provisional workspace when launch is canceled with no changes
When `ctask new` launched the agent or shell and the child exited without touching any files (e.g. the user canceled at Claude Code's trust prompt), the workspace was left behind as empty clutter. Now, if the invocation just created the workspace and the manifest diff is empty (zero added, modified, deleted), the workspace directory is removed and finalize is skipped. resume/open/last are unaffected (NewlyCreated defaults to false), and --no-launch is unaffected (session.Run is never called). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+7
-6
@@ -122,11 +122,12 @@ func runNew(cmd *cobra.Command, args []string) error {
|
||||
envVars := config.EnvVars(ws.Meta.Slug, ws.Meta.Mode, root, ws.Path, ws.Meta.Category, workspace.EffectiveType(ws.Meta))
|
||||
|
||||
return session.Run(session.LaunchOpts{
|
||||
WsDir: ws.Path,
|
||||
EnvVars: envVars,
|
||||
Agent: agent,
|
||||
Mode: ws.Meta.Mode,
|
||||
Slug: ws.Meta.Slug,
|
||||
Shell: newShell,
|
||||
WsDir: ws.Path,
|
||||
EnvVars: envVars,
|
||||
Agent: agent,
|
||||
Mode: ws.Meta.Mode,
|
||||
Slug: ws.Meta.Slug,
|
||||
Shell: newShell,
|
||||
NewlyCreated: true,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user