checkwright 0.24.0 → 0.25.0
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/README.md +3 -3
- package/package.json +2 -2
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/canon-kit/README.md +2 -0
- package/payload/canon-kit/SPEC.md +329 -15
- package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
- package/payload/canon-kit/checks/check-unmarked-claim.gate +3 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +11 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +3 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +6 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +18 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +6 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +85 -0
- package/payload/canon-kit/lib/spec.sh +16 -0
- package/payload/canon-kit/smoke/install.sh +2 -0
- package/payload/canon-kit/templates/SPEC-amendment.md +17 -2
- package/payload/context-kit/SPEC.md +16 -5
- package/payload/delegation-kit/README.md +11 -1
- package/payload/delegation-kit/SPEC.md +392 -26
- package/payload/delegation-kit/bin/wait-probe.sh +184 -0
- package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +99 -0
- package/payload/delegation-kit/smoke/install.sh +20 -0
- package/payload/delegation-kit/templates/agent-execution.md +26 -9
- package/payload/delegation-kit/templates/subagent-stop-liveness.sh +56 -0
- package/payload/gate-sdk/README.md +7 -2
- package/payload/gate-sdk/SPEC.md +800 -66
- package/payload/gate-sdk/bin/build-native.sh +66 -1
- package/payload/gate-sdk/bin/run-gates.sh +136 -34
- package/payload/gate-sdk/checks/check-action-run-shell.sh +1 -1
- package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +55 -2
- package/payload/gate-sdk/checks/check-tree-terms.gate +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +27 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +94 -0
- package/payload/gate-sdk/smoke/install.sh +23 -0
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +409 -57
- package/payload/guard-kit/bin/compare-settings-allow.sh +36 -12
- package/payload/guard-kit/bin/run-guard-tests.sh +22 -4
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +46 -1
- package/payload/guard-kit/guard-tests/background-cases.tsv +14 -0
- package/payload/guard-kit/guard-tests/cases.tsv +41 -11
- package/payload/guard-kit/lib/guard.sh +213 -34
- package/payload/guard-kit/templates/bash-guard.sh +2 -0
- package/payload/guard-kit/templates/close-triage.md +10 -3
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/SPEC.md +2 -2
- package/payload/lifecycle-kit/templates/lead.md +8 -0
- package/payload/queue-kit/SPEC.md +78 -0
- package/payload/site-kit/SPEC.md +12 -0
- package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -149
- package/payload/gate-sdk/checks/check-tree-terms.sh +0 -67
|
@@ -217,26 +217,28 @@ this rule keeps re-earning.** The enforcement holds only for **a session that
|
|
|
217
217
|
recorded**. The paragraph above rules that the record's write is structurally
|
|
218
218
|
uncheckable — a session that skips the rule writes nothing, so there is no
|
|
219
219
|
absence a check could have been told to expect — so a session that backgrounds
|
|
220
|
-
without recording is invisible to rule 14 and to the entry preflight alike
|
|
221
|
-
|
|
222
|
-
closing it.
|
|
223
|
-
|
|
224
|
-
**
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
220
|
+
without recording is invisible to rule 14 and to the entry preflight alike. It is
|
|
221
|
+
now **advised at the launch**, and still not refused. This narrows the failure to
|
|
222
|
+
that residue rather than closing it.
|
|
223
|
+
|
|
224
|
+
**The record's *write* is now reached at the launch chokepoint, and the refusal
|
|
225
|
+
that stood here is discharged.** The candidate was a rule firing on the
|
|
226
|
+
backgrounding call itself, held back on one empirical unknown: a shell `&` is in
|
|
227
|
+
the command text every rule already reads, but a harness's background-this
|
|
228
|
+
parameter is **tool input, not command text**, and whether it reaches the
|
|
229
|
+
`PreToolUse` payload was a question about one field. It does:
|
|
230
|
+
`.tool_input.run_in_background` is a JSON boolean `true` on a backgrounded Bash
|
|
231
|
+
call and absent on a foreground one (guard-kit/SPEC.md §The guard framework
|
|
232
|
+
records the payload's shape, so no session re-buys the probe). Both forms are
|
|
233
|
+
therefore reachable and **guard-kit rule 15 builds both arms in one rule**. The
|
|
234
|
+
judgment that held it back is kept rather than retired, because it is what made
|
|
235
|
+
the two-arm rule the right build rather than a bigger one: **building only the
|
|
236
|
+
`&` arm would have been worse than not building it** — every attested firing used
|
|
237
|
+
the harness form, so a rule covering only the shell spelling would have blocked
|
|
238
|
+
the form nobody uses and passed the one that fires, coverage in appearance and an
|
|
239
|
+
assertion about nothing in fact. What ships is an **advisory**, not a block, on
|
|
240
|
+
grounds guard-kit/SPEC.md §The generic ruleset states with the rule, and its
|
|
241
|
+
re-opening condition is named there.
|
|
240
242
|
|
|
241
243
|
**The guard interaction that produced it resolves without touching the guard.**
|
|
242
244
|
The attested sequence: a session reached for the correct artifact wait, spelled
|
|
@@ -449,6 +451,17 @@ either, so the distinguishing axis is not durability but interception:
|
|
|
449
451
|
> question is whether the act passes a **chokepoint** — not whether it reaches
|
|
450
452
|
> the tree. A dispatch does. A turn-end does not.
|
|
451
453
|
|
|
454
|
+
**That second sentence was a claim about the harness, and it has now been
|
|
455
|
+
measured.** A `SubagentStop` hook *is* a chokepoint at the turn-end, so it is the
|
|
456
|
+
one candidate that could falsify the axis — and the decisive question was whether
|
|
457
|
+
the harness already defers a subagent's stop while a background child is live,
|
|
458
|
+
since a harness that deferred would dissolve the class this rule exists for. The
|
|
459
|
+
logging-only probe at §The turn-end liveness probe (template) put a live producer
|
|
460
|
+
under a deliberate turn-end and read `live=yes`: **the stop is not deferred**. So
|
|
461
|
+
the sentence stands as written for the `PreToolUse` axis it was said on, the
|
|
462
|
+
relocation to guard-kit rule 14 stands, and the turn-end's own event is reachable
|
|
463
|
+
but buys enforcement only through a blocking hook nobody has authorized.
|
|
464
|
+
|
|
452
465
|
**The chokepoint — what a `PreToolUse` hook can actually read.** The payload
|
|
453
466
|
carries `session_id`, `prompt_id`, `transcript_path`, `cwd`, `permission_mode`,
|
|
454
467
|
`hook_event_name`, `tool_name`, `tool_input`, and `tool_use_id`; and, **only
|
|
@@ -714,10 +727,50 @@ sanction's cost is N carriers a later change must find, and N is discovered by
|
|
|
714
727
|
grepping the rule's phrasing rather than by consulting the roster — a roster is a
|
|
715
728
|
record of the carriers someone noticed, never a proof of the set.
|
|
716
729
|
|
|
730
|
+
**The rule's own attested counter-examples are now explained, and the explanation
|
|
731
|
+
indicted the wording rather than the primitive.** Four of one session's
|
|
732
|
+
backgrounded waiters had died before their conditions went true with their
|
|
733
|
+
producers verifiably alive, against an event-stream call that succeeded first try
|
|
734
|
+
— a standing case that the mandated primitive was the wrong one on this machine.
|
|
735
|
+
It was measured rather than argued (§bin/wait-probe): every trial on a
|
|
736
|
+
*completion-marker* predicate outlived its condition, on both harness forms and on
|
|
737
|
+
a detached shell child, at producer durations up to and including the longest
|
|
738
|
+
swept — so no form carries a wall-clock ceiling in that range. Every early exit
|
|
739
|
+
instead shared one property, and it was not the form: the loop tested the
|
|
740
|
+
producer's **liveness**, and it reproduced on the harness-uninvolved control in
|
|
741
|
+
milliseconds, which exonerates the harness and the primitive together.
|
|
742
|
+
|
|
743
|
+
**The cause is that the rule's two clauses compose into an inverted loop.** The
|
|
744
|
+
protocol mandates wrapping `until <cond>; do sleep N; done` *and* looping on the
|
|
745
|
+
recorded PID's liveness. `until` ends when its condition becomes **true** and
|
|
746
|
+
`kill -0` is true while the producer is **alive**, so the literal composition of
|
|
747
|
+
the two clauses exits at once, cleanly, with the producer running — which is
|
|
748
|
+
exactly the reported signature, down to the clean exit status. The wait's
|
|
749
|
+
condition must be its **continuation** condition: `until` takes a *done* predicate
|
|
750
|
+
and `while` takes a *still-running* one, and liveness is a still-running
|
|
751
|
+
predicate. So the ordering the template states stands **unchanged** and what
|
|
752
|
+
changed is the spelling every carrier shipped, propagated to all four. That the
|
|
753
|
+
correction is free at the guard was probed rather than assumed: rules 13 and 15
|
|
754
|
+
walk `do … done` spans without reading the loop keyword, so the `while` form is
|
|
755
|
+
exempt exactly as the `until` form is (guard-kit/SPEC.md §The generic ruleset).
|
|
756
|
+
|
|
757
|
+
**Recorded here because of what the near-miss was.** A rule whose attested
|
|
758
|
+
counter-examples stay unexplained is a rule its readers discount, and the
|
|
759
|
+
discounting was already under way — the counter-examples had been read as evidence
|
|
760
|
+
*against the primitive*, which would have inverted a correct ordering and left the
|
|
761
|
+
actual defect, one keyword, shipped in all four carriers. The fifth firing's own
|
|
762
|
+
lesson generalizes past this rule: an operative restatement propagates a rule's
|
|
763
|
+
**wording**, so a defect in the wording is propagated with it, and N carriers make
|
|
764
|
+
N copies of the bug rather than N chances to catch it.
|
|
765
|
+
|
|
717
766
|
**No gate is owed *over the act*, and not for budget — but one is now owed over
|
|
718
767
|
its harm, and it exists.** No check can read a session's choice to end a turn:
|
|
719
|
-
the act leaves no tracked artifact and
|
|
720
|
-
|
|
768
|
+
the act leaves no tracked artifact, and no `PreToolUse` chokepoint sees it. The
|
|
769
|
+
harness's own turn-end event does see it — measured, not assumed (§The turn-end
|
|
770
|
+
liveness probe (template)) — and seeing is not refusing: reading the act there
|
|
771
|
+
would take a blocking hook, which is a separate authorization and is not held. So
|
|
772
|
+
the relocation below is the enforcement, and it is that on the merits rather than
|
|
773
|
+
for want of an alternative. What the ruling never licensed was stopping there. The harm
|
|
721
774
|
the turn-end causes does pass a chokepoint — a tracked-tree mutation while a
|
|
722
775
|
recorded producer is still writing arrives as an ordinary tool call — and it is
|
|
723
776
|
blocked there by guard-kit rule 14 (guard-kit/SPEC.md §The generic ruleset,
|
|
@@ -751,20 +804,197 @@ substitute for it.
|
|
|
751
804
|
are not each other's contradiction.** The dispatch-shape rules bind acts
|
|
752
805
|
that leave no tracked artifact either, yet they are gated. The axis that
|
|
753
806
|
separates them is **interception, not durability**: a dispatch passes a
|
|
754
|
-
chokepoint the harness fires a hook on, and a turn-end passes none
|
|
755
|
-
delegation model, which owns the
|
|
807
|
+
chokepoint the harness fires a hook on, and a turn-end passes none the
|
|
808
|
+
dispatch-shape rules could have used (§The delegation model, which owns the
|
|
809
|
+
generalization, and §The turn-end liveness probe (template), which measured the
|
|
810
|
+
harness's own turn-end event and found it reachable). So "no tracked artifact" is
|
|
756
811
|
why neither rule gets a *gate* over the tree, and it is not by itself a reason
|
|
757
812
|
to stop looking for an oracle. Recorded here for the same reason §The
|
|
758
813
|
delegation model records the durability rule beside the read-only-fan-out
|
|
759
814
|
caveat: otherwise the next reader re-litigates one of the two paragraphs.
|
|
760
815
|
|
|
761
816
|
**That last sentence was cashed rather than left standing.** The search it
|
|
762
|
-
licensed found one: the turn-end is
|
|
763
|
-
enables is a `PreToolUse` call, and rule 14 fires there.
|
|
817
|
+
licensed found one: the turn-end is unreachable from the tool-call axis, but the
|
|
818
|
+
mutation it enables is a `PreToolUse` call, and rule 14 fires there. It then
|
|
819
|
+
found a second candidate on a different axis — the harness's own `SubagentStop`
|
|
820
|
+
event, which the probe above measured and found live. It is an oracle that
|
|
821
|
+
*observes* rather than one that refuses, and turning it into the second kind is a
|
|
822
|
+
separate authorization. Recorded because a
|
|
764
823
|
sentence saying *keep looking* is cheap to write and easy to leave un-acted, and
|
|
765
824
|
the next reader should find the outcome beside the licence rather than have to
|
|
766
825
|
reconstruct whether anyone ever looked.
|
|
767
826
|
|
|
827
|
+
## The turn-end liveness probe (template)
|
|
828
|
+
|
|
829
|
+
`templates/subagent-stop-liveness.sh` is an opt-in `SubagentStop` hook, inert
|
|
830
|
+
until a consumer registers it, that answers one question the section above
|
|
831
|
+
leaves open: **does the harness already defer a subagent's stop while a
|
|
832
|
+
background child is live?** If it does, the whole class §The delegation model's
|
|
833
|
+
waiting rule exists for dissolves; if it does not, the axis holds at the turn-end
|
|
834
|
+
too and a blocking hook is the only lever left. It is a **probe with a durable
|
|
835
|
+
artifact, not an enforcement mechanism** — its deliverable is an answer, and *a
|
|
836
|
+
capped refusal buys nothing* is one of the answers it is entitled to return.
|
|
837
|
+
|
|
838
|
+
**The event is `SubagentStop`, never `Stop`.** A dispatched session is a
|
|
839
|
+
subagent, so its turn end fires `SubagentStop`, and every attested firing of the
|
|
840
|
+
waiting rule was a dispatched session. `Stop` is deliberately not registered:
|
|
841
|
+
the main-session turn end has no attested firing, so registering it would widen
|
|
842
|
+
the subject past what the evidence carries.
|
|
843
|
+
|
|
844
|
+
**Logging-only, and the variant boundary is part of the contract.** The hook
|
|
845
|
+
reads its payload from stdin, asks the liveness reader whether any launch record
|
|
846
|
+
under `${GATE_SDK_TMP_DIR:-.tmp}` names a live producer, appends one line to
|
|
847
|
+
`DELEGATION_KIT_STOP_LOG`, and **exits 0 unconditionally, emitting no hook JSON
|
|
848
|
+
at all**. A hook that blocks is a **separate authorization** and nothing here
|
|
849
|
+
implies one.
|
|
850
|
+
|
|
851
|
+
**Emitting nothing is the design, and it is what makes this variant buildable.**
|
|
852
|
+
guard-kit's framework hardcodes `hookEventName:"PreToolUse"` in each of its three
|
|
853
|
+
emitters, so a hook that had to *speak* at `SubagentStop` would need a primitive
|
|
854
|
+
guard-kit does not have and whose event scope its SPEC never states. Speaking
|
|
855
|
+
nothing needs no emitter, so this template **does not source guard-kit's lib** —
|
|
856
|
+
which also keeps delegation-kit from acquiring a dependency on guard-kit being
|
|
857
|
+
vendored. The two payload fields it does read cost a `cat` and a `jq -r`; the
|
|
858
|
+
blocking variant's emitter cost is stacked on its own authorization rather than
|
|
859
|
+
paid here.
|
|
860
|
+
|
|
861
|
+
**It never wedges a turn.** Every failure path — an unreadable payload, an absent
|
|
862
|
+
`jq`, an absent or hung liveness reader, an unwritable log — exits 0, recording
|
|
863
|
+
the failure in the line where the line can be written and silently where it
|
|
864
|
+
cannot. The reader is invoked under `timeout` where one is available, because a
|
|
865
|
+
reader that hung would refuse the turn end by accident and that is the blocking
|
|
866
|
+
variant arrived at sideways.
|
|
867
|
+
|
|
868
|
+
**The liveness reading reuses `check-producer-liveness` and copies no grammar.**
|
|
869
|
+
§The delegation model rules that the reading affordance which would genuinely
|
|
870
|
+
earn its place already exists and is that gate; a hook re-implementing the
|
|
871
|
+
`pid=<n> run=<key>` parse and the PID predicate would be a third copy of a
|
|
872
|
+
grammar evidence-kit owns. So the hook invokes the reader in **set mode** over
|
|
873
|
+
the scratch dir — which already quantifies the per-record verdict and already
|
|
874
|
+
resolves *exit 2 wins over red wins over green* (evidence-kit/SPEC.md
|
|
875
|
+
§check-producer-liveness) — and maps its exit class onto `verdict` and `live`.
|
|
876
|
+
Nothing about how a PID's liveness is decided is seconded here.
|
|
877
|
+
|
|
878
|
+
**The prerequisite is stated, not assumed.** A consumer that wires this hook with
|
|
879
|
+
no reader resolvable at `DELEGATION_KIT_LIVENESS_CMD` — evidence-kit unvendored,
|
|
880
|
+
or the knob deliberately emptied — gets `verdict=unavailable` on every line and a
|
|
881
|
+
probe that answers nothing. That is honest degradation and it is preferable to a
|
|
882
|
+
silent third parse that would work everywhere and drift from its owner.
|
|
883
|
+
|
|
884
|
+
**One line per firing**, appended, space-delimited `key=value` after a leading
|
|
885
|
+
timestamp:
|
|
886
|
+
|
|
887
|
+
```
|
|
888
|
+
<UTC ISO-8601> event=<hook_event_name|-> session=<session_id|-> live=<yes|no> verdict=<green|red|corrupt|unavailable> records=<n> keys=<comma-separated top-level payload keys>
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
Every field has a reader at a named transition, and no field is carried that this
|
|
892
|
+
list does not name one for:
|
|
893
|
+
|
|
894
|
+
- **timestamp** — read by the close-stage reader to order firings and to tell a
|
|
895
|
+
fresh line from a stale one.
|
|
896
|
+
- **`event`** — the payload's own `hook_event_name`. Read at the **first** firing,
|
|
897
|
+
to confirm the event fires at all for a dispatched session and that it is
|
|
898
|
+
spelled `SubagentStop`. The entry's whole correction turned on the event's
|
|
899
|
+
identity, which is what earns it a field.
|
|
900
|
+
- **`session`** — the payload's `session_id`, `-` otherwise. Read to separate the
|
|
901
|
+
firings of one top-level session from another's in a shared log. **It is not the
|
|
902
|
+
subagent's own id**, and the first firings settled that against the field's
|
|
903
|
+
original reader: a dispatched agent and its dispatcher log the *same*
|
|
904
|
+
`session_id`, and neither matches the identifier a stage stamp carries, so
|
|
905
|
+
attributing a firing to a stage session is not a reading this field supports.
|
|
906
|
+
The payload's `agent_id` is the discriminator that would, and logging it is a
|
|
907
|
+
grammar change this variant did not take.
|
|
908
|
+
- **`live`** — `yes` exactly when the reader reported a live producer. **The
|
|
909
|
+
decisive field**; the honest limit below is what bounds how it may be read.
|
|
910
|
+
- **`verdict`**, **`records`** — the reader's exit class and the number of `*.run`
|
|
911
|
+
records under the scratch dir. Read together: `records=0` makes a `live=no`
|
|
912
|
+
uninformative, while `records=2 live=no` says records existed and their
|
|
913
|
+
producers had exited. `verdict=corrupt` carries `live=no` because the field is
|
|
914
|
+
two-valued — the pair is the reading, never `live` alone.
|
|
915
|
+
- **`keys`** — the payload's top-level key set, nothing more. Read **once**, at
|
|
916
|
+
the first firing, to settle what a `SubagentStop` payload carries without
|
|
917
|
+
asserting anything about it in advance. **It returned against the advance
|
|
918
|
+
claim**, which is the whole reason the field logs the set rather than assuming
|
|
919
|
+
it: the payload carries a top-level `background_tasks`, so the pre-wiring premise
|
|
920
|
+
that it names no background task was wrong, and only the key read caught it.
|
|
921
|
+
Values stay unlogged on the ground that survives that correction — logging them
|
|
922
|
+
would put transcript paths and prompt ids into a file for no reader — so what
|
|
923
|
+
`background_tasks` actually carries is **unsettled**, and reading it is a change
|
|
924
|
+
to this privacy ruling rather than a free follow-up. The question is filed as
|
|
925
|
+
`subagent-stop-payload-background-tasks-read`.
|
|
926
|
+
|
|
927
|
+
**`records` is counted by the hook's own `*.run` glob, not parsed back out of the
|
|
928
|
+
reader**, and the reason is the reader's output contract rather than convenience:
|
|
929
|
+
`check-producer-liveness` publishes a count only on its green line, printing one
|
|
930
|
+
finding per blocking record on red and no total. Same directory, same glob, same
|
|
931
|
+
number — and the field stays meaningful when the reader is unavailable, which is
|
|
932
|
+
the case the prerequisite above makes reachable. For the same reason the reader's
|
|
933
|
+
first output line is **not** carried verbatim: over `verdict`, `records` and
|
|
934
|
+
`live` it adds only the blocking record paths, and a free-text field would break
|
|
935
|
+
the space-delimited parse the grammar above is for.
|
|
936
|
+
|
|
937
|
+
**The log is capture-tier** — gitignored, advisory, drained by a named reclaim
|
|
938
|
+
path (gate-sdk/SPEC.md §The workflow directory), which is what keeps
|
|
939
|
+
`check-workflow-tiering` green on a member that is neither tracked nor ignored,
|
|
940
|
+
and it declares itself on the close-surface roster (lifecycle-kit/SPEC.md §The
|
|
941
|
+
close-surface roster) naming its own clear as the reclaim path:
|
|
942
|
+
|
|
943
|
+
close-surface: .workflow/subagent-stop-liveness.log advisory reclaim=: > .workflow/subagent-stop-liveness.log
|
|
944
|
+
|
|
945
|
+
`advisory` rather than `forced`, on the reasoning guard-kit's friction log takes:
|
|
946
|
+
nothing refuses a close that skips it, and a visible skip is the honest mode for a
|
|
947
|
+
probe.
|
|
948
|
+
|
|
949
|
+
**No gate observes the wiring, and that is recorded rather than assumed.**
|
|
950
|
+
`check-settings-pins` asserts only the pinned paths in the consumer's pins file
|
|
951
|
+
(none under `hooks`), `check-settings-paths`'s subject is `permissions.allow[]`
|
|
952
|
+
alone and never `hooks[].hooks[].command`, and `check-memory-off` scans the memory
|
|
953
|
+
surface. So the registration reds nothing — and neither would a registration
|
|
954
|
+
naming a script that does not exist. A session decides this wiring by reading this
|
|
955
|
+
section, never by predicting a verdict.
|
|
956
|
+
|
|
957
|
+
### The probe is asymmetric, and no reading may treat it otherwise
|
|
958
|
+
|
|
959
|
+
**A `live=yes` line proves the harness does not defer the stop.** One firing with
|
|
960
|
+
a live producer settles the unknown in that direction and the class stands.
|
|
961
|
+
|
|
962
|
+
**No accumulation of `live=no` lines proves that it does.** `live=no` is equally
|
|
963
|
+
consistent with *the harness deferred the stop*, *the session waited correctly*,
|
|
964
|
+
and *the session recorded nothing* — the last being the residue guard-kit rule 15
|
|
965
|
+
advises against and does not close. Passive accumulation therefore cannot return
|
|
966
|
+
the finding that would dissolve the class, and anyone waiting for it waits forever
|
|
967
|
+
and then reports the wrong thing.
|
|
968
|
+
|
|
969
|
+
**So the reading is bought by a deliberate firing, never by a wait.** A dispatched
|
|
970
|
+
session backgrounds a producer that runs long, writes its `<key>.run` record, and
|
|
971
|
+
then ends its turn. Both outcomes are results: the hook fires immediately with
|
|
972
|
+
`live=yes`, so the harness does not defer and §Operative residency's axis holds at
|
|
973
|
+
the turn-end too; or the hook does not fire until the child exits, so the harness
|
|
974
|
+
does defer, the class dissolves, and this template's remaining value is the
|
|
975
|
+
evidence for retiring it. The log is what makes that firing, and every later
|
|
976
|
+
accidental one, legible.
|
|
977
|
+
|
|
978
|
+
**The firing was bought, and it returned the first branch.** A dispatched agent
|
|
979
|
+
backgrounded a producer with a recorded PID and ended its turn without waiting;
|
|
980
|
+
the log took `live=yes verdict=red records=1` four seconds later, and again at
|
|
981
|
+
that agent's own stop, while the producer went on writing for another two and a
|
|
982
|
+
half minutes. **The harness does not defer the stop**, so the class the waiting
|
|
983
|
+
rule exists for does not dissolve, the relocation to guard-kit rule 14 stands, and
|
|
984
|
+
a blocking hook is the only lever left — which is a second authorization this
|
|
985
|
+
result does not grant.
|
|
986
|
+
|
|
987
|
+
**The same firings settled a second thing nothing could have settled before
|
|
988
|
+
wiring: `SubagentStop` is not the session-end event.** It fired seventeen times
|
|
989
|
+
inside one dispatched session that had ended no turn at all, spaced by assistant
|
|
990
|
+
steps rather than by the clock — a stretch spanning three long tool calls and no
|
|
991
|
+
assistant step produced no firing at all. A blocking variant would therefore
|
|
992
|
+
refuse at *every* intermediate step of a session rather than once at its return,
|
|
993
|
+
which is what a bounded run of blocks would actually be spent on. Recorded here
|
|
994
|
+
because it is a cost the blocking variant's authorization should be weighed
|
|
995
|
+
against, and because it is exactly the class of fact a logging-only probe exists
|
|
996
|
+
to buy.
|
|
997
|
+
|
|
768
998
|
## Resume journal — agent writes, scratch reset sweeps
|
|
769
999
|
|
|
770
1000
|
**The contract, in four clauses.** A mutating agent journals to a repo-local
|
|
@@ -1333,6 +1563,107 @@ decreases.
|
|
|
1333
1563
|
rotating operator reads one weekly trajectory per account rather than an
|
|
1334
1564
|
interleaved stream.
|
|
1335
1565
|
|
|
1566
|
+
## bin/wait-probe
|
|
1567
|
+
|
|
1568
|
+
`bin/wait-probe.sh` is the instrument behind §Operative residency's wait-primitive
|
|
1569
|
+
measurement: it stands a **known-duration producer** up and exercises candidate
|
|
1570
|
+
wait forms against it, recording one line per trial. Hand-invoked, no trigger,
|
|
1571
|
+
wired into **no** tier — it launches processes and sleeps for its declared
|
|
1572
|
+
durations, so a gate tier would put a multi-second sleep on every commit for a
|
|
1573
|
+
measurement bought once. Its precedent for existing at all is `demo/run-demo.sh`
|
|
1574
|
+
and `gate-sdk/bin/port-blockers.sh`, runnable artifacts a session invokes by hand.
|
|
1575
|
+
It writes nothing tracked: producers, markers and launch records go to
|
|
1576
|
+
`GATE_SDK_TMP_DIR`, trials to the capture-tier evidence file below, and it mints
|
|
1577
|
+
no knob of its own for either (§Layout and configuration owns why).
|
|
1578
|
+
|
|
1579
|
+
Exit **0** on a completed subcommand, **2** on misuse; `-h`/`--help` prints the
|
|
1580
|
+
subcommand roster on stdout and exits 0, the `bin/`-tool contract
|
|
1581
|
+
(gate-sdk/SPEC.md §The bin/-tool contract).
|
|
1582
|
+
|
|
1583
|
+
**One trial** is: launch a producer that sleeps a declared duration and then writes
|
|
1584
|
+
a completion marker; record its PID at launch in a `<key>.run` file exactly as
|
|
1585
|
+
`templates/agent-execution.md` mandates — the rule applies to the instrument that
|
|
1586
|
+
measures it, so the probe's own producers are visible to `check-producer-liveness`
|
|
1587
|
+
and to guard rule 14 like any other; arm the wait form under test; and record
|
|
1588
|
+
whether the waiter exited **before** the marker appeared. That before/after
|
|
1589
|
+
relation is the whole measurement: a waiter that outlives its condition is
|
|
1590
|
+
working, and one that exits early is the observed failure.
|
|
1591
|
+
|
|
1592
|
+
**The producer's duration is swept, not fixed**, because a single duration cannot
|
|
1593
|
+
distinguish the candidate causes. The probe reads no harness internals and asserts
|
|
1594
|
+
no ceiling; it varies the input and reports where the behavior changes.
|
|
1595
|
+
|
|
1596
|
+
**Two axes, and the second is what the instrument earns its keep on.** The *form*
|
|
1597
|
+
axis varies how the wait is armed. The *predicate* axis varies what the loop tests
|
|
1598
|
+
— a completion marker, or the producer's liveness. A form-only instrument can
|
|
1599
|
+
report that a form failed and can never report **why**, and the attested failures
|
|
1600
|
+
turned out to sit on the predicate axis, which a form-only sweep would have
|
|
1601
|
+
recorded as unexplained. Both axes are swept in the same run on identical
|
|
1602
|
+
producers, so no cell's result rests on a comparison with a differently-shaped
|
|
1603
|
+
trial, and every form arms the **same** wait body.
|
|
1604
|
+
|
|
1605
|
+
**The per-trial line.** Every field has a named reader and the field set is closed
|
|
1606
|
+
at these:
|
|
1607
|
+
|
|
1608
|
+
- **`form`** — which wait form the trial armed. Read at the comparison; the only
|
|
1609
|
+
field that distinguishes the candidates.
|
|
1610
|
+
- **`predicate`** — what the loop tested. Read at the classification, and it is
|
|
1611
|
+
what separates a failing *form* from a failing *condition*.
|
|
1612
|
+
- **`producer_ms`** — the producer's declared duration. Read at the sweep analysis:
|
|
1613
|
+
a ceiling shows as a threshold in this field.
|
|
1614
|
+
- **`waiter_exit`** — the waiter's exit status. Read at the classification, to
|
|
1615
|
+
separate a signal status from a clean zero with the marker absent.
|
|
1616
|
+
- **`marker_at_ms`**, **`waiter_at_ms`** — elapsed wall-clock at the marker's
|
|
1617
|
+
appearance and at the waiter's exit. Read **together and only together**: their
|
|
1618
|
+
*order* is the measurement and neither alone says anything.
|
|
1619
|
+
- **`producer_alive_at_exit`** — whether the recorded PID still answered `kill -0`
|
|
1620
|
+
when the waiter exited, establishing the *producer verifiably alive* condition —
|
|
1621
|
+
on the recorded PID and never a process-table pattern, which is the protocol's
|
|
1622
|
+
own rule.
|
|
1623
|
+
- **`class`** — `ok` on a clean trial; otherwise the cause, from the closed list
|
|
1624
|
+
below.
|
|
1625
|
+
|
|
1626
|
+
The producer's own PID is **not** logged: the `<key>.run` record already holds it
|
|
1627
|
+
for the lifetime the wait needs, and a second copy in an advisory log would be a
|
|
1628
|
+
PID with no reader once the trial ends.
|
|
1629
|
+
|
|
1630
|
+
**The candidate causes are enumerated before the run, not after it**, so a run
|
|
1631
|
+
returns a cause rather than an anecdote:
|
|
1632
|
+
|
|
1633
|
+
- **(i) `reaped`** — the harness or the session boundary killed the backgrounded
|
|
1634
|
+
shell. Tell: a signal exit status with the producer still alive.
|
|
1635
|
+
- **(ii) `ceiling`** — a wall-clock deadline the form carries. Tell: early exits
|
|
1636
|
+
cluster above one duration and short trials never fail.
|
|
1637
|
+
- **(iii) `predicate`** — the condition went true, or could not go false, for a
|
|
1638
|
+
reason unrelated to the producer. Tell: a clean **zero** exit with the marker
|
|
1639
|
+
absent, reproducing on a form the harness never touched.
|
|
1640
|
+
- **(iv) `unexplained`** — recorded as such and reported as such. A closed list
|
|
1641
|
+
that cannot say *I do not know* would force a wrong attribution, which is the
|
|
1642
|
+
failure the enumeration exists to avoid.
|
|
1643
|
+
|
|
1644
|
+
**The honest limit, and it is a division of labour rather than a defect.** Cause
|
|
1645
|
+
(ii)'s tell is a **threshold across the sweep**, so no single line can carry it:
|
|
1646
|
+
`record` classifies from the tells a trial can see on its own and the `report` arm
|
|
1647
|
+
is the only reader that sees the sweep whole and can name (ii). A reader taking a
|
|
1648
|
+
line's `class` for the run's verdict has read the wrong surface. The second limit
|
|
1649
|
+
is scope: the probe arms the forms a shell can arm and the *session* arms the
|
|
1650
|
+
harness's own, calling `record` for each — the tool cannot invoke a harness tool
|
|
1651
|
+
parameter, so a run that measures the harness forms is a session's run and `sweep`
|
|
1652
|
+
is the harness-uninvolved reproducer a second machine executes.
|
|
1653
|
+
|
|
1654
|
+
**The trials land in `.workflow/wait-primitive-evidence.txt`** — capture-tier,
|
|
1655
|
+
gitignored, advisory (gate-sdk/SPEC.md §The workflow directory), declared on the
|
|
1656
|
+
close-surface roster (lifecycle-kit/SPEC.md §The close-surface roster) naming its
|
|
1657
|
+
own clear as the reclaim path:
|
|
1658
|
+
|
|
1659
|
+
close-surface: .workflow/wait-primitive-evidence.txt advisory reclaim=: > .workflow/wait-primitive-evidence.txt
|
|
1660
|
+
|
|
1661
|
+
`advisory` rather than `forced`, on the reasoning §The turn-end liveness probe's
|
|
1662
|
+
log already takes: nothing refuses a close that skips it, and a visible skip is
|
|
1663
|
+
the honest mode for a probe. The **finding** — the branch the trials select and
|
|
1664
|
+
its grounds — lands in this SPEC, never in the log; the log is evidence, and
|
|
1665
|
+
evidence is not the record.
|
|
1666
|
+
|
|
1336
1667
|
## Layout and configuration
|
|
1337
1668
|
|
|
1338
1669
|
```
|
|
@@ -1343,6 +1674,7 @@ delegation-kit/
|
|
|
1343
1674
|
bin/run-budget-guard-tests.sh # budget-guard decision-table runner
|
|
1344
1675
|
bin/run-dispatch-guard-tests.sh # dispatch-guard decision-table runner (D1/D2/D3)
|
|
1345
1676
|
bin/run-trend-tests.sh # trend-reporter assertion runner
|
|
1677
|
+
bin/wait-probe.sh # wait-primitive probe: hand-invoked, no trigger, wired into no tier
|
|
1346
1678
|
lib/delegation.sh # shared helpers for the usage tools and the kit's gates
|
|
1347
1679
|
usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
|
|
1348
1680
|
usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
|
|
@@ -1361,6 +1693,7 @@ delegation-kit/
|
|
|
1361
1693
|
templates/agent-dispatch-guard.sh # PreToolUse(Agent) dispatch-shape guard (D1/D2/D3)
|
|
1362
1694
|
templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar incl. the queue counter group
|
|
1363
1695
|
templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
|
|
1696
|
+
templates/subagent-stop-liveness.sh # SubagentStop turn-end liveness probe (logging-only)
|
|
1364
1697
|
templates/delegation-config.sh # knob overrides (arrays live here)
|
|
1365
1698
|
smoke/install.sh
|
|
1366
1699
|
smoke/violation.sh
|
|
@@ -1458,6 +1791,28 @@ layout as defaults):
|
|
|
1458
1791
|
filter: a
|
|
1459
1792
|
prefix the consumer declared cannot be lost, and without `gate.sh` the config
|
|
1460
1793
|
is used exactly as written.
|
|
1794
|
+
- `DELEGATION_KIT_STOP_LOG` — the turn-end probe's log (§The turn-end liveness
|
|
1795
|
+
probe (template)); default
|
|
1796
|
+
`${GATE_SDK_WORKFLOW_DIR:-.workflow}/subagent-stop-liveness.log`, the same
|
|
1797
|
+
deferral guard-kit's two logs already take. No scratch-dir knob sits beside it:
|
|
1798
|
+
the launch record's home is `${GATE_SDK_TMP_DIR:-.tmp}`, the cross-kit deferral
|
|
1799
|
+
every kit reaching that directory already resolves it through, and a second
|
|
1800
|
+
name for it would be the duplication rather than the config. **The rule has
|
|
1801
|
+
since governed a second artifact and held**: `bin/wait-probe` (§bin/wait-probe)
|
|
1802
|
+
writes producers, markers and `<key>.run` records into that same directory and
|
|
1803
|
+
mints no knob of its own for it either. It mints none for its evidence log
|
|
1804
|
+
either, and there the reasoning is the narrower one this bullet's own knob does
|
|
1805
|
+
not meet: a knob needs a reader, and `DELEGATION_KIT_STOP_LOG` has one — a
|
|
1806
|
+
*second process*, the consumer-side hook, which must be told where to write.
|
|
1807
|
+
The probe both writes and reads its own log in one tool, so a knob there would
|
|
1808
|
+
be a name nothing reads, and the close stage reaches the file through the
|
|
1809
|
+
roster's literal rather than through a knob.
|
|
1810
|
+
- `DELEGATION_KIT_LIVENESS_CMD` — the liveness reader the probe invokes in set
|
|
1811
|
+
mode; default `evidence-kit/checks/check-producer-liveness.sh`. A knob rather
|
|
1812
|
+
than a literal because a consumer's evidence-kit may sit elsewhere, and because
|
|
1813
|
+
it is read through the **unset** form, so an explicitly empty value is the
|
|
1814
|
+
supported way to run the probe with no reader at all — the honest-degradation
|
|
1815
|
+
case the section states.
|
|
1461
1816
|
- `DELEGATION_KIT_READONLY_TYPES` — agent-type names the consumer dispatches for
|
|
1462
1817
|
read-only work; D2's only trigger (§The delegation model). Default empty, in
|
|
1463
1818
|
which case D2 is inert by construction. Every entry is the consumer's own
|
|
@@ -1491,6 +1846,17 @@ its consumer session brief (`scripts/session-context.sh`) additionally prints
|
|
|
1491
1846
|
the verdict line at SessionStart for planning-time visibility — a consumer-side
|
|
1492
1847
|
edit; the context-kit template stays uncoupled from delegation-kit.
|
|
1493
1848
|
|
|
1849
|
+
`subagent-stop-liveness.sh` is a third hook, and the only one on a non-`PreToolUse`
|
|
1850
|
+
event. It registers under `SubagentStop` in the consumer's `.claude/settings.json`
|
|
1851
|
+
— an event that takes **no matcher**, so the entry carries a `hooks` array alone
|
|
1852
|
+
and is not tool-scoped, the shape a `SessionStart` entry already has. Copy the
|
|
1853
|
+
template into the gates dir and wire `bash scripts/subagent-stop-liveness.sh`; it
|
|
1854
|
+
sources no kit lib at all (§The turn-end liveness probe (template) owns why) and
|
|
1855
|
+
resolves its reader through `DELEGATION_KIT_LIVENESS_CMD`. Registration is again
|
|
1856
|
+
the whole opt-in, and here the opt-in is also the consent: the wiring is a
|
|
1857
|
+
permission-surface write, so it is the consumer's own act and never an agent
|
|
1858
|
+
session's.
|
|
1859
|
+
|
|
1494
1860
|
`agent-dispatch-guard.sh` is a second hook on that same matcher, registered the
|
|
1495
1861
|
same way and **independently**: the harness fires every hook a matcher carries
|
|
1496
1862
|
and any exit 2 blocks, so neither guard knows about the other and a consumer
|