fix: resolve set -euo pipefail silent exits and 3 related bugs
Root cause: bin/garc uses set -euo pipefail. Any command substitution $(...) that returns exit 1 caused the entire garc process to exit immediately with no output, making errors look silent. Fixes: - ingress.sh: add || true to all _find_queue_file $() assignments so set -e does not silently kill the process on missing queue items - ingress.sh: _ingress_update_status returns 1 silently (callers print their own error); _ingress_done/fail print "Queue item not found" exactly once - ingress.sh: _ingress_next result also guarded with || true - drive.sh: garc drive info with no args now shows GARC workspace folder info instead of printing usage and exiting - garc-core.py: replaced 210-line duplicate with a 3-line re-export from garc_core.py to prevent future divergence Verified: verify/done/fail all print clear error on bad ID (exit 1), drive info no-arg shows workspace folder, no regressions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
668fe1cd06
commit
680bd433f4
3 changed files with 26 additions and 220 deletions
12
lib/drive.sh
12
lib/drive.sh
|
|
@ -82,7 +82,17 @@ garc_drive_search() {
|
|||
}
|
||||
|
||||
garc_drive_info() {
|
||||
[[ -z "${1:-}" ]] && { echo "Usage: garc drive info <file_id>"; return 1; }
|
||||
# No arg → show workspace folder info
|
||||
if [[ -z "${1:-}" ]]; then
|
||||
local folder_id="${GARC_DRIVE_FOLDER_ID:-}"
|
||||
if [[ -z "${folder_id}" ]]; then
|
||||
echo "No GARC_DRIVE_FOLDER_ID set. Run 'garc setup all' first."
|
||||
echo "Usage: garc drive info <file_id>"
|
||||
return 1
|
||||
fi
|
||||
python3 "${DRIVE_HELPER}" info "${folder_id}"
|
||||
return $?
|
||||
fi
|
||||
python3 "${DRIVE_HELPER}" info "$1"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ _ingress_run_once() {
|
|||
done
|
||||
|
||||
local next_raw
|
||||
next_raw=$(_ingress_next --agent "${agent}")
|
||||
next_raw=$(_ingress_next --agent "${agent}") || true
|
||||
|
||||
if [[ "${next_raw}" == "(no pending items)" ]]; then
|
||||
echo "✅ Queue is empty — nothing to run."
|
||||
|
|
@ -367,8 +367,8 @@ _ingress_execute_stub() {
|
|||
[[ -z "${queue_id}" ]] && { echo "Usage: garc ingress execute-stub --queue-id <id>"; return 1; }
|
||||
|
||||
local queue_file
|
||||
queue_file=$(_find_queue_file "${queue_id}")
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
queue_file=$(_find_queue_file "${queue_id}") || true
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
|
||||
python3 "${INGRESS_HELPER}" execute-stub --queue-file "${queue_file}"
|
||||
}
|
||||
|
|
@ -390,8 +390,8 @@ _ingress_context() {
|
|||
[[ -z "${queue_id}" ]] && { echo "Usage: garc ingress context --queue-id <id>"; return 1; }
|
||||
|
||||
local queue_file
|
||||
queue_file=$(_find_queue_file "${queue_id}")
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
queue_file=$(_find_queue_file "${queue_id}") || true
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
|
||||
local agent_id="${GARC_DEFAULT_AGENT:-main}"
|
||||
local context_path="${GARC_CACHE_DIR:-${HOME}/.garc/cache}/workspace/${agent_id}/AGENT_CONTEXT.md"
|
||||
|
|
@ -453,8 +453,8 @@ _ingress_delegate() {
|
|||
}
|
||||
|
||||
local queue_file
|
||||
queue_file=$(_find_queue_file "${queue_id}")
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
queue_file=$(_find_queue_file "${queue_id}") || true
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
|
||||
python3 - <<PY
|
||||
import json
|
||||
|
|
@ -518,7 +518,7 @@ _ingress_done() {
|
|||
[[ -z "${queue_id}" ]] && { echo "Usage: garc ingress done --queue-id <id> [--note <text>]"; return 1; }
|
||||
|
||||
_ingress_update_status "${queue_id}" "done" "${note}" \
|
||||
|| { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
|| { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
echo "✅ Queue item ${queue_id} — done."
|
||||
[[ -n "${note}" ]] && echo " Note: ${note}"
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ _ingress_fail() {
|
|||
[[ -z "${queue_id}" ]] && { echo "Usage: garc ingress fail --queue-id <id> [--note <text>]"; return 1; }
|
||||
|
||||
_ingress_update_status "${queue_id}" "failed" "${note}" \
|
||||
|| { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
|| { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
echo "❌ Queue item ${queue_id} — failed."
|
||||
[[ -n "${note}" ]] && echo " Reason: ${note}"
|
||||
}
|
||||
|
|
@ -568,8 +568,8 @@ _ingress_verify() {
|
|||
[[ -z "${queue_id}" ]] && { echo "Usage: garc ingress verify --queue-id <id>"; return 1; }
|
||||
|
||||
local queue_file
|
||||
queue_file=$(_find_queue_file "${queue_id}")
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}" >&2; return 1; }
|
||||
queue_file=$(_find_queue_file "${queue_id}") || true
|
||||
[[ -z "${queue_file}" ]] && { echo "Queue item not found: ${queue_id}"; return 1; }
|
||||
|
||||
python3 - <<PY
|
||||
import json
|
||||
|
|
@ -634,7 +634,7 @@ _ingress_update_status() {
|
|||
local note="${3:-}"
|
||||
|
||||
local queue_file
|
||||
queue_file=$(_find_queue_file "${queue_id}")
|
||||
queue_file=$(_find_queue_file "${queue_id}") || true
|
||||
[[ -z "${queue_file}" ]] && return 1
|
||||
|
||||
# Pass note via argv to avoid shell→Python string injection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue