Bake in thread directives

This commit is contained in:
Codex
2026-05-21 13:05:53 +00:00
parent 1a74c02173
commit d00cdd8e9f
17 changed files with 518 additions and 61 deletions

View File

@@ -18,6 +18,7 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
defer cancel()
socketPath := filepath.Join(t.TempDir(), "codex.sock")
projectCWD := filepath.Join(t.TempDir(), "project")
serverDone := make(chan error, 1)
ln, err := net.Listen("unix", socketPath)
if err != nil {
@@ -79,7 +80,7 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
if err := conn.WriteJSON(map[string]any{
"id": start["id"],
"result": map[string]any{
"cwd": "/tmp/project",
"cwd": projectCWD,
"thread": map[string]any{"id": "thr_1", "preview": "test"},
},
}); err != nil {
@@ -105,7 +106,7 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
if err := conn.WriteJSON(map[string]any{
"id": readThread["id"],
"result": map[string]any{
"thread": map[string]any{"id": "thr_1", "name": "Read title", "preview": "test", "cwd": "/tmp/project"},
"thread": map[string]any{"id": "thr_1", "name": "Read title", "preview": "test", "cwd": projectCWD},
},
}); err != nil {
serverDone <- err
@@ -164,18 +165,18 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
t.Fatal(ctx.Err())
}
thread, err := client.StartThread(ctx, "/tmp/project", "", "workspace-write")
thread, err := client.StartThread(ctx, projectCWD, "", "workspace-write")
if err != nil {
t.Fatal(err)
}
if thread.ID != "thr_1" || thread.CWD != "/tmp/project" {
if thread.ID != "thr_1" || thread.CWD != projectCWD {
t.Fatalf("unexpected thread: %+v", thread)
}
readThread, err := client.ReadThread(ctx, "thr_1")
if err != nil {
t.Fatal(err)
}
if readThread.ID != "thr_1" || readThread.Name != "Read title" || readThread.CWD != "/tmp/project" {
if readThread.ID != "thr_1" || readThread.Name != "Read title" || readThread.CWD != projectCWD {
t.Fatalf("unexpected read thread: %+v", readThread)
}
if err := client.SetThreadName(ctx, "thr_1", "Short title"); err != nil {