Sync thread names from Codex

This commit is contained in:
Codex
2026-05-21 09:47:05 +00:00
parent 660458af32
commit 1d433038ab
5 changed files with 162 additions and 21 deletions

View File

@@ -86,6 +86,31 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
return
}
var readThread map[string]any
if err := conn.ReadJSON(&readThread); err != nil {
serverDone <- err
return
}
if readThread["method"] != "thread/read" {
serverDone <- unexpectedMessage("thread/read", readThread["method"])
return
}
readParams := readThread["params"].(map[string]any)
if readParams["threadId"] != "thr_1" || readParams["includeTurns"] != false {
payload, _ := json.Marshal(readParams)
serverDone <- unexpectedMessage("thread/read params", string(payload))
return
}
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"},
},
}); err != nil {
serverDone <- err
return
}
var setName map[string]any
if err := conn.ReadJSON(&setName); err != nil {
serverDone <- err
@@ -145,6 +170,13 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
if thread.ID != "thr_1" {
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" {
t.Fatalf("unexpected read thread: %+v", readThread)
}
if err := client.SetThreadName(ctx, "thr_1", "Short title"); err != nil {
t.Fatal(err)
}