Skip to content

Commit f6a265b

Browse files
refactor: clean up imports and improve default message limit
- Remove unused import of get_cancel_agent_key from config_commands.py since only the display name function is needed - Increase default message limit from 100 to 1000 to provide more generous interaction capacity - Fix trailing whitespace and formatting issues in test files for better code consistency - These changes improve code cleanliness and provide a better default user experience with higher message limits
1 parent 2b09e08 commit f6a265b

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

code_puppy/command_line/config_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def handle_show_command(command: str) -> bool:
4646
get_use_dbos,
4747
get_yolo_mode,
4848
)
49-
from code_puppy.keymap import get_cancel_agent_key, get_cancel_agent_display_name
49+
from code_puppy.keymap import get_cancel_agent_display_name
5050
from code_puppy.messaging import emit_info
5151

5252
puppy_name = get_puppy_name()

code_puppy/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ def set_enable_dbos(enabled: bool) -> None:
10511051
set_config_value("enable_dbos", "true" if enabled else "false")
10521052

10531053

1054-
def get_message_limit(default: int = 100) -> int:
1054+
def get_message_limit(default: int = 1000) -> int:
10551055
"""
10561056
Returns the user-configured message/request limit for the agent.
10571057
This controls how many steps/requests the agent can take.

tests/test_uvx_detection.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_is_uvx_in_chain_with_uvx_exe(self):
4646
def test_is_uvx_in_chain_with_uv_exe_only(self):
4747
"""Test _is_uvx_in_chain does NOT detect uv.exe alone (only uvx.exe)."""
4848
from code_puppy.uvx_detection import _is_uvx_in_chain
49-
49+
5050
# uv.exe alone should NOT trigger detection - only uvx.exe has SIGINT issues
5151
chain = ["python.exe", "uv.exe", "powershell.exe"]
5252
assert _is_uvx_in_chain(chain) is False
@@ -84,6 +84,7 @@ def test_should_use_alternate_cancel_key_windows_uvx(self):
8484

8585
# Re-import with mocks active
8686
import importlib
87+
8788
import code_puppy.uvx_detection
8889

8990
importlib.reload(code_puppy.uvx_detection)
@@ -101,6 +102,7 @@ def test_should_use_alternate_cancel_key_windows_uvx(self):
101102
def test_should_use_alternate_cancel_key_windows_no_uvx(self):
102103
"""Test should_use_alternate_cancel_key returns False on Windows without uvx."""
103104
import importlib
105+
104106
import code_puppy.uvx_detection
105107

106108
importlib.reload(code_puppy.uvx_detection)
@@ -116,6 +118,7 @@ def test_should_use_alternate_cancel_key_windows_no_uvx(self):
116118
def test_should_use_alternate_cancel_key_linux_uvx(self):
117119
"""Test should_use_alternate_cancel_key returns False on Linux even with uvx."""
118120
import importlib
121+
119122
import code_puppy.uvx_detection
120123

121124
importlib.reload(code_puppy.uvx_detection)
@@ -131,6 +134,7 @@ def test_should_use_alternate_cancel_key_linux_uvx(self):
131134
def test_should_use_alternate_cancel_key_macos_uvx(self):
132135
"""Test should_use_alternate_cancel_key returns False on macOS even with uvx."""
133136
import importlib
137+
134138
import code_puppy.uvx_detection
135139

136140
importlib.reload(code_puppy.uvx_detection)
@@ -180,6 +184,7 @@ def test_get_parent_process_chain_psutil_available(self):
180184
# This test runs with actual psutil if installed
181185
try:
182186
import psutil # noqa: F401
187+
183188
from code_puppy.uvx_detection import _get_parent_process_chain_psutil
184189

185190
chain = _get_parent_process_chain_psutil()
@@ -241,6 +246,7 @@ def test_keymap_returns_ctrl_k_on_windows_uvx(self):
241246
):
242247
# Import fresh to pick up the mock
243248
import importlib
249+
244250
import code_puppy.keymap
245251

246252
importlib.reload(code_puppy.keymap)
@@ -258,6 +264,7 @@ def test_keymap_respects_config_when_not_uvx(self):
258264
patch("code_puppy.config.get_value", return_value="ctrl+q"),
259265
):
260266
import importlib
267+
261268
import code_puppy.keymap
262269

263270
importlib.reload(code_puppy.keymap)
@@ -275,6 +282,7 @@ def test_keymap_returns_default_when_not_uvx_and_no_config(self):
275282
patch("code_puppy.config.get_value", return_value=None),
276283
):
277284
import importlib
285+
278286
import code_puppy.keymap
279287

280288
importlib.reload(code_puppy.keymap)
@@ -289,6 +297,7 @@ class TestMockedProcessChain:
289297
def test_uvx_detection_with_mocked_chain(self):
290298
"""Test uvx detection with a simulated uvx process chain."""
291299
import importlib
300+
292301
import code_puppy.uvx_detection
293302

294303
importlib.reload(code_puppy.uvx_detection)
@@ -309,6 +318,7 @@ def test_uvx_detection_with_mocked_chain(self):
309318
def test_no_uvx_detection_with_mocked_chain(self):
310319
"""Test no uvx detection with a non-uvx process chain."""
311320
import importlib
321+
312322
import code_puppy.uvx_detection
313323

314324
importlib.reload(code_puppy.uvx_detection)
@@ -329,6 +339,7 @@ def test_no_uvx_detection_with_mocked_chain(self):
329339
def test_uvx_detection_caching(self):
330340
"""Test that uvx detection result is cached."""
331341
import importlib
342+
332343
import code_puppy.uvx_detection
333344

334345
importlib.reload(code_puppy.uvx_detection)
@@ -354,4 +365,4 @@ def counting_get_chain():
354365
assert result1 is True
355366
assert result2 is True
356367
# Should only call the chain function once due to caching
357-
assert call_count == 1
368+
assert call_count == 1

0 commit comments

Comments
 (0)