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:
GodopuandClaude Opus 5.5 committed 2026-09-24 06:08:25 +00:00
1 parent 14d11bf062
commit f26952ccc3
4 files changed
+189 -15

No files matched your search

+8 -2
View File
@@ -26,7 +26,11 @@ def _build_parser() -> argparse.ArgumentParser:
sub = parser.add_subparsers(dest="command", required=True)
p_submit = sub.add_parser("submit", help="register a job; prints the job id")
p_submit.add_argument("--prompt", required=True)
# Issue #36: lib.sh passes the prompt by file (one argv string is capped
# at 131,072 bytes); --prompt keeps working.
submit_prompt = p_submit.add_mutually_exclusive_group(required=True)
submit_prompt.add_argument("--prompt")
submit_prompt.add_argument("--prompt-file")
p_submit.add_argument("--agent", default="claude-code")
p_submit.add_argument("--agent-session", default="herdr:claude")
p_submit.add_argument("--registry-dir", default=None)
@@ -57,7 +61,9 @@ def main(argv: Optional[List[str]] = None) -> int:
args = _build_parser().parse_args(argv)
if args.command == "submit":
forward = ["register", "--prompt", args.prompt,
prompt_arg = (["--prompt-file", args.prompt_file] if args.prompt_file is not None
else ["--prompt", args.prompt])
forward = ["register", *prompt_arg,
"--agent", args.agent, "--agent-session", args.agent_session]
if args.registry_dir:
forward = ["--registry-dir", args.registry_dir] + forward