fix(issue-36): create_session hands the agent a brief path, not the task; a prompt file that cannot be written is removed
Review off26952c(codex, job cc849cbf): - P2: create_session registered the task by file but then pasted the whole task into the onboarding text, which send_keys_safe hands to `herdr agent prompt` as one argv string. A 130,500-byte --submit-job was registered intact and never reached the agent (execve E2BIG). The task now goes into <jobs>/<id>/brief.md, as the delegate-job wrapper does, and the injected text names that path. The publish command and its dispatch token (#23) are unchanged. The other send_keys_safe callers (the wrapper's short pointer, stop_session's exit key) carry no task text. - P3: delegate_job_safe's write-failure branch left the partial prompt file behind and logged to stdout, which callers capture. It now removes the file and logs to stderr. S8 (real create_session.sh, 100 and 130,500 bytes, strace when present) and S9 (the real function, RLIMIT_FSIZE write failure) carry the reviewer's reproductions over; all three fail onf26952c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f26952ccc3
commit
59be1c8920
3 files changed
+82
-2
No files matched your search
@@ -622,6 +622,19 @@ if [ -n "$DELEGATE_JOB_ID" ]; then
|
||||
# dispatch (trial-2 finding: without them the token-checking ack below could
|
||||
# never be satisfied by a real agent, and every onboarding sat out 180 s).
|
||||
pub="$(delegate_publish_cmd "$DELEGATE_JOB_ID" "$DELEGATE_JOB_TOKEN" "$DELEGATE_JOB_ATTEMPT")"
|
||||
# Issue #36: the task goes into a brief in the job's directory and the pane
|
||||
# gets only its path, as the delegate-job wrapper does. The injected text is
|
||||
# one argv string to herdr (capped at 131,072 bytes), so the whole task
|
||||
# plus this preamble could not reach the agent.
|
||||
task_reg_dir="${MAM_JOBS_DIR:-${WORKSPACE_ROOT:-$PWD}/.mam/jobs}"
|
||||
[[ "$task_reg_dir" == /* ]] || task_reg_dir="$PWD/$task_reg_dir"
|
||||
task_brief="$task_reg_dir/$DELEGATE_JOB_ID/brief.md"
|
||||
if ! { mkdir -p "${task_brief%/*}" && printf '%s' "$SUBMIT_JOB_PROMPT" > "$task_brief"; }; then
|
||||
echo "ERROR: cannot write the task brief $task_brief" >&2
|
||||
delegate_publish_event "$DELEGATE_JOB_ID" error "task brief could not be written" "$DELEGATE_JOB_TOKEN" "$DELEGATE_JOB_ATTEMPT"
|
||||
JOB_TERMINALIZED=1
|
||||
exit 1
|
||||
fi
|
||||
instructions="Your job_id is \"$DELEGATE_JOB_ID\" (the one just registered for THIS delegation).
|
||||
|
||||
On start run: $pub --event started.
|
||||
@@ -629,7 +642,7 @@ On progress (optional): $pub --event progress --detail '<short status>'.
|
||||
On success run: $pub --event completed --detail '<one-line summary>'.
|
||||
On failure run: $pub --event error --detail '<one-line reason>'.
|
||||
|
||||
Task: $SUBMIT_JOB_PROMPT"
|
||||
Task: read the complete task in $task_brief and follow it."
|
||||
|
||||
# Inject instructions into the herdr pane
|
||||
rc=0
|
||||
|
||||
Reference in new issue
Block a user