fix(robomp): address PR #4184 review nits

- log the worker thread's exception when a workspace op raises during
  caller cancellation, so a persistently failing setup surfaces instead
  of being buried behind CancelledError.
- raise on a timed-out (124) git symbolic-ref probe in the repo-exists
  path, matching the rev-parse probes, instead of silently accepting the
  caller-supplied branch.
- assert the subprocess timeout is passed in the two _chown_workspace
  test fakes so a refactor cannot silently drop the bound.

Op: correct
Restores: spec:indeterminate-git-probes-raise-not-silently-proceed
This commit is contained in:
metaphorics
2026-07-02 09:58:14 +09:00
parent 6d16c19a04
commit b7bcc0bbf0
4 changed files with 99 additions and 6 deletions
+7 -1
View File
@@ -819,12 +819,18 @@ class SandboxManager:
)
else:
slot_git_env = _git_env_for_repo(repo_dir)
symref = ["git", "symbolic-ref", "--quiet", "--short", "HEAD"]
current = _safe_run(
["git", "symbolic-ref", "--quiet", "--short", "HEAD"],
symref,
cwd=repo_dir,
env=slot_git_env,
**slot_git_kwargs,
)
if current.returncode == 124:
# A timed-out probe is indeterminate, not "detached HEAD".
# Silently keeping the caller-supplied branch could mismatch
# the real checkout; fail so the event retries.
raise GitCommandError(symref, current.returncode, current.stdout, current.stderr)
if current.returncode == 0 and current.stdout.strip():
branch = current.stdout.strip()
if existing_branch is not None and existing_branch != branch:
+6
View File
@@ -54,6 +54,12 @@ async def _run_workspace_op(func: Callable[..., _T], /, **kwargs: object) -> _T:
continue
except BaseException:
break
if not inner.cancelled() and inner.exception() is not None:
log.warning(
"workspace op %s raised during caller cancellation",
getattr(func, "__name__", func),
exc_info=inner.exception(),
)
raise