fix(delegate-job): logs passes --registry-dir on only when given (Issue #57, Mac F2)

cmd_logs always passed the wrapper's cwd-relative default registry, so the
usual run (registry not moved, cwd not the workspace) no longer found its
jobs. Without the option registry.py's own default decides, as before:
MAM_JOBS_DIR, then WORKSPACE_ROOT, then the cwd.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-10-15 00:02:50 +00:00
1 parent 75c004222c
commit 151af99765
2 files changed
+33 -4

No files matched your search

@@ -1093,19 +1093,24 @@ cmd_logs() {
# (Issue #57; $DELEGATE_JOB_LOGS_DIR overrides). parse_opts is for submit's
# globals, so the few options are read here.
PY="$(pick_python)"
local reg="$REGISTRY_DIR_DEFAULT" jid="" list=0
# --registry-dir is passed on only when given: registry.py's own default
# follows MAM_JOBS_DIR, then WORKSPACE_ROOT, so the usual run works from any
# cwd (the wrapper's REGISTRY_DIR_DEFAULT is cwd-relative). bash 3.2 + set -u:
# an empty array expands through ${reg[@]+"${reg[@]}"}.
local -a reg=()
local jid="" list=0
while [[ $# -gt 0 ]]; do
case "$1" in
--registry-dir) reg="$2"; shift 2;;
--registry-dir) reg=(--registry-dir "$2"); shift 2;;
--list) list=1; shift;;
*) jid="$1"; shift;;
esac
done
if [[ "$list" == "1" ]]; then
"$PY" "$SCRIPT_DIR/scripts/registry.py" --registry-dir "$reg" logs --list
"$PY" "$SCRIPT_DIR/scripts/registry.py" ${reg[@]+"${reg[@]}"} logs --list
else
[[ -n "$jid" ]] || { echo "logs requires <job_id> or --list" >&2; exit 1; }
"$PY" "$SCRIPT_DIR/scripts/registry.py" --registry-dir "$reg" logs "$jid"
"$PY" "$SCRIPT_DIR/scripts/registry.py" ${reg[@]+"${reg[@]}"} logs "$jid"
fi
}