@@ -242,6 +242,20 @@ void shouldDelegateExecWithDisable() {
242242 // execAndParse
243243 // ----------------------------------------------------------------
244244
245+ @ Test
246+ void shouldForceJsonForExecAndParseWhenDefaultJsonOutputIsDisabled () {
247+ CodexClientConfig config = new CodexClientConfig ();
248+ config .setLocalExecutable ("/bin/sh " + JSON_FLAG_SCRIPT );
249+ config .setLocalTimeoutSeconds (2 );
250+ config .setJsonOutput (false );
251+
252+ List <CodexEvent > events = new CodexClient (config ).execAndParse ("hello" );
253+
254+ assertEquals (1 , events .size (),
255+ "execAndParse must force --json even when the normal exec default disables JSON" );
256+ assertEquals ("done" , events .get (0 ).getType ());
257+ }
258+
245259 @ Test
246260 void shouldReturnEmptyListForBlankOutput () {
247261 // echo with no JSON-Lines content
@@ -704,6 +718,28 @@ void shouldCloseWithoutError() {
704718 // default options from config
705719 // ----------------------------------------------------------------
706720
721+ @ Test
722+ void shouldHonorJsonOutputFalseForDefaultExec () {
723+ CodexClientConfig config = echoConfig ();
724+ config .setJsonOutput (false );
725+
726+ CodexCliResult result = new CodexClient (config ).exec ("hello" );
727+
728+ assertFalse (result .getStdout ().contains ("--json" ),
729+ "normal exec must honor CodexClientConfig.jsonOutput=false" );
730+ }
731+
732+ @ Test
733+ void shouldPropagateNoAltScreenToDefaultInteractiveSession () {
734+ CodexClientConfig config = echoConfig ();
735+ config .setNoAltScreen (true );
736+
737+ CodexCliResult result = new CodexClient (config ).startSession ("hello" );
738+
739+ assertTrue (result .getStdout ().contains ("--no-alt-screen" ),
740+ "default interactive session must honor noAltScreen" );
741+ }
742+
707743 @ Test
708744 void shouldPropagateConfigDefaultsToExecOptions () {
709745 CodexClientConfig config = echoConfig ();
0 commit comments