fix(worker): seed planning brief via file to avoid newline truncation

This commit is contained in:
Mika Kuns
2026-07-23 16:47:13 +02:00
committed by mika kuns
parent 914fa5aa9f
commit 865e12c0de
2 changed files with 63 additions and 31 deletions
@@ -45,4 +45,28 @@ public sealed class WindowsTerminalLauncherTests
sut.LaunchPlanningStartAsync(ctx, CancellationToken.None));
Assert.Contains("Windows Terminal", ex.Message);
}
[Fact]
public void BuildPlanningStartCommand_SeedsViaBriefFile_NotInlineText()
{
var ctx = MakeStartCtx();
var command = WindowsTerminalLauncher.BuildPlanningStartCommand("claude.exe", ctx);
// The brief is read from a file: the kickoff references the brief path, and its
// directory is exposed via --add-dir so the Read tool can open it.
Assert.Contains(ctx.Files.InitialPromptPath, command);
Assert.Contains($"--add-dir' '{ctx.Files.SessionDirectory}", command);
// The positional kickoff must follow the single-value --append-system-prompt-file
// flag, or a preceding variadic flag would swallow it.
var appendIdx = command.IndexOf("--append-system-prompt-file", StringComparison.Ordinal);
var addDirIdx = command.IndexOf("--add-dir", StringComparison.Ordinal);
Assert.True(appendIdx > addDirIdx, "--append-system-prompt-file must come after --add-dir");
Assert.True(command.IndexOf(ctx.Files.InitialPromptPath, StringComparison.Ordinal) > appendIdx,
"the kickoff prompt must be the last (positional) token");
// The legacy env-var indirection is gone.
Assert.DoesNotContain("CLAUDEDO_LAUNCH_PROMPT", command);
}
}