feat(interactive): seed fresh task session with the task prompt

A fresh (non-resume) task-based ConPTY session now opens claude on the task's
prompt (title + description) as the positional argument, so the session starts on
the task instead of an empty prompt. Resume sessions and ad-hoc sessions are
unchanged.
This commit is contained in:
mika kuns
2026-07-23 16:47:16 +02:00
parent d9a4627a1f
commit d8194ad57e
2 changed files with 43 additions and 4 deletions
@@ -181,7 +181,7 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
Assert.True(Directory.Exists(wtRow.Path));
Assert.Equal(wtRow.Path, spec.Cwd);
Assert.Empty(spec.Args);
Assert.Equal(new[] { "T" }, spec.Args); // fresh session seeds the task title as the prompt
Assert.Equal(_claudeStubPath, spec.Exe);
}
@@ -258,7 +258,7 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
var svc = BuildService();
var spec = await svc.BuildForTaskAsync(taskId, CancellationToken.None);
Assert.Empty(spec.Args);
Assert.Equal(new[] { "T" }, spec.Args); // fresh: seeds the task title as the prompt
Assert.Equal(_worktreeDir, spec.Cwd);
}
@@ -274,7 +274,27 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
var svc = BuildService();
var spec = await svc.BuildForTaskAsync(taskId, CancellationToken.None);
Assert.Empty(spec.Args);
Assert.Equal(new[] { "T" }, spec.Args); // fresh: seeds the task title as the prompt
}
[Fact]
public async Task BuildForTaskAsync_FreshTask_WithDescription_SeedsTitleAndDescriptionPrompt()
{
var listId = await SeedListAsync();
var taskId = Guid.NewGuid().ToString();
await SeedTaskAsync(taskId, listId, TaskStatus.Idle);
await SeedWorktreeAsync(taskId, WorktreeState.Active);
using (var ctx = _db.CreateContext())
{
var t = await ctx.Tasks.FindAsync(taskId);
t!.Description = "Do the thing";
await ctx.SaveChangesAsync();
}
var svc = BuildService();
var spec = await svc.BuildForTaskAsync(taskId, CancellationToken.None);
Assert.Equal(new[] { "T\n\nDo the thing" }, spec.Args);
}
[Fact]