gitarsenal-cli 1.7.9 ā 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -38,7 +38,7 @@ if args.proxy_api_key:
|
|
38
38
|
class PersistentShell:
|
39
39
|
"""A persistent bash shell using subprocess.Popen for executing commands with state persistence."""
|
40
40
|
|
41
|
-
def __init__(self, working_dir="/root", timeout=
|
41
|
+
def __init__(self, working_dir="/root", timeout=240):
|
42
42
|
self.working_dir = working_dir
|
43
43
|
self.timeout = timeout
|
44
44
|
self.process = None
|
@@ -1788,7 +1788,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1788
1788
|
cmd_manager = CommandListManager(setup_commands)
|
1789
1789
|
|
1790
1790
|
# Create persistent shell instance starting in /root
|
1791
|
-
shell = PersistentShell(working_dir="/root", timeout=
|
1791
|
+
shell = PersistentShell(working_dir="/root", timeout=240)
|
1792
1792
|
|
1793
1793
|
try:
|
1794
1794
|
# Start the persistent shell
|
@@ -1812,7 +1812,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1812
1812
|
print(f"š Executing main command {cmd_index + 1}/{cmd_manager.total_commands}: {cmd_text}")
|
1813
1813
|
|
1814
1814
|
start_time = time.time()
|
1815
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1815
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1816
1816
|
execution_time = time.time() - start_time
|
1817
1817
|
|
1818
1818
|
# Mark command as executed
|
@@ -1840,7 +1840,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1840
1840
|
# Execute the fix command
|
1841
1841
|
print(f"š Running suggested fix command: {fix_command}")
|
1842
1842
|
fix_start_time = time.time()
|
1843
|
-
fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=
|
1843
|
+
fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=240)
|
1844
1844
|
fix_execution_time = time.time() - fix_start_time
|
1845
1845
|
|
1846
1846
|
# Mark fix command as executed
|
@@ -1854,7 +1854,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1854
1854
|
# Retry the original command
|
1855
1855
|
print(f"š Retrying original command: {cmd_text}")
|
1856
1856
|
retry_start_time = time.time()
|
1857
|
-
retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=
|
1857
|
+
retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=240)
|
1858
1858
|
retry_execution_time = time.time() - retry_start_time
|
1859
1859
|
|
1860
1860
|
# Update the original command status
|
@@ -1883,7 +1883,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1883
1883
|
print(f"š§ Executing fix command {cmd_index + 1}: {cmd_text}")
|
1884
1884
|
|
1885
1885
|
start_time = time.time()
|
1886
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1886
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1887
1887
|
execution_time = time.time() - start_time
|
1888
1888
|
|
1889
1889
|
# Mark fix command as executed
|
@@ -1911,7 +1911,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1911
1911
|
print(f"š§ Executing additional fix: {cmd_text}")
|
1912
1912
|
|
1913
1913
|
start_time = time.time()
|
1914
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1914
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1915
1915
|
execution_time = time.time() - start_time
|
1916
1916
|
|
1917
1917
|
# Mark fix command as executed
|
@@ -0,0 +1,108 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Test script to verify that stored credentials are being passed correctly to SSH containers.
|
4
|
+
"""
|
5
|
+
|
6
|
+
import os
|
7
|
+
import json
|
8
|
+
from pathlib import Path
|
9
|
+
|
10
|
+
def test_credentials_loading():
|
11
|
+
"""Test that credentials can be loaded from the local file"""
|
12
|
+
print("š Testing credentials loading...")
|
13
|
+
|
14
|
+
# Test get_stored_credentials function
|
15
|
+
try:
|
16
|
+
from test_modalSandboxScript import get_stored_credentials
|
17
|
+
credentials = get_stored_credentials()
|
18
|
+
|
19
|
+
if credentials:
|
20
|
+
print(f"ā
Found {len(credentials)} stored credentials:")
|
21
|
+
for key, value in credentials.items():
|
22
|
+
masked_value = value[:8] + "..." if len(value) > 8 else "***"
|
23
|
+
print(f" - {key}: {masked_value}")
|
24
|
+
else:
|
25
|
+
print("ā ļø No stored credentials found")
|
26
|
+
|
27
|
+
return credentials
|
28
|
+
except Exception as e:
|
29
|
+
print(f"ā Error loading credentials: {e}")
|
30
|
+
return {}
|
31
|
+
|
32
|
+
def test_credentials_file():
|
33
|
+
"""Test that the credentials file exists and is readable"""
|
34
|
+
print("\nš Testing credentials file...")
|
35
|
+
|
36
|
+
credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
|
37
|
+
|
38
|
+
if credentials_file.exists():
|
39
|
+
print(f"ā
Credentials file exists at: {credentials_file}")
|
40
|
+
try:
|
41
|
+
with open(credentials_file, 'r') as f:
|
42
|
+
credentials = json.load(f)
|
43
|
+
print(f"ā
Successfully loaded {len(credentials)} credentials from file")
|
44
|
+
return credentials
|
45
|
+
except Exception as e:
|
46
|
+
print(f"ā Error reading credentials file: {e}")
|
47
|
+
return {}
|
48
|
+
else:
|
49
|
+
print(f"ā ļø Credentials file not found at: {credentials_file}")
|
50
|
+
print("š” You can create it by running the credentials manager")
|
51
|
+
return {}
|
52
|
+
|
53
|
+
def test_environment_variables():
|
54
|
+
"""Test that credentials are available as environment variables"""
|
55
|
+
print("\nš Testing environment variables...")
|
56
|
+
|
57
|
+
credential_env_vars = [
|
58
|
+
'OPENAI_API_KEY', 'WANDB_API_KEY', 'HF_TOKEN', 'HUGGINGFACE_TOKEN',
|
59
|
+
'GITHUB_TOKEN', 'KAGGLE_USERNAME', 'KAGGLE_KEY'
|
60
|
+
]
|
61
|
+
|
62
|
+
found_creds = {}
|
63
|
+
for env_var in credential_env_vars:
|
64
|
+
value = os.environ.get(env_var)
|
65
|
+
if value:
|
66
|
+
found_creds[env_var] = value
|
67
|
+
masked_value = value[:8] + "..." if len(value) > 8 else "***"
|
68
|
+
print(f"ā
{env_var}: {masked_value}")
|
69
|
+
|
70
|
+
if not found_creds:
|
71
|
+
print("ā ļø No credential environment variables found")
|
72
|
+
|
73
|
+
return found_creds
|
74
|
+
|
75
|
+
def test_credentials_integration():
|
76
|
+
"""Test the full credentials integration"""
|
77
|
+
print("\n" + "="*60)
|
78
|
+
print("š CREDENTIALS INTEGRATION TEST")
|
79
|
+
print("="*60)
|
80
|
+
|
81
|
+
# Test all credential sources
|
82
|
+
file_creds = test_credentials_file()
|
83
|
+
env_creds = test_environment_variables()
|
84
|
+
function_creds = test_credentials_loading()
|
85
|
+
|
86
|
+
# Combine all credentials
|
87
|
+
all_creds = {}
|
88
|
+
all_creds.update(file_creds)
|
89
|
+
all_creds.update(env_creds)
|
90
|
+
all_creds.update(function_creds)
|
91
|
+
|
92
|
+
print(f"\nš SUMMARY:")
|
93
|
+
print(f" - File credentials: {len(file_creds)}")
|
94
|
+
print(f" - Environment credentials: {len(env_creds)}")
|
95
|
+
print(f" - Function credentials: {len(function_creds)}")
|
96
|
+
print(f" - Total unique credentials: {len(all_creds)}")
|
97
|
+
|
98
|
+
if all_creds:
|
99
|
+
print(f"\nā
Credentials are available for SSH container integration")
|
100
|
+
print("š” These credentials will be automatically passed to SSH containers")
|
101
|
+
else:
|
102
|
+
print(f"\nā ļø No credentials found")
|
103
|
+
print("š” Consider setting up credentials using the credentials manager")
|
104
|
+
|
105
|
+
return all_creds
|
106
|
+
|
107
|
+
if __name__ == "__main__":
|
108
|
+
test_credentials_integration()
|
@@ -38,7 +38,7 @@ if args.proxy_api_key:
|
|
38
38
|
class PersistentShell:
|
39
39
|
"""A persistent bash shell using subprocess.Popen for executing commands with state persistence."""
|
40
40
|
|
41
|
-
def __init__(self, working_dir="/root", timeout=
|
41
|
+
def __init__(self, working_dir="/root", timeout=240):
|
42
42
|
self.working_dir = working_dir
|
43
43
|
self.timeout = timeout
|
44
44
|
self.process = None
|
@@ -1788,7 +1788,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1788
1788
|
cmd_manager = CommandListManager(setup_commands)
|
1789
1789
|
|
1790
1790
|
# Create persistent shell instance starting in /root
|
1791
|
-
shell = PersistentShell(working_dir="/root", timeout=
|
1791
|
+
shell = PersistentShell(working_dir="/root", timeout=240)
|
1792
1792
|
|
1793
1793
|
try:
|
1794
1794
|
# Start the persistent shell
|
@@ -1812,7 +1812,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1812
1812
|
print(f"š Executing main command {cmd_index + 1}/{cmd_manager.total_commands}: {cmd_text}")
|
1813
1813
|
|
1814
1814
|
start_time = time.time()
|
1815
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1815
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1816
1816
|
execution_time = time.time() - start_time
|
1817
1817
|
|
1818
1818
|
# Mark command as executed
|
@@ -1840,7 +1840,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1840
1840
|
# Execute the fix command
|
1841
1841
|
print(f"š Running suggested fix command: {fix_command}")
|
1842
1842
|
fix_start_time = time.time()
|
1843
|
-
fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=
|
1843
|
+
fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=240)
|
1844
1844
|
fix_execution_time = time.time() - fix_start_time
|
1845
1845
|
|
1846
1846
|
# Mark fix command as executed
|
@@ -1854,7 +1854,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1854
1854
|
# Retry the original command
|
1855
1855
|
print(f"š Retrying original command: {cmd_text}")
|
1856
1856
|
retry_start_time = time.time()
|
1857
|
-
retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=
|
1857
|
+
retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=240)
|
1858
1858
|
retry_execution_time = time.time() - retry_start_time
|
1859
1859
|
|
1860
1860
|
# Update the original command status
|
@@ -1883,7 +1883,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1883
1883
|
print(f"š§ Executing fix command {cmd_index + 1}: {cmd_text}")
|
1884
1884
|
|
1885
1885
|
start_time = time.time()
|
1886
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1886
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1887
1887
|
execution_time = time.time() - start_time
|
1888
1888
|
|
1889
1889
|
# Mark fix command as executed
|
@@ -1911,7 +1911,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
1911
1911
|
print(f"š§ Executing additional fix: {cmd_text}")
|
1912
1912
|
|
1913
1913
|
start_time = time.time()
|
1914
|
-
success, stdout, stderr = shell.execute(cmd_text, timeout=
|
1914
|
+
success, stdout, stderr = shell.execute(cmd_text, timeout=240)
|
1915
1915
|
execution_time = time.time() - start_time
|
1916
1916
|
|
1917
1917
|
# Mark fix command as executed
|