@@ -136,6 +136,42 @@ def test_logs_text(log_path, usage):
136136 assert output == expected
137137
138138
139+ def test_logs_text_with_options (user_path ):
140+ """Test that ## Options section appears when options_json is set"""
141+ log_path = str (user_path / "logs_with_options.db" )
142+ db = sqlite_utils .Database (log_path )
143+ migrate (db )
144+ start = datetime .datetime .now (datetime .timezone .utc )
145+
146+ # Create response with options
147+ db ["responses" ].insert (
148+ {
149+ "id" : str (monotonic_ulid ()).lower (),
150+ "system" : "system" ,
151+ "prompt" : "prompt" ,
152+ "response" : "response" ,
153+ "model" : "davinci" ,
154+ "datetime_utc" : start .isoformat (),
155+ "conversation_id" : "abc123" ,
156+ "input_tokens" : 2 ,
157+ "output_tokens" : 5 ,
158+ "options_json" : json .dumps (
159+ {"thinking_level" : "high" , "media_resolution" : "low" }
160+ ),
161+ }
162+ )
163+
164+ runner = CliRunner ()
165+ result = runner .invoke (cli , ["logs" , "-p" , str (log_path )], catch_exceptions = False )
166+ assert result .exit_code == 0
167+ output = result .output
168+
169+ # Verify ## Options section is present
170+ assert "## Options\n \n " in output
171+ assert "- thinking_level: high" in output
172+ assert "- media_resolution: low" in output
173+
174+
139175@pytest .mark .parametrize ("n" , (None , 0 , 2 ))
140176def test_logs_json (n , log_path ):
141177 "Test that logs command correctly returns requested -n records"
0 commit comments