fix(issue-24): resume answers start-up dialogs for every agent, with the same switch as create

resume_session.sh called handle_startup_dialogs only when AGENT=claude and
passed no agent, so a resumed agy, grok or codex sat on its directory-trust
prompt exactly as the create path did before this branch. The gate is gone and
the agent is passed, which is the call create already makes.

--no-auto-trust / MAM_AUTO_TRUST apply to resume too. A resumed CLI shows the
same trust dialog as a fresh one, in the same directory, with the same
consequence for codex (trusting loads the project's local config, hooks and
exec policy), and handle_startup_dialogs already reads MAM_AUTO_TRUST - so the
only question was whether resume exposes the switch or silently inherits the
caller's environment. Exposing it keeps the two skills' contracts identical.

The tests run the shipped create/stop/resume scripts against the mock herdr.
The mock's pane always shows a ready banner, so they fix the call resume makes
(session, timeout, agent, MAM_AUTO_TRUST) by overriding the handler in the
sandbox copy of lib.sh, plus one unmodified run showing the real handler is
reached for a non-claude agent; which keys a dialog gets is fixed on the create
side (S4-S6).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-09-22 08:19:18 +00:00
1 parent ce802d21c8
commit 0dfbb2cc8a
3 files changed
+138 -15

No files matched your search

+5 -11
View File
@@ -101,17 +101,11 @@ case "$AGENT" in
esac
# 4. Spawn new herdr session + run agent with the saved id
case "$AGENT" in
claude)
START_CMD="herdr new-session -d -s \"$SESSION_NAME\" -x 140 -y 40 -c \"$WORKSPACE\" \"$CMD_FULL\""
eval "$START_CMD"
# auto-handle trust / bypass dialogs
handle_startup_dialogs "$SESSION_NAME" 20
;;
agy|hermes|grok|opencode|codex)
eval "herdr new-session -d -s \"$SESSION_NAME\" -x 140 -y 40 -c \"$WORKSPACE\" \"$CMD_FULL\""
;;
esac
eval "herdr new-session -d -s \"$SESSION_NAME\" -x 140 -y 40 -c \"$WORKSPACE\" \"$CMD_FULL\""
# Issue #24: start-up dialogs (trust prompts, blocking notices) are answered for
# every agent from the adapter's signatures - the same call create makes.
# --no-auto-trust leaves a directory-trust dialog to a human (MAM_AUTO_TRUST=0).
handle_startup_dialogs "$SESSION_NAME" 20 "$AGENT"
# 4. Update agent-sessions.yaml: status running, last_visible_status
# (Also automatically publishes a `progress --detail "resumed"` event to the multi-agent-mux-delegate-job registry if a delegate_job_id exists)
@@ -13,6 +13,8 @@ Usage: $0 --workspace <path> --agent <claude|agy|hermes|grok|opencode|codex> --s
Options:
--herdr-session NAME specify isolated herdr session name (alias: --herdr-server)
--no-auto-trust do not answer a start-up directory-trust dialog (default: answer it;
other blocking notices are always answered) - same switch as create
--dry-run Simulates resume flow (resolves binary, environment) without writing
any updates to YAML or DB. Safe to execute inside active write transactions.
EOF
@@ -25,6 +27,10 @@ HERDR_SERVER_OPT=""
HERDR_WORKSPACE_OPT=""
DRY_RUN=0
# Issue #24: a resumed CLI shows the same directory-trust dialog as a fresh
# one, so resume takes the same switch as create (MAM_AUTO_TRUST is what
# handle_startup_dialogs reads).
AUTO_TRUST=1
while [ $# -gt 0 ]; do
case "$1" in
@@ -33,6 +39,8 @@ while [ $# -gt 0 ]; do
--session) SESSION_NAME="$2"; shift 2 ;;
--herdr-session|--herdr-server) HERDR_SERVER_OPT="$2"; shift 2 ;;
--herdr-workspace) HERDR_WORKSPACE_OPT="$2"; shift 2 ;;
--auto-trust) AUTO_TRUST=1; shift ;;
--no-auto-trust) AUTO_TRUST=0; shift ;;
--dry-run) DRY_RUN=1; shift ;;
-h|--help) usage; exit 0 ;;
*) echo "ERROR: unknown arg: $1" >&2; exit 2 ;;
@@ -46,6 +54,7 @@ case "$AGENT" in
*) echo "ERROR: unsupported agent: $AGENT" >&2; exit 2 ;;
esac
[ -n "$SESSION_NAME" ] || { echo "ERROR: --session required" >&2; exit 2; }
export MAM_AUTO_TRUST="$AUTO_TRUST"
# Issue #21 phase 2 (A11): a session resumes only in the directory it ran in
# (its conversation is keyed by that cwd; a class A agent would otherwise start
@@ -226,10 +235,10 @@ fi
# 4. Spawn new agent session (delegates to herdr translation shim)
_herdr new-session -d -s "$SESSION_NAME" -c "$WORKSPACE" "$CP_PREFIX$CMD_FULL"
if [ "$AGENT" = "claude" ]; then
# auto-handle trust / bypass dialogs
handle_startup_dialogs "$SESSION_NAME" 20
fi
# Issue #24: every agent, the same call create makes. The signatures and accept
# keys come from the agent adapter; this used to run only for claude, so a
# resumed agy/grok/codex sat on its trust prompt.
handle_startup_dialogs "$SESSION_NAME" 20 "$AGENT"
# Wait for TUI readiness or let it settle
sleep 2