@@ -14,44 +14,57 @@ import {
1414} from "./projectThreadStartTurn" ;
1515
1616describe ( "project thread title" , ( ) => {
17+ it . each ( [
18+ [ "" , "Image: pasted-image.png" ] ,
19+ [ " Fix the spacing" , "Fix the spacing" ] ,
20+ [ "Fix [src/app.ts](t3-context://v1/mention/source)" , "Fix src/app.ts" ] ,
21+ [ "x" . repeat ( 80 ) , `${ "x" . repeat ( 69 ) } ...` ] ,
22+ ] ) ( "uses readable draft and queued titles for %s" , ( text , title ) => {
23+ expect ( deriveThreadTitleFromPrompt ( text ) ) . toBe ( title ) ;
24+ } ) ;
25+
1726 it ( "keeps ordinary titles and the empty-prompt fallback" , ( ) => {
1827 expect ( deriveThreadTitleFromPrompt ( " Fix\n the parser " ) ) . toBe ( "Fix the parser" ) ;
1928 expect ( deriveThreadTitleFromPrompt ( " \n " ) ) . toBe ( "New thread" ) ;
2029 } ) ;
2130
22- it ( "derives attachment-only titles from prepared image metadata" , ( ) => {
23- const uploadedAttachments = [
24- {
25- type : "image" as const ,
26- id : "prepared-photo" ,
27- name : "photo.png" ,
28- mimeType : "image/png" ,
29- sizeBytes : 3 ,
30- } ,
31- ] ;
32- const input = buildProjectThreadStartTurnInput ( {
33- projectId : ProjectId . make ( "project" ) ,
34- projectCwd : "/workspace" ,
35- threadId : "image-thread" ,
36- commandId : "image-command" ,
37- messageId : "image-message" ,
38- createdAt : "2026-09-04T00:00:00Z" ,
39- text : "" ,
40- uploadedAttachments,
41- modelSelection : { instanceId : ProviderInstanceId . make ( "codex" ) , model : "gpt-5.6-sol" } ,
42- runtimeMode : "full-access" ,
43- interactionMode : "default" ,
44- workspaceMode : "local" ,
45- branch : null ,
46- worktreePath : null ,
47- startFromOrigin : false ,
48- worktreeBranchName : "unused" ,
49- } ) ;
31+ it . each ( [ "" , "" ] ) (
32+ "derives attachment-only titles from prepared image metadata for %s" ,
33+ ( text ) => {
34+ const uploadedAttachments = [
35+ {
36+ type : "image" as const ,
37+ id : "prepared-photo" ,
38+ name : "photo.png" ,
39+ mimeType : "image/png" ,
40+ sizeBytes : 3 ,
41+ } ,
42+ ] ;
43+ const input = buildProjectThreadStartTurnInput ( {
44+ projectId : ProjectId . make ( "project" ) ,
45+ projectCwd : "/workspace" ,
46+ threadId : "image-thread" ,
47+ commandId : "image-command" ,
48+ messageId : "image-message" ,
49+ createdAt : "2026-09-04T00:00:00Z" ,
50+ text,
51+ uploadedAttachments,
52+ modelSelection : { instanceId : ProviderInstanceId . make ( "codex" ) , model : "gpt-5.6-sol" } ,
53+ runtimeMode : "full-access" ,
54+ interactionMode : "default" ,
55+ workspaceMode : "local" ,
56+ branch : null ,
57+ worktreePath : null ,
58+ startFromOrigin : false ,
59+ worktreeBranchName : "unused" ,
60+ } ) ;
5061
51- expect ( input . titleSeed ) . toBe ( "Image: photo.png" ) ;
52- expect ( input . bootstrap . createThread . title ) . toBe ( input . titleSeed ) ;
53- expect ( input . message . attachments ) . toEqual ( uploadedAttachments ) ;
54- } ) ;
62+ expect ( input . titleSeed ) . toBe ( "Image: photo.png" ) ;
63+ expect ( input . bootstrap . createThread . title ) . toBe ( input . titleSeed ) ;
64+ expect ( input . message . attachments ) . toEqual ( uploadedAttachments ) ;
65+ expect ( input . message . text ) . toBe ( text ) ;
66+ } ,
67+ ) ;
5568
5669 it . each ( [
5770 {
0 commit comments