@@ -1054,6 +1054,78 @@ func TestParseCodexSession(t *testing.T) {
10541054 }
10551055 },
10561056 },
1057+ {
1058+ name : "empty arguments falls through to input" ,
1059+ content : testjsonl .JoinJSONL (
1060+ testjsonl .CodexSessionMetaJSON (
1061+ "fc-empty-args" , "/tmp" , "user" , tsEarly ,
1062+ ),
1063+ testjsonl .CodexMsgJSON (
1064+ "user" , "run command" , tsEarlyS1 ,
1065+ ),
1066+ testjsonl .CodexFunctionCallFieldsJSON (
1067+ "exec_command" ,
1068+ map [string ]any {},
1069+ `{"cmd":"ls -la"}` ,
1070+ tsEarlyS5 ,
1071+ ),
1072+ ),
1073+ wantID : "codex:fc-empty-args" ,
1074+ wantMsgs : 2 ,
1075+ check : func (
1076+ t * testing.T , _ * ParsedSession ,
1077+ msgs []ParsedMessage ,
1078+ ) {
1079+ t .Helper ()
1080+ want := "[Bash]\n $ ls -la"
1081+ if msgs [1 ].Content != want {
1082+ t .Errorf (
1083+ "content = %q, want %q" ,
1084+ msgs [1 ].Content , want ,
1085+ )
1086+ }
1087+ },
1088+ },
1089+ {
1090+ name : "write_stdin formats with session and chars" ,
1091+ content : testjsonl .JoinJSONL (
1092+ testjsonl .CodexSessionMetaJSON (
1093+ "fc-stdin" , "/tmp" , "user" , tsEarly ,
1094+ ),
1095+ testjsonl .CodexMsgJSON (
1096+ "user" , "send input" , tsEarlyS1 ,
1097+ ),
1098+ testjsonl .CodexFunctionCallArgsJSON (
1099+ "write_stdin" ,
1100+ map [string ]any {
1101+ "session_id" : "sess-42" ,
1102+ "chars" : "yes\n " ,
1103+ },
1104+ tsEarlyS5 ,
1105+ ),
1106+ ),
1107+ wantID : "codex:fc-stdin" ,
1108+ wantMsgs : 2 ,
1109+ check : func (
1110+ t * testing.T , _ * ParsedSession ,
1111+ msgs []ParsedMessage ,
1112+ ) {
1113+ t .Helper ()
1114+ want := "[Bash: stdin -> sess-42]\n yes\\ n"
1115+ if msgs [1 ].Content != want {
1116+ t .Errorf (
1117+ "content = %q, want %q" ,
1118+ msgs [1 ].Content , want ,
1119+ )
1120+ }
1121+ if msgs [1 ].ToolCalls [0 ].Category != "Bash" {
1122+ t .Errorf (
1123+ "category = %q, want Bash" ,
1124+ msgs [1 ].ToolCalls [0 ].Category ,
1125+ )
1126+ }
1127+ },
1128+ },
10571129 {
10581130 name : "large message within scanner limit" ,
10591131 content : testjsonl .JoinJSONL (
0 commit comments