fix(delegate): submit also takes the target workspace's update admission (Issue #72, review R1)
Decision 8: delegate submit uses the admission lock of the workspace the target session belongs to. The wrapper resolved only its own WORKSPACE_ROOT, so a job could be registered and delivered to an agent of another installed workspace while that workspace was being updated. lib_py.update target-workspace resolves a herdr:<name> row's workspace (the .mam at or above its pane.cwd, else its control_plane.workspace_root); mam_update_admit takes an fd, and submit holds the caller root on fd 7 and the target on fd 8 until the record is written. Rowless and remote targets keep the caller-root gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
595e34b2d1
commit
e3394655b3
4 files changed
+123
-16
No files matched your search
@@ -301,10 +301,19 @@ cmd_submit() {
|
||||
local reg_dry=()
|
||||
if [[ "$DRY_RUN" == "1" ]]; then reg_dry=(--dry-run); fi
|
||||
|
||||
# Issue #72: no job is registered while an update of the target's workspace
|
||||
# runs; held until the record is written (lib.sh mam_update_admit). A
|
||||
# dry-run record is never dispatched and is not counted by the update.
|
||||
if [[ "$DRY_RUN" != "1" ]]; then mam_update_admit "$WORKSPACE_ROOT" || exit 1; fi
|
||||
# Issue #72: no job is registered while an update of this registry's
|
||||
# workspace or of the target's (its row's workspace, lib_py.update
|
||||
# target-workspace) runs; held until the record is written (lib.sh
|
||||
# mam_update_admit). A dry-run record is never dispatched and is not
|
||||
# counted by the update.
|
||||
if [[ "$DRY_RUN" != "1" ]]; then
|
||||
local target_ws
|
||||
target_ws="$(MAM_STATE_JSON="$(load_state_json)" PYTHONPATH="$SKILL_DIR:${PYTHONPATH:-}" "$PY" -m lib_py.update \
|
||||
target-workspace --workspace "$WORKSPACE_ROOT" --agent-session "$AGENT_SESSION")" \
|
||||
|| { echo "ERROR: cannot resolve the workspace of $AGENT_SESSION" >&2; exit 1; }
|
||||
mam_update_admit "$WORKSPACE_ROOT" || exit 1
|
||||
if [[ -n "$target_ws" ]]; then mam_update_admit "$target_ws" 8 || exit 1; fi
|
||||
fi
|
||||
# 1) register job (prints the new job id)
|
||||
JOB_ID="$("$PY" "$SCRIPT_DIR/scripts/registry.py" --registry-dir "$REGISTRY_DIR" register \
|
||||
"${reg_prompt[@]}" --agent "$AGENT" --agent-session "$AGENT_SESSION" --role "$DELEGATE_ROLE" \
|
||||
@@ -314,7 +323,7 @@ cmd_submit() {
|
||||
--job-type "$TYPE" --reviewer "$REVIEWER" --reviewer-session "$REVIEWER_SESSION" \
|
||||
--max-iterations "$MAX_ITERATIONS" ${reg_parent[@]+"${reg_parent[@]}"} ${reg_dry[@]+"${reg_dry[@]}"})"
|
||||
echo "registered job: $JOB_ID"
|
||||
[[ "$DRY_RUN" == "1" ]] || mam_update_admit_release
|
||||
[[ "$DRY_RUN" == "1" ]] || { mam_update_admit_release; mam_update_admit_release 8; }
|
||||
|
||||
# 1-1) Provision job directory and write direct brief.md (MAM Job Restructuring)
|
||||
local job_dir="$REGISTRY_DIR/$JOB_ID"
|
||||
|
||||
Reference in new issue
Block a user