fix(issue-36): the legacy shell loop and lib.sh's submit helpers pass prompts by file
The two remaining exec points that carried a prompt as one argv string
(capped at 131,072 bytes):
- run_loop.sh (MAM_LOOP_PY=0): delegate_job_safe, which all eleven shell
delegations go through, turns `--prompt <text>` into `--prompt-file` under
the control root's .mam/ and removes the file once the wrapper returns. Its
failure lines go to stderr: callers capture stdout, and under set -e a
failed submit ends the loop at that line with the wrapper's code, so the
cause was being swallowed.
- lib.sh delegate_submit_job and its legacy twin (create_session's onboarding
and --submit-job): the prompt is written under .mam/ and handed on as
--prompt-file; lib_py.delegation.cli submit accepts --prompt-file and
forwards it to the registry. --prompt keeps working everywhere.
S6/S6b push a 140,000-byte prompt through the CLI and both helpers; S7 runs
the real run_loop.sh with a 140,000-byte plan and a 150,000-byte diff; S7b
fixes a nonzero exit when the implementation or compliance job cannot be
registered. All six fail on 14d11bf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
14d11bf062
commit
f26952ccc3
4 files changed
+189
-15
No files matched your search
+22
-4
@@ -2032,22 +2032,36 @@ _delegate_script() {
|
||||
printf '%s\n' "$(find "$skill_dir" -name "$name" 2>/dev/null | head -n 1 || true)"
|
||||
}
|
||||
|
||||
# _delegate_prompt_file <prompt> — write the prompt to a new file under the
|
||||
# control root's .mam/ and echo its path. Issue #36: a prompt handed to an exec
|
||||
# as one argv string is capped at 131,072 bytes; the caller removes the file.
|
||||
_delegate_prompt_file() {
|
||||
local dir="${WORKSPACE_ROOT:-$PWD}/.mam" f
|
||||
mkdir -p "$dir" || return 1
|
||||
f="$(mktemp "$dir/prompt-submit-XXXXXX")" || return 1
|
||||
printf '%s' "$1" > "$f" || { rm -f "$f"; return 1; }
|
||||
printf '%s\n' "$f"
|
||||
}
|
||||
|
||||
# delegate_submit_job <prompt> <agent> <agent_session>
|
||||
#
|
||||
# Register a job in the multi-agent-mux-delegate-job registry. Prints the new JID on stdout.
|
||||
_delegate_submit_job_legacy() {
|
||||
local prompt="$1" agent="$2" session="$3"
|
||||
local py_bin registry_py
|
||||
local py_bin registry_py prompt_file rc=0
|
||||
py_bin="$(_delegate_py_bin)"
|
||||
registry_py="$(_delegate_script registry.py)"
|
||||
if [ -z "$registry_py" ] || [ ! -f "$registry_py" ]; then
|
||||
echo "ERROR: multi-agent-mux-delegate-job registry.py not found under .agents/skills/" >&2
|
||||
return 1
|
||||
fi
|
||||
prompt_file="$(_delegate_prompt_file "$prompt")" || { echo "ERROR: cannot write the prompt file" >&2; return 1; }
|
||||
"$py_bin" "$registry_py" register \
|
||||
--prompt "$prompt" \
|
||||
--prompt-file "$prompt_file" \
|
||||
--agent "$agent" \
|
||||
--agent-session "$session"
|
||||
--agent-session "$session" || rc=$?
|
||||
rm -f "$prompt_file"
|
||||
return $rc
|
||||
}
|
||||
|
||||
# delegate_publish_event <job_id> <event> [detail]
|
||||
@@ -2152,7 +2166,11 @@ delegate_submit_job() {
|
||||
echo "ERROR: multi-agent-mux-delegate-job registry.py not found under .agents/skills/" >&2
|
||||
return 1
|
||||
fi
|
||||
_delegation_py submit --prompt "$prompt" --agent "$agent" --agent-session "$session"
|
||||
local prompt_file rc=0
|
||||
prompt_file="$(_delegate_prompt_file "$prompt")" || { echo "ERROR: cannot write the prompt file" >&2; return 1; }
|
||||
_delegation_py submit --prompt-file "$prompt_file" --agent "$agent" --agent-session "$session" || rc=$?
|
||||
rm -f "$prompt_file"
|
||||
return $rc
|
||||
}
|
||||
|
||||
# delegate_publish_event <job_id> <event> [detail]
|
||||
|
||||
Reference in new issue
Block a user