File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ def extract_command(text: Optional[str]) -> Optional[str]:
2222 command = trimmed .split ()[0 ]
2323 if '@' in command :
2424 command = command .split ('@' , 1 )[0 ]
25- if not command :
25+ command = command .strip ()
26+ if not command or command == '/' :
2627 return None
2728 return command
2829
Original file line number Diff line number Diff line change 1- import importlib . util
1+ import runpy
22from pathlib import Path
33
44import pytest
55
66CLIENT_CONFIG_PATH = Path (__file__ ).resolve ().parent .parent / "agent-sdk-client" / "config.py"
7-
8- spec = importlib .util .spec_from_file_location ("client_config" , CLIENT_CONFIG_PATH )
9- config_module = importlib .util .module_from_spec (spec )
10- assert spec and spec .loader
11- spec .loader .exec_module (config_module )
12-
13- Config = config_module .Config
14- load_command_whitelist = config_module .load_command_whitelist
7+ config_module = runpy .run_path (CLIENT_CONFIG_PATH )
8+ Config = config_module ["Config" ]
9+ load_command_whitelist = config_module ["load_command_whitelist" ]
1510
1611
1712def test_load_command_whitelist (tmp_path ):
@@ -32,6 +27,8 @@ def test_load_command_whitelist(tmp_path):
3227 ("/allowed" , True ),
3328 ("/allowed extra args" , True ),
3429 ("/allowed@bot" , True ),
30+ ("/@bot" , True ),
31+ ("/" , True ),
3532 ("/blocked" , False ),
3633 (" /blocked " , False ),
3734 ],
You can’t perform that action at this time.
0 commit comments