@soleur/opencode 3.378.16 → 3.378.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.378.16",
3
+ "version": "3.378.17",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,8 @@
32
32
  # resolver exists.
33
33
  #
34
34
  # Flat key=value lines, rewritten wholesale under with_lock:
35
- # seats / ci_cycles / fix_rounds / agent_rounds (counts, default 0)
35
+ # seats / ci_cycles / fix_rounds / agent_rounds / ci_wall_s
36
+ # (counts, default 0)
36
37
  # cap_<dim>=N (0 = unset — persisted at init so caps survive
37
38
  # skill-to-skill handoff; argv dies at skill boundaries)
38
39
  # warned_<dim>=N (level at which WARN first fired, ask included; 0 = never)
@@ -64,19 +65,25 @@
64
65
  # pass included — `gate seats <panel-size>` before dispatch). `agent_rounds` =
65
66
  # orchestration dispatches (one-shot child skills, drain items, resolver
66
67
  # fan-outs). `fix_rounds` = fix/retry iterations. `ci_cycles` = CI runs the run
67
- # itself drove (each push to the PR head). Heterogeneous units land on one dim
68
- # by design — a cap reads as "work units", not a strict taxonomy.
68
+ # itself drove (each push to the PR head). `ci_wall_s` = measured CI wall-clock
69
+ # seconds (#11775) — summed over the driven runs whose timing was readable; a
70
+ # caller with no measurement posts NOTHING, so the count is a floor and count 0
71
+ # means "never measured", which the render surfaces print as
72
+ # `ci_wall_s=unmeasured` (an explicit absent marker — never `ci_wall_s=0`, a
73
+ # fabricated zero that would masquerade as a measured run). Heterogeneous units
74
+ # land on one dim by design — a cap reads as "work units", not a strict taxonomy.
69
75
  #
70
- # DIMENSIONS: seats | ci_cycles | fix_rounds | agent_rounds
71
- # (`ci-cycles` is accepted as an alias for `ci_cycles` everywhere a dim is
72
- # taken). One writer per dimension per skill invocation — a prose `incr` and a
73
- # workflow `counts:` post for the same dim never both fire.
76
+ # DIMENSIONS: seats | ci_cycles | fix_rounds | agent_rounds | ci_wall_s
77
+ # (`ci-cycles` and `ci-wall-s` are accepted as aliases for `ci_cycles` and
78
+ # `ci_wall_s` everywhere a dim is taken). One writer per dimension per skill
79
+ # invocation — a prose `incr` and a workflow `counts:` post for the same dim
80
+ # never both fire.
74
81
  #
75
82
  # SUBCOMMANDS
76
83
  #
77
84
  # init [--reset] [--branch <b>]
78
85
  # [--max-seats N] [--max-ci-cycles N] [--max-fix-rounds N]
79
- # [--max-agent-rounds N]
86
+ # [--max-agent-rounds N] [--max-ci-wall-s N]
80
87
  # Idempotent MERGE: creates the file if absent, preserves counters, merges
81
88
  # --max-* flags into cap_<dim>. Prints `tally-init: <slug> <outcome>` where
82
89
  # outcome ∈ fresh | continued | reset | capped-reset | stale-reset |
@@ -138,7 +145,8 @@
138
145
  # Flag validation: values must match ^[1-9][0-9]{0,9}$ — non-numeric,
139
146
  # negative, zero, leading-zero forms (`08`), and digit strings that would
140
147
  # wrap mod-2^64 are rejected with SOLEUR_TALLY_ERROR reason=bad-flag on
141
- # stderr and exit 0. `--max-ci_cycles` (underscore) aliases --max-ci-cycles.
148
+ # stderr and exit 0. `--max-ci_cycles` (underscore) aliases --max-ci-cycles;
149
+ # `--max-ci_wall_s` aliases --max-ci-wall-s the same way.
142
150
  #
143
151
  # incr <dim> [n] [--branch <b>]
144
152
  # Adds n (default 1, ^[0-9]{1,10}$ validated and 10#-normalized) to <dim> under
@@ -150,7 +158,10 @@
150
158
  #
151
159
  # show [--branch <b>]
152
160
  # Absent/unreadable file → UNKNOWN. Else prints
153
- # `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N`, a `cap:<dim>=<n>`
161
+ # `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N ci_wall_s=W` —
162
+ # where W is `unmeasured` at count 0 (the absent marker, never a fabricated
163
+ # `ci_wall_s=0`) and the count itself once any measured wall was posted — a
164
+ # `cap:<dim>=<n>`
154
165
  # token line when caps are set (the stop-hook floor reads this), and, when
155
166
  # any is set, `warned:<dim>=<at>` / `capped:<dim>=<cap>` tokens. On a
156
167
  # default-branch ledger (`main`/`master`) a last line
@@ -255,11 +266,12 @@ _tally_paths_err() { case "$1" in 1) _tally_err bad-branch ;; *) _tally_err lib-
255
266
  # per-run key), so init scopes them to one run and show discloses it.
256
267
  _tally_is_default_branch() { [[ "${T_BRANCH:-}" == "main" || "${T_BRANCH:-}" == "master" ]]; }
257
268
 
258
- # Canonicalize a dim token -> seats|ci_cycles|fix_rounds|agent_rounds, or fail.
269
+ # Canonicalize a dim token -> seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s, or fail.
259
270
  _tally_dim() {
260
271
  case "$1" in
261
- seats|ci_cycles|fix_rounds|agent_rounds) printf '%s' "$1" ;;
272
+ seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s) printf '%s' "$1" ;;
262
273
  ci-cycles) printf 'ci_cycles' ;;
274
+ ci-wall-s) printf 'ci_wall_s' ;;
263
275
  *) return 1 ;;
264
276
  esac
265
277
  }
@@ -322,12 +334,12 @@ _tally_ledger_ok() {
322
334
  [[ -f "$1" && -r "$1" ]] || return 1
323
335
  grep -q '^seats=' "$1" 2>/dev/null || return 1
324
336
  if grep -qvE '=[0-9]{1,18}$' \
325
- < <(grep -E '^(seats|ci_cycles|fix_rounds|agent_rounds|cap_[a-z_]+|warned_[a-z_]+)=' "$1" 2>/dev/null); then
337
+ < <(grep -E '^(seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s|cap_[a-z_]+|warned_[a-z_]+)=' "$1" 2>/dev/null); then
326
338
  return 1
327
339
  fi
328
340
  # EVERY capped= line must carry the dim vocabulary or be empty — a duplicate
329
341
  # corrupt line after a clean one must not slip past a first-line read.
330
- if grep -qvE '^capped=(|seats|ci_cycles|fix_rounds|agent_rounds)$' \
342
+ if grep -qvE '^capped=(|seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s)$' \
331
343
  < <(grep -E '^capped=' "$1" 2>/dev/null); then
332
344
  return 1
333
345
  fi
@@ -341,9 +353,9 @@ _tally_setf() { printf -v "T_$1" '%s' "$2"; }
341
353
  # Load the ledger into T_* globals; missing/corrupt fields default to 0/empty.
342
354
  _tally_load() {
343
355
  local k v
344
- for k in seats ci_cycles fix_rounds agent_rounds \
345
- cap_seats cap_ci_cycles cap_fix_rounds cap_agent_rounds \
346
- warned_seats warned_ci_cycles warned_fix_rounds warned_agent_rounds; do
356
+ for k in seats ci_cycles fix_rounds agent_rounds ci_wall_s \
357
+ cap_seats cap_ci_cycles cap_fix_rounds cap_agent_rounds cap_ci_wall_s \
358
+ warned_seats warned_ci_cycles warned_fix_rounds warned_agent_rounds warned_ci_wall_s; do
347
359
  v=""
348
360
  [[ -r "$1" ]] && v=$(_tally_field "$1" "$k")
349
361
  [[ "$v" =~ ^[0-9]+$ ]] || v=0
@@ -355,7 +367,7 @@ _tally_load() {
355
367
  # Sanitize: an unvetted latch value would reach indirect expansion in
356
368
  # `show` (`cap_$T_capped` -> invalid variable name) and mis-STOP gates.
357
369
  case "$T_capped" in
358
- ""|seats|ci_cycles|fix_rounds|agent_rounds) ;;
370
+ ""|seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s) ;;
359
371
  *) T_capped="" ;;
360
372
  esac
361
373
  fi
@@ -374,14 +386,17 @@ seats=$(_tally_getf seats)
374
386
  ci_cycles=$(_tally_getf ci_cycles)
375
387
  fix_rounds=$(_tally_getf fix_rounds)
376
388
  agent_rounds=$(_tally_getf agent_rounds)
389
+ ci_wall_s=$(_tally_getf ci_wall_s)
377
390
  cap_seats=$(_tally_getf cap_seats)
378
391
  cap_ci_cycles=$(_tally_getf cap_ci_cycles)
379
392
  cap_fix_rounds=$(_tally_getf cap_fix_rounds)
380
393
  cap_agent_rounds=$(_tally_getf cap_agent_rounds)
394
+ cap_ci_wall_s=$(_tally_getf cap_ci_wall_s)
381
395
  warned_seats=$(_tally_getf warned_seats)
382
396
  warned_ci_cycles=$(_tally_getf warned_ci_cycles)
383
397
  warned_fix_rounds=$(_tally_getf warned_fix_rounds)
384
398
  warned_agent_rounds=$(_tally_getf warned_agent_rounds)
399
+ warned_ci_wall_s=$(_tally_getf warned_ci_wall_s)
385
400
  capped=$T_capped
386
401
  EOF
387
402
  if ! mv "$tmp" "$1" 2>/dev/null; then
@@ -394,9 +409,16 @@ EOF
394
409
  }
395
410
 
396
411
  _tally_print_line() {
397
- printf 'tally: seats=%s ci_cycles=%s fix_rounds=%s agent_rounds=%s\n' \
412
+ # ci_wall_s at count 0 is UNMEASURED, not zero (#11775): the render prints
413
+ # the explicit absent marker so a run that never posted a measurement is
414
+ # never mistaken for a measured 0-second run. The ledger stores 0 either
415
+ # way; only this surface translates it. Distinct from SOLEUR_TALLY_ABSENT,
416
+ # which marks a missing/unreadable ledger as a whole.
417
+ local wall="$(_tally_getf ci_wall_s)"
418
+ (( wall == 0 )) && wall="unmeasured"
419
+ printf 'tally: seats=%s ci_cycles=%s fix_rounds=%s agent_rounds=%s ci_wall_s=%s\n' \
398
420
  "$(_tally_getf seats)" "$(_tally_getf ci_cycles)" \
399
- "$(_tally_getf fix_rounds)" "$(_tally_getf agent_rounds)"
421
+ "$(_tally_getf fix_rounds)" "$(_tally_getf agent_rounds)" "$wall"
400
422
  }
401
423
 
402
424
  # Reap sibling counter files older than 30 days (mtime) — opportunistic
@@ -449,7 +471,7 @@ _tally_norm_cap() {
449
471
 
450
472
  _tally_init_locked() {
451
473
  local reset="$1" caps_given="$2"
452
- local n_seats="$3" n_ci="$4" n_fix="$5" n_agent="$6"
474
+ local n_seats="$3" n_ci="$4" n_fix="$5" n_agent="$6" n_wall="$7"
453
475
  local existed=0 ok=0 outcome
454
476
  [[ -f "$T_FILE" ]] && existed=1
455
477
  if (( existed )) && _tally_ledger_ok "$T_FILE"; then ok=1; fi
@@ -513,8 +535,10 @@ _tally_init_locked() {
513
535
  # reset clears the ledger, never the budget.
514
536
  _tally_setf seats 0; _tally_setf ci_cycles 0
515
537
  _tally_setf fix_rounds 0; _tally_setf agent_rounds 0
538
+ _tally_setf ci_wall_s 0
516
539
  _tally_setf warned_seats 0; _tally_setf warned_ci_cycles 0
517
540
  _tally_setf warned_fix_rounds 0; _tally_setf warned_agent_rounds 0
541
+ _tally_setf warned_ci_wall_s 0
518
542
  T_capped=""
519
543
  ;;
520
544
  capped-reset)
@@ -525,6 +549,7 @@ _tally_init_locked() {
525
549
  T_capped=""
526
550
  _tally_setf warned_seats 0; _tally_setf warned_ci_cycles 0
527
551
  _tally_setf warned_fix_rounds 0; _tally_setf warned_agent_rounds 0
552
+ _tally_setf warned_ci_wall_s 0
528
553
  ;;
529
554
  esac
530
555
 
@@ -537,6 +562,7 @@ _tally_init_locked() {
537
562
  _tally_merge_cap ci_cycles "$n_ci" "$reset"
538
563
  _tally_merge_cap fix_rounds "$n_fix" "$reset"
539
564
  _tally_merge_cap agent_rounds "$n_agent" "$reset"
565
+ _tally_merge_cap ci_wall_s "$n_wall" "$reset"
540
566
 
541
567
  _tally_write "$T_FILE" || { _tally_err write-failed; printf 'UNKNOWN\n'; return 0; }
542
568
  _tally_sweep
@@ -553,7 +579,7 @@ _tally_init_locked() {
553
579
  # armed: line and show's cap: line so the two renderings cannot drift.
554
580
  _tally_cap_tokens() {
555
581
  local _d _c out=""
556
- for _d in seats ci_cycles fix_rounds agent_rounds; do
582
+ for _d in seats ci_cycles fix_rounds agent_rounds ci_wall_s; do
557
583
  _c=$(_tally_getf "cap_$_d")
558
584
  (( _c > 0 )) && out="${out}cap:${_d}=${_c} "
559
585
  done
@@ -576,7 +602,7 @@ _tally_merge_cap() {
576
602
 
577
603
  cmd_init() {
578
604
  local reset=0 caps_given=0 branch="" flag=""
579
- local n_seats="" n_ci="" n_fix="" n_agent="" v=""
605
+ local n_seats="" n_ci="" n_fix="" n_agent="" n_wall="" v=""
580
606
  while [[ $# -gt 0 ]]; do
581
607
  # Underscored spellings of a flag alias to its hyphenated form —
582
608
  # `--max-ci_cycles` would otherwise silently bad-flag the operator's budget.
@@ -599,11 +625,14 @@ cmd_init() {
599
625
  --max-agent-rounds)
600
626
  v=$(_tally_norm_cap "${2:-}") || { _tally_err bad-flag; printf 'UNKNOWN\n'; return 0; }
601
627
  n_agent=$v; caps_given=1; shift 2 ;;
628
+ --max-ci-wall-s)
629
+ v=$(_tally_norm_cap "${2:-}") || { _tally_err bad-flag; printf 'UNKNOWN\n'; return 0; }
630
+ n_wall=$v; caps_given=1; shift 2 ;;
602
631
  *) _tally_err bad-flag; printf 'UNKNOWN\n'; return 0 ;;
603
632
  esac
604
633
  done
605
634
  _tally_paths "$branch" || { _tally_paths_err $?; printf 'UNKNOWN\n'; return 0; }
606
- _tally_locked _tally_init_locked "$reset" "$caps_given" "$n_seats" "$n_ci" "$n_fix" "$n_agent" || true
635
+ _tally_locked _tally_init_locked "$reset" "$caps_given" "$n_seats" "$n_ci" "$n_fix" "$n_agent" "$n_wall" || true
607
636
  return 0
608
637
  }
609
638
 
@@ -684,7 +713,7 @@ cmd_show() {
684
713
  [[ -n "$caps" ]] && printf '%s\n' "${caps% }"
685
714
  # Third line: warned/capped annotations, only when set.
686
715
  local ann=""
687
- for d in seats ci_cycles fix_rounds agent_rounds; do
716
+ for d in seats ci_cycles fix_rounds agent_rounds ci_wall_s; do
688
717
  w=$(_tally_getf "warned_$d")
689
718
  [[ "$w" != "0" ]] && ann="${ann}warned:${d}=${w} "
690
719
  done
@@ -784,13 +813,14 @@ _tally_usage() {
784
813
  usage: pipeline-tally.sh <subcommand> [args]
785
814
 
786
815
  init [--reset] [--branch <b>] [--max-seats N] [--max-ci-cycles N]
787
- [--max-fix-rounds N] [--max-agent-rounds N]
816
+ [--max-fix-rounds N] [--max-agent-rounds N] [--max-ci-wall-s N]
788
817
  incr <dim> [n] [--branch <b>]
789
818
  show [--branch <b>]
790
819
  gate <dim> [n] [--branch <b>]
791
820
  selfcheck
792
821
 
793
- dims: seats | ci_cycles (alias ci-cycles) | fix_rounds | agent_rounds
822
+ dims: seats | ci_cycles (alias ci-cycles) | fix_rounds | agent_rounds |
823
+ ci_wall_s (alias ci-wall-s)
794
824
  gate's optional [n] is a lookahead: STOP when count+n would exceed the cap.
795
825
  fail-open: every subcommand exits 0; errors are SOLEUR_TALLY_ERROR on stderr.
796
826
  EOF
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
3
  # Tests for plugins/soleur/scripts/pipeline-tally.sh — the per-branch pipeline
4
- # activity ledger (seats / ci_cycles / fix_rounds / agent_rounds), its
4
+ # activity ledger (seats / ci_cycles / fix_rounds / agent_rounds / ci_wall_s), its
5
5
  # warn-then-STOP budget gate, and its fail-open UNKNOWN surface.
6
6
  #
7
7
  # Written from the BINDING CONTRACT, not the implementation (the SUT is built
@@ -189,7 +189,9 @@ assert_eq "0" "$(cf_get "$C2" seats)" "seats initialized to 0"
189
189
  assert_eq "0" "$(cf_get "$C2" ci_cycles)" "ci_cycles initialized to 0"
190
190
  assert_eq "0" "$(cf_get "$C2" fix_rounds)" "fix_rounds initialized to 0"
191
191
  assert_eq "0" "$(cf_get "$C2" agent_rounds)" "agent_rounds initialized to 0"
192
+ assert_eq "0" "$(cf_get "$C2" ci_wall_s)" "ci_wall_s initialized to 0"
192
193
  assert_eq "0" "$(cf_get "$C2" cap_seats)" "cap_seats initialized to 0 (unset)"
194
+ assert_eq "0" "$(cf_get "$C2" cap_ci_wall_s)" "cap_ci_wall_s initialized to 0 (unset)"
193
195
  assert_eq "" "$(cf_get "$C2" capped)" "capped starts empty"
194
196
  assert_eq "" "$(cf_get "$C2" started_at)" "no started_at key — staleness is mtime-keyed"
195
197
  assert_eq "" "$(cf_get "$C2" run_id)" "no run_id key — dropped from the ledger schema"
@@ -205,12 +207,12 @@ assert_not_contains "$OUT" "UNKNOWN" "incr on a live ledger does not print UNKNO
205
207
  run_tally "$R3" "$S3" incr ci_cycles 2
206
208
  assert_rc0 "incr ci_cycles 2 exits 0"
207
209
  run_tally "$R3" "$S3" show
208
- assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=0" "$OUT" \
209
- "show prints the contract's exact tally line"
210
+ assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=0 ci_wall_s=unmeasured" "$OUT" \
211
+ "show prints the contract's exact tally line (unmeasured ci_wall_s at count 0)"
210
212
  echo ""
211
213
 
212
- # --- Test 4: incr default n=1, n>1, the ci-cycles alias, all four dims --------
213
- echo "Test 4: incr defaults n=1, accepts n>1, aliases ci-cycles"
214
+ # --- Test 4: incr default n=1, n>1, the hyphen aliases, all five dims ----------
215
+ echo "Test 4: incr defaults n=1, accepts n>1, aliases ci-cycles and ci-wall-s"
214
216
  R4=$(new_repo r4); S4="$TMP/s4"
215
217
  run_tally "$R4" "$S4" init
216
218
  run_tally "$R4" "$S4" incr seats # default n=1
@@ -218,9 +220,11 @@ run_tally "$R4" "$S4" incr seats 4 # n>1
218
220
  run_tally "$R4" "$S4" incr ci-cycles # hyphenated alias -> ci_cycles
219
221
  run_tally "$R4" "$S4" incr fix_rounds 2
220
222
  run_tally "$R4" "$S4" incr agent_rounds 3
223
+ run_tally "$R4" "$S4" incr ci_wall_s 90 # measured wall seconds -> positive render
224
+ run_tally "$R4" "$S4" incr ci-wall-s 30 # hyphenated alias -> ci_wall_s
221
225
  run_tally "$R4" "$S4" show
222
- assert_eq "tally: seats=5 ci_cycles=1 fix_rounds=2 agent_rounds=3" "$OUT" \
223
- "all four dims accumulate; ci-cycles alias lands on ci_cycles"
226
+ assert_eq "tally: seats=5 ci_cycles=1 fix_rounds=2 agent_rounds=3 ci_wall_s=120" "$OUT" \
227
+ "all five dims accumulate; ci-wall-s alias lands on ci_wall_s"
224
228
  echo ""
225
229
 
226
230
  # --- Test 5: incr on a missing file (AC8, Guard-1 row 4) ----------------------
@@ -282,14 +286,17 @@ seats=7
282
286
  ci_cycles=0
283
287
  fix_rounds=0
284
288
  agent_rounds=0
289
+ ci_wall_s=0
285
290
  cap_seats=5
286
291
  cap_ci_cycles=0
287
292
  cap_fix_rounds=0
288
293
  cap_agent_rounds=0
294
+ cap_ci_wall_s=0
289
295
  warned_seats=0
290
296
  warned_ci_cycles=0
291
297
  warned_fix_rounds=0
292
298
  warned_agent_rounds=0
299
+ warned_ci_wall_s=0
293
300
  capped=seats
294
301
  run_id=seeded
295
302
  started_at=$(date +%s)
@@ -333,14 +340,17 @@ seats=9
333
340
  ci_cycles=4
334
341
  fix_rounds=0
335
342
  agent_rounds=0
343
+ ci_wall_s=0
336
344
  cap_seats=5
337
345
  cap_ci_cycles=0
338
346
  cap_fix_rounds=0
339
347
  cap_agent_rounds=0
348
+ cap_ci_wall_s=0
340
349
  warned_seats=0
341
350
  warned_ci_cycles=0
342
351
  warned_fix_rounds=0
343
352
  warned_agent_rounds=0
353
+ warned_ci_wall_s=0
344
354
  capped=
345
355
  EOF
346
356
  touch -d "25 hours ago" "$C9"
@@ -364,14 +374,17 @@ seats=7
364
374
  ci_cycles=0
365
375
  fix_rounds=0
366
376
  agent_rounds=0
377
+ ci_wall_s=0
367
378
  cap_seats=0
368
379
  cap_ci_cycles=0
369
380
  cap_fix_rounds=0
370
381
  cap_agent_rounds=0
382
+ cap_ci_wall_s=0
371
383
  warned_seats=0
372
384
  warned_ci_cycles=0
373
385
  warned_fix_rounds=0
374
386
  warned_agent_rounds=0
387
+ warned_ci_wall_s=0
375
388
  capped=
376
389
  run_id=old-schema
377
390
  started_at=$OLD_TS
@@ -455,14 +468,17 @@ seats=0
455
468
  ci_cycles=0
456
469
  fix_rounds=0
457
470
  agent_rounds=0
471
+ ci_wall_s=0
458
472
  cap_seats=0
459
473
  cap_ci_cycles=0
460
474
  cap_fix_rounds=0
461
475
  cap_agent_rounds=0
476
+ cap_ci_wall_s=0
462
477
  warned_seats=0
463
478
  warned_ci_cycles=0
464
479
  warned_fix_rounds=0
465
480
  warned_agent_rounds=0
481
+ warned_ci_wall_s=0
466
482
  capped=fix_rounds
467
483
  run_id=latched
468
484
  started_at=$(date +%s)
@@ -644,14 +660,17 @@ seats=13
644
660
  ci_cycles=4
645
661
  fix_rounds=1
646
662
  agent_rounds=7
663
+ ci_wall_s=0
647
664
  cap_seats=12
648
665
  cap_ci_cycles=0
649
666
  cap_fix_rounds=0
650
667
  cap_agent_rounds=0
668
+ cap_ci_wall_s=0
651
669
  warned_seats=11
652
670
  warned_ci_cycles=0
653
671
  warned_fix_rounds=0
654
672
  warned_agent_rounds=0
673
+ warned_ci_wall_s=0
655
674
  capped=seats
656
675
  EOF
657
676
  touch -d "25 hours ago" "$C24"
@@ -704,15 +723,18 @@ echo ""
704
723
  echo "Test 27: corrupt ledgers report unreadable/repaired, never the zero state"
705
724
  R27=$(new_repo r27); S27="$TMP/s27"; C27=$(cf_path "$S27")
706
725
  mkdir -p "$(dirname "$C27")"
707
- for CORRUPT in 'garbage-line' 'seats=abc' 'cap_seats=5x' 'warned_seats=zzz' 'capped=nosuchdim' 'seats=99999999999999999999'; do
726
+ for CORRUPT in 'garbage-line' 'seats=abc' 'ci_wall_s=abc' 'cap_ci_wall_s=5x' 'cap_seats=5x' 'warned_seats=zzz' 'warned_ci_wall_s=zzz' 'capped=nosuchdim' 'seats=99999999999999999999'; do
708
727
  if [[ "$CORRUPT" == "garbage-line" ]]; then
709
728
  printf 'not a ledger\n' > "$C27"
710
729
  else
711
- printf 'seats=3\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=0\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=\n' > "$C27"
730
+ printf 'seats=3\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=0\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=\n' > "$C27"
712
731
  case "$CORRUPT" in
713
732
  seats=abc) sed -i 's/^seats=3/seats=abc/' "$C27" ;;
733
+ ci_wall_s=abc) sed -i 's/^ci_wall_s=0/ci_wall_s=abc/' "$C27" ;;
734
+ cap_ci_wall_s=5x) sed -i 's/^cap_ci_wall_s=0/cap_ci_wall_s=5x/' "$C27" ;;
714
735
  cap_seats=5x) sed -i 's/^cap_seats=0/cap_seats=5x/' "$C27" ;;
715
736
  warned_seats=zzz) sed -i 's/^warned_seats=0/warned_seats=zzz/' "$C27" ;;
737
+ warned_ci_wall_s=zzz) sed -i 's/^warned_ci_wall_s=0/warned_ci_wall_s=zzz/' "$C27" ;;
716
738
  capped=nosuchdim) sed -i 's/^capped=$/capped=nosuchdim/' "$C27" ;;
717
739
  seats=99999999999999999999) sed -i 's/^seats=3/seats=99999999999999999999/' "$C27" ;; # 20 digits — mod-2^64 wrap territory
718
740
  esac
@@ -835,14 +857,17 @@ seats=13
835
857
  ci_cycles=4
836
858
  fix_rounds=1
837
859
  agent_rounds=7
860
+ ci_wall_s=0
838
861
  cap_seats=12
839
862
  cap_ci_cycles=0
840
863
  cap_fix_rounds=0
841
864
  cap_agent_rounds=0
865
+ cap_ci_wall_s=0
842
866
  warned_seats=11
843
867
  warned_ci_cycles=0
844
868
  warned_fix_rounds=0
845
869
  warned_agent_rounds=0
870
+ warned_ci_wall_s=0
846
871
  capped=seats
847
872
  EOF
848
873
  run_tally "$R31" "$S31" init --max-seats 20
@@ -854,7 +879,7 @@ assert_eq "" "$(cf_get "$C31" capped)" "capped-reset clears the latch"
854
879
  assert_eq "0" "$(cf_get "$C31" warned_seats)" "capped-reset clears warned_*"
855
880
  assert_eq "20" "$(cf_get "$C31" cap_seats)" "the raised cap is merged and kept"
856
881
  # Bare init on a capped main ledger: caps survive every reset form.
857
- printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
882
+ printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
858
883
  run_tally "$R31" "$S31" init
859
884
  assert_line "$OUT" "tally-init: $SL31 continued capped=seats" "bare init on capped main -> continued capped=seats (the sticky latch holds)"
860
885
  assert_no_line "$OUT" "tally-init: $SL31 default-branch-reset" "bare init on capped main does not default-branch-reset"
@@ -863,22 +888,22 @@ assert_eq "seats" "$(cf_get "$C31" capped)" "bare init on capped main keeps the
863
888
  assert_eq "12" "$(cf_get "$C31" cap_seats)" "bare init on capped main keeps the persisted cap"
864
889
  # A cap given that is NOT raised (equal or lower) is also an ordinary capped-reset with the counts
865
890
  # kept and the persisted cap kept (ratchet guard), so a forwarded flag cannot refund a budget.
866
- printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
891
+ printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
867
892
  run_tally "$R31" "$S31" init --max-seats 5
868
893
  assert_line "$OUT" "tally-init: $SL31 capped-reset" "capped main + a LOWER cap -> capped-reset, not a budget refund"
869
894
  assert_eq "9" "$(cf_get "$C31" seats)" "a lower cap on a capped main keeps the counts"
870
895
  assert_eq "12" "$(cf_get "$C31" cap_seats)" "a lower cap on a capped main keeps the persisted cap"
871
896
  # A latch on a different dimension holds the same way.
872
- printf 'seats=0\nci_cycles=6\nfix_rounds=0\nagent_rounds=0\ncap_seats=0\ncap_ci_cycles=5\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=ci_cycles\n' > "$C31"
897
+ printf 'seats=0\nci_cycles=6\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=0\ncap_ci_cycles=5\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=ci_cycles\n' > "$C31"
873
898
  run_tally "$R31" "$S31" init
874
899
  assert_line "$OUT" "tally-init: $SL31 continued capped=ci_cycles" "bare init on a main ledger capped on ci_cycles keeps that latch"
875
900
  # Idle for more than 24h, a capped main ledger stale-resets exactly like a capped feature-branch ledger.
876
- printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
901
+ printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
877
902
  touch -d '3 days ago' "$C31"
878
903
  run_tally "$R31" "$S31" init
879
904
  assert_line "$OUT" "tally-init: $SL31 stale-reset" "capped + idle >24h + bare init on main -> stale-reset (as on any branch)"
880
905
  assert_eq "" "$(cf_get "$C31" capped)" "stale-reset clears the latch after 24h idle"
881
- printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
906
+ printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
882
907
  # The gate still stops on that ledger: the whole point of the latch.
883
908
  run_tally "$R31" "$S31" gate seats
884
909
  assert_contains "$OUT" "STOP" "gate on a capped main ledger still returns STOP after a bare init"
@@ -950,7 +975,7 @@ assert_eq "1" "$(printf '%s\n' "$SHOW_MAIN" | grep -c '^note:')" "exactly one no
950
975
  assert_eq "$DB_NOTE" "$(printf '%s\n' "$SHOW_MAIN" | tail -1)" "the note is the LAST line of show"
951
976
  assert_not_contains "$SHOW_FEAT" "note:" "show on a feature branch has no note"
952
977
  assert_eq "$(printf '%s\n' "$SHOW_FEAT" | grep '^tally:')" "$(printf '%s\n' "$SHOW_MAIN" | grep '^tally:')" "tally: line is byte-identical to a feature ledger with the same counts"
953
- assert_eq "tally: seats=3 ci_cycles=0 fix_rounds=0 agent_rounds=2" "$(printf '%s\n' "$SHOW_MAIN" | sed -n 1p)" "tally: line format unchanged and first"
978
+ assert_eq "tally: seats=3 ci_cycles=0 fix_rounds=0 agent_rounds=2 ci_wall_s=unmeasured" "$(printf '%s\n' "$SHOW_MAIN" | sed -n 1p)" "tally: line format unchanged and first"
954
979
  assert_eq "$(printf '%s\n' "$SHOW_FEAT" | grep '^cap:')" "$(printf '%s\n' "$SHOW_MAIN" | grep '^cap:')" "cap: token line is unchanged"
955
980
  # Capped main ledger: note must follow the capped: annotation line.
956
981
  C34=$(cf_path_for "$S34" main)
@@ -968,7 +993,7 @@ fi
968
993
  # The note line must match none of them, so the hook's parse of a main ledger
969
994
  # is identical with and without it.
970
995
  NOTE_LINE=$(printf '%s\n' "$OUT" | grep '^note:')
971
- HOOK_HITS=$(printf '%s\n' "$NOTE_LINE" | grep -oE 'capped:[a-z_]*=[0-9]*|cap:[a-z_]*=[0-9]*|^tally:.*|(seats|ci_cycles|fix_rounds|agent_rounds)=[0-9]+' || true)
996
+ HOOK_HITS=$(printf '%s\n' "$NOTE_LINE" | grep -oE 'capped:[a-z_]*=[0-9]*|cap:[a-z_]*=[0-9]*|^tally:.*|(seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s)=[0-9]+' || true)
972
997
  assert_eq "" "$HOOK_HITS" "the note line matches none of stop-hook.sh's grep -o patterns"
973
998
  HOOK_CAPPED=$(printf '%s' "$OUT" | grep -o 'capped:[a-z_]*=[0-9]*' | cut -d: -f2 | cut -d= -f1)
974
999
  HOOK_CAP=$(printf '%s' "$OUT" | grep -o 'cap:[a-z_]*=[0-9]*' | cut -d: -f2 | cut -d= -f1)
@@ -976,9 +1001,119 @@ assert_eq "seats" "$HOOK_CAPPED" "hook's capped: extraction still yields seats w
976
1001
  assert_eq "seats" "$HOOK_CAP" "hook's cap: extraction still yields seats with the note present"
977
1002
  echo ""
978
1003
 
1004
+ # --- Test 35: ci_wall_s — fifth-dimension parity + the unmeasured marker --------
1005
+ # #11775: ci_wall_s counts measured CI wall-clock seconds that callers post per
1006
+ # driven run (ship's per-push CI). Full dim parity — incr, the ci-wall-s alias,
1007
+ # gate WARN/STOP/capped latch, --max-ci-wall-s (+ --max-ci_wall_s), warned_*,
1008
+ # and the render surfaces. A count of 0 renders `ci_wall_s=unmeasured` on every
1009
+ # tally: line (an explicit ABSENT marker — never `ci_wall_s=0`, which would
1010
+ # fabricate a measured value); a positive count renders `ci_wall_s=N`.
1011
+ echo "Test 35: ci_wall_s — incr/gate/cap parity, hyphen alias, unmeasured marker, old schema"
1012
+ R35=$(new_repo r35); S35="$TMP/s35"; C35=$(cf_path "$S35")
1013
+
1014
+ # Absent marker: a zero count renders `unmeasured` on every render surface —
1015
+ # never `ci_wall_s=0` (a fabricated zero masquerades as a measured run).
1016
+ run_tally "$R35" "$S35" init
1017
+ run_tally "$R35" "$S35" show
1018
+ assert_eq "tally: seats=0 ci_cycles=0 fix_rounds=0 agent_rounds=0 ci_wall_s=unmeasured" "$OUT" \
1019
+ "count 0 renders ci_wall_s=unmeasured on show's tally: line"
1020
+ assert_not_contains "$OUT" "ci_wall_s=0" "the absent marker is never a fabricated ci_wall_s=0"
1021
+ run_tally "$R35" "$S35" incr seats
1022
+ assert_contains "$OUT" "ci_wall_s=unmeasured" "incr's tally: line renders the absent marker too"
1023
+
1024
+ # incr + positive render + the ci-wall-s hyphen alias.
1025
+ run_tally "$R35" "$S35" incr ci_wall_s 90
1026
+ assert_contains "$OUT" "ci_wall_s=90" "incr ci_wall_s prints the positive count"
1027
+ assert_eq "90" "$(cf_get "$C35" ci_wall_s)" "ci_wall_s persisted to the ledger"
1028
+ run_tally "$R35" "$S35" incr ci-wall-s 30
1029
+ assert_eq "120" "$(cf_get "$C35" ci_wall_s)" "ci-wall-s alias lands on ci_wall_s"
1030
+ run_tally "$R35" "$S35" show
1031
+ assert_contains "$OUT" "ci_wall_s=120" "a positive count renders ci_wall_s=N"
1032
+ assert_not_contains "$OUT" "unmeasured" "a measured count drops the absent marker"
1033
+
1034
+ # gate parity: WARN band, STOP latch, cap/warned/capped tokens.
1035
+ R35b=$(new_repo r35b); S35b="$TMP/s35b"; C35b=$(cf_path "$S35b")
1036
+ run_tally "$R35b" "$S35b" init --max-ci-wall-s 100
1037
+ assert_eq "100" "$(cf_get "$C35b" cap_ci_wall_s)" "--max-ci-wall-s persists as cap_ci_wall_s"
1038
+ run_tally "$R35b" "$S35b" init --max-ci_wall_s 120 # underscore alias raises the cap
1039
+ assert_eq "120" "$(cf_get "$C35b" cap_ci_wall_s)" "--max-ci_wall_s aliases --max-ci-wall-s"
1040
+ run_tally "$R35b" "$S35b" gate ci-wall-s
1041
+ assert_eq "OK" "$OUT" "gate on the hyphen alias -> OK under cap"
1042
+ run_tally "$R35b" "$S35b" incr ci_wall_s 96 # 96 >= ceil(120*0.8)=96: warn boundary
1043
+ run_tally "$R35b" "$S35b" gate ci_wall_s
1044
+ assert_eq "WARN" "$OUT" "count at the 80% boundary -> WARN"
1045
+ assert_eq "96" "$(cf_get "$C35b" warned_ci_wall_s)" "warned_ci_wall_s records the at-count"
1046
+ run_tally "$R35b" "$S35b" incr ci_wall_s 30 # 126 >= cap 120
1047
+ run_tally "$R35b" "$S35b" gate ci_wall_s
1048
+ assert_eq "STOP" "$OUT" "count >= cap -> STOP"
1049
+ assert_eq "ci_wall_s" "$(cf_get "$C35b" capped)" "STOP latches capped=ci_wall_s (dim vocabulary)"
1050
+ run_tally "$R35b" "$S35b" show
1051
+ assert_contains "$OUT" "capped:ci_wall_s=120" "show annotates capped:ci_wall_s=<cap>"
1052
+ run_tally "$R35b" "$S35b" gate seats
1053
+ assert_eq "STOP" "$OUT" "a ci_wall_s latch STOPs every dim's gate"
1054
+
1055
+ # Seeded-latch arm: `capped=ci_wall_s` in the ledger is in-vocabulary, not corrupt.
1056
+ R35c=$(new_repo r35c); S35c="$TMP/s35c"; C35c=$(cf_path "$S35c")
1057
+ assert_fixture_dir "$C35c"
1058
+ mkdir -p "$(dirname "$C35c")"
1059
+ cat > "$C35c" <<EOF
1060
+ seats=0
1061
+ ci_cycles=0
1062
+ fix_rounds=0
1063
+ agent_rounds=0
1064
+ ci_wall_s=999
1065
+ cap_seats=0
1066
+ cap_ci_cycles=0
1067
+ cap_fix_rounds=0
1068
+ cap_agent_rounds=0
1069
+ cap_ci_wall_s=300
1070
+ warned_seats=0
1071
+ warned_ci_cycles=0
1072
+ warned_fix_rounds=0
1073
+ warned_agent_rounds=0
1074
+ warned_ci_wall_s=0
1075
+ capped=ci_wall_s
1076
+ EOF
1077
+ run_tally "$R35c" "$S35c" gate seats
1078
+ assert_eq "STOP" "$OUT" "a seeded capped=ci_wall_s latch STOPs a foreign-dim gate"
1079
+ run_tally "$R35c" "$S35c" show
1080
+ assert_contains "$OUT" "ci_wall_s=999" "a latched ledger still renders its positive count"
1081
+ assert_contains "$OUT" "cap:ci_wall_s=300" "the cap:ci_wall_s=<n> token renders"
1082
+
1083
+ # Old-schema arm: a pre-#11775 ledger has NO ci_wall_s keys — reads default the
1084
+ # dim to 0 (absent marker), and the next write upgrades the schema in place.
1085
+ R35d=$(new_repo r35d); S35d="$TMP/s35d"; C35d=$(cf_path "$S35d")
1086
+ assert_fixture_dir "$C35d"
1087
+ mkdir -p "$(dirname "$C35d")"
1088
+ cat > "$C35d" <<EOF
1089
+ seats=3
1090
+ ci_cycles=2
1091
+ fix_rounds=0
1092
+ agent_rounds=1
1093
+ cap_seats=0
1094
+ cap_ci_cycles=0
1095
+ cap_fix_rounds=0
1096
+ cap_agent_rounds=0
1097
+ warned_seats=0
1098
+ warned_ci_cycles=0
1099
+ warned_fix_rounds=0
1100
+ warned_agent_rounds=0
1101
+ capped=
1102
+ EOF
1103
+ run_tally "$R35d" "$S35d" show
1104
+ assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=1 ci_wall_s=unmeasured" "$OUT" \
1105
+ "old-schema ledger (no ci_wall_s key) reads as 0 -> absent marker"
1106
+ run_tally "$R35d" "$S35d" incr ci_wall_s 60
1107
+ assert_contains "$OUT" "ci_wall_s=60" "an old-schema ledger accepts the first measured incr"
1108
+ assert_eq "60" "$(cf_get "$C35d" ci_wall_s)" "the write upgrades the schema with ci_wall_s=60"
1109
+ run_tally "$R35d" "$S35d" show
1110
+ assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=1 ci_wall_s=60" "$OUT" \
1111
+ "post-write render carries the measured count"
1112
+ echo ""
1113
+
979
1114
  # --- Summary -------------------------------------------------------------------
980
- # Anti-vacuity floor: 253 assertions pass on a full run (flock and orphan arms
1115
+ # Anti-vacuity floor: 288 assertions pass on a full run (flock and orphan arms
981
1116
  # may each skip ~4-5 on hosts lacking flock or with a live orphan root), so the
982
1117
  # floor sits 2 below that. Derive it from a green run, never from the number you
983
1118
  # expected, and raise it in the same edit that adds an assertion.
984
- print_results 251
1119
+ print_results 286
@@ -1728,6 +1728,8 @@ Abort Phase 6 if rc != 0. The gate mirrors reproducible CI: fast required jobs,
1728
1728
 
1729
1729
  **Pipeline tally gate — BEFORE pushing (#9403):** `bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init` (standalone ship writes no ledger otherwise), `gate ci_cycles` — `STOP` → `budget-capped` session-state write per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) and exit; `WARN`/`UNKNOWN` → continue; `incr ci_cycles` after a successful push.
1730
1730
 
1731
+ **`ci_wall_s` (#11775):** every `incr ci_cycles` site posts `incr ci_wall_s <s>` for that push's run once `completed` — recipe + `unmeasured` marker in the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md); skip when unreadable.
1732
+
1731
1733
  **Secret scan — BEFORE every `git push` (also 6.45, 6.5, 7):** `bash "${CLAUDE_PLUGIN_ROOT}/skills/ship/scripts/prepush-secret-scan.sh"; echo "SCAN_RC=$?"`, Bash `timeout: 400000` ([contract](./scripts/prepush-secret-scan.sh)); 43 is not an error. 0 continue; 43 append the printed `secret-scan:` line to the PR body (re-add after any body rewrite), continue; else STOP (44: show the operator the reason; 127: plugin root unset, see Cloud Mode). Headless FINDINGS/44: abort, never rewrite history or edit the gitleaks config.
1732
1734
 
1733
1735
  Push the branch to remote. Get the branch name first:
@@ -2009,6 +2011,7 @@ If it archives anything (`Archived N artifact(s)`), commit and push the move so
2009
2011
  ```bash
2010
2012
  # Phase 6 secret scan first
2011
2013
  git add -A knowledge-base && git commit -m "chore(kb): archive <branch> artifacts at ship" && git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
2014
+ # + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
2012
2015
  ```
2013
2016
 
2014
2017
  — but check `git status` first: `git add -A knowledge-base` sweeps dirty KB files into the commit; stage deliberately when the tree carries unrelated edits.
@@ -2124,6 +2127,7 @@ retired both the driver and AC17.)
2124
2127
  # Phase 6 secret scan first
2125
2128
  bash "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-regenerable-conflicts.sh" origin/main && git push \
2126
2129
  && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
2130
+ # + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
2127
2131
  ```
2128
2132
 
2129
2133
  2. Identify conflicted files:
@@ -2151,6 +2155,7 @@ retired both the driver and AC17.)
2151
2155
  ```bash
2152
2156
  # Phase 6 secret scan first
2153
2157
  git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
2158
+ # + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
2154
2159
  gh pr view --json mergeable | jq '.mergeable'
2155
2160
  ```
2156
2161
 
@@ -2452,6 +2457,7 @@ while true; do
2452
2457
  0) echo "$(date +%H:%M:%S) [${i}/${MAX_POLL_MIN}] auto-sync ${behind_syncs} pushed — auto-merge will re-evaluate"
2453
2458
  behind_pushes=$((behind_pushes+1))
2454
2459
  bash "$SYNC_ROOT/scripts/pipeline-tally.sh" incr ci_cycles || true
2460
+ # ci_wall_s posted at the Tally re-render below (Phase-6 recipe; skip unreadable)
2455
2461
  (( behind_pushes == 2 )) && echo "$(date +%H:%M:%S) [${i}/${MAX_POLL_MIN}] [ship.phase7.hatch_check] 2 BEHIND syncs pushed — read ${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md now; it classifies eligibility (else keep polling)"
2456
2462
  # Re-fetch now: GitHub may already be CLEAN → MERGED after the sync.
2457
2463
  s=$(gh pr view "$PR" --json state,mergeStateStatus \
@@ -2492,13 +2498,13 @@ done
2492
2498
  # <!-- phase-7-poll-block:end -->
2493
2499
  ```
2494
2500
 
2495
- **Tally re-render (#9403):** if the poll pushed syncs or halted on a `ci_cycles` STOP, re-render `## Pipeline Tally` + `Pipeline-Tally:` via `gh pr edit` per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) — Phase 6's body predates Phase-7 cycles; `SOLEUR_TALLY_CAP_IGNORED` is reachable only here.
2501
+ **Tally re-render (#9403):** if the poll pushed syncs or halted on a `ci_cycles` STOP, first post `incr ci_wall_s <s>` for each completed sync run (Phase-6 recipe; skip unreadable), then re-render `## Pipeline Tally` + `Pipeline-Tally:` via `gh pr edit` per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) — Phase 6's body predates Phase-7 cycles; `SOLEUR_TALLY_CAP_IGNORED` is reachable only here.
2496
2502
 
2497
- **A Monitor must never HOST the work it watches — launch the work detached and let the watch only READ its completion artifact.** Every Monitor is killed at `timeout_ms` (30 min max), so a long run placed in the Monitor's own command dies when the watch expires, five minutes from done and with no verdict. It does not look like a timeout: you get no rc file, no suites-passed marker and a vanished runner — the documented *reap* signature, which is UNRESOLVED and must never be read as a result. Launch with `setsid nohup <script> &`, write the rc to a file as the script's last act, and have the Monitor poll for that file; the same run then survives an expiry and you re-arm freely. **Why:** #8233 — a 35-minute `TEST_GROUP=all` battery run as the Monitor's command was reaped at 30 minutes; relaunched detached, it completed. See [2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md](../../../../knowledge-base/project/learnings/2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md).
2503
+ **A Monitor must never HOST the work it watches — launch the work detached and let the watch only READ its completion artifact.** A long run placed in the Monitor's own command dies when the watch expires (`timeout_ms`, 30 min max): no rc file, no marker, a vanished runner — the documented *reap* signature, UNRESOLVED, never a result. Launch detached (`setsid nohup <script> &`, rc written as the script's last act) and the run survives an expiry. **Why:** #8233 — a 35-minute battery run as the Monitor's command was reaped at 30 minutes; relaunched detached, it completed. See [2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md](../../../../knowledge-base/project/learnings/2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md).
2498
2504
 
2499
- **A poll whose population can SHRINK needs a floor, and must require the run it waits for to be PRESENT.** `pending == 0` is satisfied perfectly by an empty set, so a query that silently stops returning the runs you care about reports ALL-SETTLED having examined nothing — the same vacuity a bounded floor exists to refuse. Record the largest population seen and refuse to settle below it; separately, require the specific run you are waiting for (the deploy arm, the release job) to be present, not merely non-failing.
2505
+ **A poll whose population can SHRINK needs a floor, and must require the run it waits for to be PRESENT.** `pending == 0` is satisfied by an empty set — a query that stops returning your runs reports ALL-SETTLED having examined nothing. Record the largest population seen, refuse to settle below it, and require the run you wait for (deploy arm, release job) to be present, not merely non-failing.
2500
2506
 
2501
- **The cause is almost always `--limit` truncation, not the branch filter — CORRECTED 2026-09-17 after measurement.** An earlier revision of this rule blamed `--branch main --commit <sha>` and prescribed dropping `--branch`. That mechanism is FALSE and the remedy is a no-op: measured on two `main` commits, `gh run list --branch main --commit <sha>` and `gh run list --commit <sha>` return **identical** counts (58/58 and 0/0), and every run on those commits carries `headBranch: main` — **including the `push` runs** — so the branch filter cannot selectively drop push runs while retaining `issues` runs. What actually happens is `gh run list` returning newest-first under a `--limit`: on a busy commit the release runs are crowded off the end by unrelated `issues`/`issue_comment` traffic, which on an agent-driven repo is frequently the agent's OWN issue filings. Measured: `--limit 100` returned `push=0` where `--limit 300` returned `push=8` out of 131 runs. Raise the limit, paginate, or filter server-side by `--event push` / `--event workflow_run`; dropping `--branch` while keeping the limit rebuilds the identical watcher. **Why:** #8233 — a release watch reported 10 release runs then 0, one poll short of declaring a deploy settled over nothing.
2507
+ **The cause is almost always `--limit` truncation, not the branch filter — CORRECTED 2026-09-17 after measurement.** An earlier revision blamed `--branch main --commit <sha>` and prescribed dropping `--branch` — FALSE mechanism, no-op remedy: `gh run list` with and without `--branch` returned identical counts on two `main` commits (every run, `push` included, carries `headBranch: main`). What actually happens: newest-first ordering under a `--limit`, so on a busy commit the release runs are crowded off the end by unrelated `issues`/`issue_comment` traffic (measured: `--limit 100` → `push=0`, `--limit 300` → `push=8` of 131). Raise the limit, paginate, or filter `--event push` / `--event workflow_run`; dropping `--branch` under the same limit rebuilds the identical watcher. **Why:** #8233 — a release watch reported 10 release runs then 0, one poll short of declaring a deploy settled over nothing.
2502
2508
 
2503
2509
  **Run every POST-merge Monitor with its shell in a detached `origin/main` worktree (step 2 of the merge → deploy protocol above) or `/var/tmp`, never `cd`'d into the feature worktree.** The pre-merge Phase 7 poll above is the exception: its BEHIND arm pushes the checked-out PR branch, so it runs from the PR worktree (from a detached HEAD it reports `kind=detached_head` and stops). After the merge any session's `cleanup-merged` can reap that worktree, and a monitor `cd`'d into it dies with `fatal: Unable to read current working directory`. **Why:** #8136 — the #8074 release watch died this way while the release was red.
2504
2510
 
@@ -2519,7 +2525,7 @@ The sync is capped at `MAX_BEHIND_SYNCS=6` per poll, so a pathological BEHIND→
2519
2525
  **CI-run diagnosis:** derive the run id from the failing check name, then read jobs + steps via `gh api --paginate` — [ci-run-diagnosis.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ci-run-diagnosis.md). `--paginate` is load-bearing (`gh api` does NOT auto-paginate; a >30-job run returns a truncated, false-clean set). Both commands work while the run is still in progress, but **an in-progress snapshot is not a verdict** — classify only once the run reaches `completed`. Then:
2520
2526
 
2521
2527
  - **Default: treat it as a real red.** Exit and diagnose. Everything below is a narrow exception to this, and anything you cannot confidently place is a red.
2522
- - The one exception: a failure **fetching a third-party artifact from the network**, where the failing step's own output is an HTTP error, a connection reset, or a checksum mismatch on a JUST-DOWNLOADED archive — **and only when the diff does not touch that pin**. Rerun once (`gh run rerun <run-id> --failed`; it operates on completed runs, so wait for the run to finish first; a rerun drives a fresh CI cycle — `incr ci_cycles` on it too), then **re-enter the poll loop at the top** — the loop has already exited by this point, so "continue polling" means restarting it, not resuming the tick that exited.
2528
+ - The one exception: a failure **fetching a third-party artifact from the network**, where the failing step's own output is an HTTP error, a connection reset, or a checksum mismatch on a JUST-DOWNLOADED archive — **and only when the diff does not touch that pin**. Rerun once (`gh run rerun <run-id> --failed`; it operates on completed runs, so wait for the run to finish first; a rerun drives a fresh CI cycle — `incr ci_cycles` on it too, plus `incr ci_wall_s <s>` — Phase-6 recipe; skip unreadable), then **re-enter the poll loop at the top** — the loop has already exited by this point, so "continue polling" means restarting it, not resuming the tick that exited.
2523
2529
  - **A dependency install is NOT in that exception, whatever the step is called.** Read the failing step's COMMAND: if it is `bun install`, `npm ci`, `npm install`, `yarn install`, or `pnpm install`, it is lockfile drift — a red your diff caused (`cq-before-pushing-package-json-changes`). So is a `sha256sum -c` mismatch when the PR bumps that pin. Rerunning those wastes two cycles and then reports a code failure to the operator as an infrastructure outage, steering them away from the diff that caused it.
2524
2530
  - If the same step fails again after one rerun, stop and diagnose — do not keep rerunning, and do not assert "infrastructure" unless the failing output actually shows a network/HTTP error.
2525
2531
 
@@ -2566,6 +2572,7 @@ The agent maintains a `fix_attempt_count` counter (agent-level state, not a bash
2566
2572
  ```bash
2567
2573
  # Phase 6 secret scan first
2568
2574
  git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
2575
+ # + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
2569
2576
  gh pr merge <number> --squash --auto
2570
2577
  ```
2571
2578
 
@@ -8,19 +8,28 @@ Phase 6 reads the run's ledger before writing the PR body:
8
8
  `bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" show`. Render `## Pipeline Tally`
9
9
  before `## Changelog` in BOTH body templates, per these rules (in order):
10
10
 
11
- - **Ledger present, counts > 0:** one `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N`
12
- line; a glossary line (`seats = reviewer agents spawned`); any `warned:<dim>=<at>` /
11
+ - **Ledger present, counts > 0:** one `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N ci_wall_s=W`
12
+ line, copied verbatim from `show`'s output; a glossary line (`seats = reviewer agents spawned`); any `warned:<dim>=<at>` /
13
13
  `capped:<dim>` events from `show`'s annotation line; cap usage as `N of cap <dim>`
14
14
  fractions for each `cap_<dim>` set. Then the machine line on its own line:
15
- `Pipeline-Tally: seats=N; ci_cycles=N; fix_rounds=N; agent_rounds=N` — it is the
15
+ `Pipeline-Tally: seats=N; ci_cycles=N; fix_rounds=N; agent_rounds=N; ci_wall_s=W` — it is the
16
16
  cross-PR aggregation surface (squash merge drops commit trailers, so counts live in
17
- the body, never a git trailer).
17
+ the body, never a git trailer). `ci_wall_s` is the run's measured CI wall-clock
18
+ seconds (#11775): a positive count renders `ci_wall_s=N`; a count of 0 renders
19
+ the declared absent marker `ci_wall_s=unmeasured` — NEVER `ci_wall_s=0`, which
20
+ would fabricate a measured zero for a run that posted nothing. `show` already
21
+ emits the marker on its `tally:` line, so the verbatim copy carries it; the
22
+ machine line applies the same rule. This is the per-dimension absence,
23
+ distinct from `SOLEUR_TALLY_ABSENT` (whole-ledger absent, below), and the
24
+ number is a floor: cycles whose timing never resolved contribute nothing.
18
25
  - **`show` prints a `note:default-branch-ledger` line** (the ledger is keyed to `main`/`master`, shared
19
26
  across sessions): the counts are NOT this run's cost. Render them with the words
20
27
  `shared default-branch ledger, not attributable to this run`, or render `SOLEUR_TALLY_ABSENT`
21
28
  when a per-run figure is required. Never copy them into `Pipeline-Tally:` as one run's cost.
22
29
  - **Ledger present, all counters 0:** `tally: 0 — no counted operations`
23
- (instrumented-but-unused is a real state, not an absence).
30
+ (instrumented-but-unused is a real state, not an absence). All five dims at 0
31
+ — the `ci_wall_s=unmeasured` marker is subsumed by the whole-line form here;
32
+ it matters when other counts are nonzero but no wall was ever measured.
24
33
  - **Ledger absent / `show` prints UNKNOWN:** the literal line `SOLEUR_TALLY_ABSENT` —
25
34
  never render a zero tally for an instrumented run that never wrote.
26
35
  - **Ledger carries `capped=<dim>` but the run shipped anyway:** additionally emit
@@ -32,12 +41,37 @@ before `## Changelog` in BOTH body templates, per these rules (in order):
32
41
  - **`gate`/`show` returned UNKNOWN while caps were configured:** note `cap-unenforced` —
33
42
  caps were set but the substrate couldn't enforce them (e.g. no flock on macOS).
34
43
  - **Phase-7 re-render:** the Phase-6 render predates every merge-loop
35
- `incr ci_cycles`. If the auto-sync arm pushed any syncs or halted on a gate
36
- STOP, re-run `show` and `gh pr edit` the body again — otherwise Phase-7
44
+ `incr ci_cycles` and every `incr ci_wall_s` post for the pushed syncs'
45
+ measured runs. If the auto-sync arm pushed any syncs or halted on a gate
46
+ STOP, post each completed pushed run's measured wall, then re-run `show`
47
+ and `gh pr edit` the body again — otherwise Phase-7
37
48
  cycles never reach the `Pipeline-Tally:` machine line and a mid-loop cap
38
49
  breach never emits `SOLEUR_TALLY_CAP_IGNORED`.
39
50
  - **No dollars, ever.** Counts and counts only — units, not currency (ADR-056).
40
51
 
52
+ **The `ci_wall_s` measurement recipe (#11775)** — what every `incr ci_cycles`
53
+ call site posts once the run that push produced reaches `completed` (the wall
54
+ does not exist at push time). Measure from run timing, never a hand estimate:
55
+
56
+ ```bash
57
+ RUN_ID=$(gh api --paginate "repos/{owner}/{repo}/actions/runs?head_sha=$(git rev-parse HEAD)" \
58
+ --jq '[.workflow_runs[] | select(.name == "CI" and .status == "completed") | .id] | max' \
59
+ 2>/dev/null || true)
60
+ WALL=""
61
+ [[ "$RUN_ID" =~ ^[0-9]+$ ]] \
62
+ && WALL=$(gh run view "$RUN_ID" --json startedAt,updatedAt \
63
+ --jq '(.updatedAt | fromdateiso8601) - (.startedAt | fromdateiso8601)' 2>/dev/null || true)
64
+ [[ "$WALL" =~ ^[0-9]+$ && "$WALL" -gt 0 ]] \
65
+ && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_wall_s "$WALL" || true
66
+ ```
67
+
68
+ When `startedAt`/`updatedAt` do not resolve (queued-then-cancelled, an API
69
+ gap), fall back to the per-job span on the same run:
70
+ `gh api --paginate "repos/{owner}/{repo}/actions/runs/<id>/jobs" --jq '([.jobs[].completed_at | fromdateiso8601] | max) - ([.jobs[].started_at | fromdateiso8601] | min)'`.
71
+ An unreadable or null result SKIPS the incr — never post a fabricated 0. `max`
72
+ on the run id picks the newest completed `CI` run on the pushed head; after a
73
+ `gh run rerun`, measure the rerun's own window, not the first attempt's.
74
+
41
75
  **The classified-stop artifact** (what a `STOP` verdict writes): append
42
76
  `status: budget-capped`, `budget-capped: <dim>=<count>/<cap>` and a `resume:` line
43
77
  to `knowledge-base/project/specs/<feature>/session-state.md`, then exit the skill —
@@ -1476,3 +1476,4 @@ See [references/key-principles.md](${CLAUDE_PLUGIN_ROOT}/skills/work/references/
1476
1476
  - **Relaunching a long-running background bash before verifying it died** - Do NOT relaunch until ALL three checks confirm death: (1) broad `ps -ef \| grep -E '<substring>' \| grep -v grep` (never `pgrep -fa 'pattern$'` — anchored patterns miss `doppler run -- bash` wrappers), (2) output size stopped growing over 30+ s, (3) the harness `<task-notification>` fired with a definitive `status`. Log `mtime` is NOT liveness — scripts buffer output. **Why:** PR #4156 — anchored `pgrep` + stale mtime launched a second bench (~$3 wasted). See `knowledge-base/project/learnings/workflow-issues/2026-05-20-long-running-bench-verify-process-before-relaunch.md`. **The inverse is as costly: STOPPING one means killing the tree, not the PIDs you launched.** `run-registered-suites.sh` fans out via `xargs -P 6`, so killing its wrapper and runner leaves the workers orphaned and running — measured 46 min still spawning containers. Resolve the root's descendants (`pstree -p <root>`), confirm each `/proc/<pid>/cwd` is YOUR worktree before killing, and re-probe afterwards — an unverified kill was never made. **A killed `test-all.sh` leaves its `flock -w 3600` lock waiter alive** — the orphaned `flock` holds a `lefthook` pre-commit open until killed; enumerate every process whose `/proc/<pid>/cwd` is the worktree, not only runner names (#7941/PR #8070).
1477
1477
  - **Capture `git commit`'s rc on the very next line — a trailing command owns the call's exit status.** `git commit …; git log --oneline -1` in one background call reports exit 0 when lefthook REJECTED the commit, and the log line (showing the previous commit) reads as success. Write `git commit …; echo "COMMIT_RC=$?"` and read that line, then confirm HEAD moved. **Why:** #8474 — a failed gate (`🥊 bun-test`, 471/477) went unnoticed until the next step found the changes still staged. See `knowledge-base/project/learnings/2026-09-21-every-gate-this-pr-added-failed-open-on-the-input-it-could-not-measure.md`.
1478
1478
  - **A diff adding or renaming members an existing derived artifact enumerates owes the FULL regen sweep — the plan's list is a hypothesis, not the set.** Run every regenerator the touched paths can invalidate (regenerate-*, sync-*-counts, *baseline* scripts) — N reds on M surfaces is ONE gap. **Why:** #10404/PR #10744 — three committed-state reds from one incomplete sweep (0400ffe62a). See `knowledge-base/project/learnings/2026-10-21-one-regen-gap-three-committed-state-reds.md`.
1479
+ - **`accept.tsv` col 5 must start `false-positive: ` — one malformed row drops EVERY exemption.** <!-- markdownlint-disable-line MD038 --> After writing rows run `audit --accept` (rc 2 names the row); on a pair balloon grep `stale-accept` first; re-verify after each rebase. **Why:** #11958 — 27 bad prefixes flooded 330 false pairs. See `knowledge-base/project/learnings/test-failures/2026-11-03-one-malformed-accept-row-reason-drops-every-exemption.md`.