chore: add diagnostic logging around workspace git clone
The workspace creation endpoint returns 500 but the actual error is not visible. Add explicit error logging when GitService.clone fails and info logging when git creates a directory name different from the one derived from the remote URL. Quality gates: - pytest tests/unit: 219 passed - mypy: clean on changed files
This commit is contained in:
@@ -139,7 +139,19 @@ class WorkspaceManager:
|
||||
ssh_key_obj.private_key_encrypted.encode()
|
||||
).decode()
|
||||
|
||||
await GitService.clone(repo.remote_url, branch, clone_target, ssh_key=ssh_key)
|
||||
try:
|
||||
await GitService.clone(
|
||||
repo.remote_url, branch, clone_target, ssh_key=ssh_key
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.error(
|
||||
"Git clone failed for workspace %s (repo=%s, url=%s): %s",
|
||||
workspace_id,
|
||||
repo.id,
|
||||
repo.remote_url,
|
||||
exc,
|
||||
)
|
||||
raise
|
||||
|
||||
expected_path = os.path.join(parent_path, repo_dir_name)
|
||||
if not os.path.isdir(expected_path):
|
||||
@@ -150,6 +162,12 @@ class WorkspaceManager:
|
||||
for entry in os.listdir(parent_path)
|
||||
if os.path.isdir(os.path.join(parent_path, entry))
|
||||
]
|
||||
logger.info(
|
||||
"Workspace %s: expected %s/ but found directories: %s",
|
||||
workspace_id,
|
||||
repo_dir_name,
|
||||
entries,
|
||||
)
|
||||
if len(entries) == 1:
|
||||
expected_path = os.path.join(parent_path, entries[0])
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user