@plot-pm/board 0.16.2 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -165,11 +165,17 @@ _action_receipt_dir() {
165
165
  # adapter — a script name in a controller is a boundary crossing no spawn
166
166
  # counter can see. So the shared filename is the action word, and mapping a
167
167
  # script back to it happens HERE, on the side that reads command lines.
168
+ #
169
+ # `plot-deliver.sh` maps to `deliver` here, same as always — `release` is a
170
+ # SEPARATE action sharing that script, and only `plot-controller-gate.sh` can
171
+ # tell the two calls apart (by whether `--release` rode along), so it passes
172
+ # the action word directly rather than the script name for that one case.
168
173
  _action_of() { # $1=script name or action word → the action, or nothing
169
174
  case "${1##*/}" in
170
175
  plot-dispatch.sh|dispatch) printf 'dispatch\n' ;;
171
176
  plot-approve.sh|approve) printf 'approve\n' ;;
172
177
  plot-deliver.sh|deliver) printf 'deliver\n' ;;
178
+ release) printf 'release\n' ;;
173
179
  esac
174
180
  }
175
181
 
@@ -231,7 +237,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
231
237
  action_reason="$*"
232
238
  if [ -z "$action_script" ] || [ -z "$action_subject" ] || [ -z "$action_reason" ]; then
233
239
  echo "plot-state-receipt: --unowned-action needs an action, a subject and a reason." >&2
234
- echo " usage: plot-state-receipt.sh --unowned-action <dispatch|approve|deliver> <slug> <reason>" >&2
240
+ echo " usage: plot-state-receipt.sh --unowned-action <dispatch|approve|deliver|release> <slug> <reason>" >&2
235
241
  echo "" >&2
236
242
  echo " The reason is required because each use names a routing gap, and a gap" >&2
237
243
  echo " nobody wrote down is one nobody closes. Where the board IS running, the" >&2
@@ -240,13 +246,17 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
240
246
  fi
241
247
  # The action word, or the script name — an operator reaching for this has
242
248
  # just read a refusal naming a script, so both spellings are accepted.
249
+ # `release` has no script of its own (`plot-deliver.sh --release` shares
250
+ # `plot-deliver.sh`, which already names `deliver`), so only the bare word
251
+ # is accepted for it.
243
252
  case "$action_script" in
244
253
  dispatch|plot-dispatch.sh) action_script="dispatch" ;;
245
254
  approve|plot-approve.sh) action_script="approve" ;;
246
255
  deliver|plot-deliver.sh) action_script="deliver" ;;
256
+ release) action_script="release" ;;
247
257
  *)
248
258
  echo "plot-state-receipt: '$action_script' is not a controller-owned action." >&2
249
- echo " The three are: dispatch, approve, deliver." >&2
259
+ echo " The four are: dispatch, approve, deliver, release." >&2
250
260
  exit 2
251
261
  ;;
252
262
  esac
package/plot-tmp.sh CHANGED
@@ -59,22 +59,50 @@ _plot_tmp_register() {
59
59
  # unlisted. While `__plot_tmp_busy` is set, the signal handler records the
60
60
  # signal in `__plot_tmp_pending` and returns; `_plot_tmp_create` handles it once
61
61
  # the path is registered.
62
+ #
63
+ # A SUBSHELL HOLDS THE SIGNAL ITSELF. bash resets caught traps in `$(…)` and
64
+ # `( … )`, so there the handler above is not installed and a TERM between
65
+ # `mktemp` and the registration ends the subshell with the path unlisted. The
66
+ # owner's cleanup then runs and cannot remove it. `plot-host.sh`'s
67
+ # `pr_list_call` creates `plot-host-prlist-err.*` this way, inside
68
+ # `_raw="$(pr_list_call …)"`, and CI run 37052327801 left one when the board
69
+ # test teardown sent its process group TERM. Inside a subshell
70
+ # (`BASH_SUBSHELL` > 0; bash 3.2 has no `BASHPID`) the creation installs
71
+ # handlers that only record the signal, and after the registration it restores
72
+ # the defaults and exits with 128 + the signal's number. It does not run the
73
+ # cleanup: the registry belongs to the owner, which received the same group
74
+ # signal and removes the path when the subshell has ended.
62
75
  __plot_tmp_busy=''
63
76
  __plot_tmp_pending=''
64
77
 
65
78
  # _plot_tmp_create VAR prefix [-d] — create, register, assign to VAR.
66
79
  _plot_tmp_create() {
67
- local __plot_tmp_new __plot_tmp_rc
80
+ local __plot_tmp_new __plot_tmp_rc __plot_tmp_sub=''
68
81
  __plot_tmp_busy=1
82
+ if [ "${BASH_SUBSHELL:-0}" -gt 0 ]; then
83
+ __plot_tmp_sub=1
84
+ trap '__plot_tmp_pending="INT 2"' INT
85
+ trap '__plot_tmp_pending="TERM 15"' TERM
86
+ trap '__plot_tmp_pending="PIPE 13"' PIPE
87
+ fi
69
88
  if [ "${3:-}" = -d ]; then
70
89
  __plot_tmp_new=$(mktemp -d "${TMPDIR:-/tmp}/plot-$2.XXXXXX")
71
90
  else
72
91
  __plot_tmp_new=$(mktemp "${TMPDIR:-/tmp}/plot-$2.XXXXXX")
73
92
  fi
74
93
  __plot_tmp_rc=$?
75
- [ "$__plot_tmp_rc" -eq 0 ] && _plot_tmp_register p "$__plot_tmp_new"
94
+ # THE PATH IS REGISTERED WHEN IT EXISTS, whatever the status says. bash 3.2
95
+ # reports 143 for `$(mktemp …)` when a trap ran during it, although `mktemp`
96
+ # created the path and printed it; a status-only test leaves that path
97
+ # unlisted.
98
+ if [ -n "$__plot_tmp_new" ] && { [ -e "$__plot_tmp_new" ] || [ "$__plot_tmp_rc" -eq 0 ]; }; then
99
+ _plot_tmp_register p "$__plot_tmp_new"
100
+ fi
76
101
  __plot_tmp_busy=''
77
- if [ -n "$__plot_tmp_pending" ]; then
102
+ if [ -n "$__plot_tmp_sub" ]; then
103
+ trap - INT TERM PIPE
104
+ [ -z "$__plot_tmp_pending" ] || exit $((128 + ${__plot_tmp_pending#* }))
105
+ elif [ -n "$__plot_tmp_pending" ]; then
78
106
  # shellcheck disable=SC2086 # "<name> <number>", split on purpose
79
107
  _plot_tmp_on_signal $__plot_tmp_pending
80
108
  fi
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
  # The ONE answer to "how long has this worktree's agent been quiet?" — sourced,
3
- # not run, by `plot-worker-monitor.sh` and `plot-worker-loop.sh`.
3
+ # not run, by `plot-worker-loop.sh` for its own watcher (`plot-worker-state.sh`'s
4
+ # `plot_worker_idle_watch_pass`) and for its own ending message. Sourced by the
5
+ # now-deleted `plot-worker-monitor.sh` until `bug/the-loop-reports-idle`.
4
6
  #
5
7
  # It reads the AGENT rather than the machine. A `claude -p` session appends a
6
8
  # timestamped line to its transcript for every model turn, tool call and tool