@jr2/orchestrator 0.5.1 → 0.6.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.
Files changed (185) hide show
  1. package/docs/agents-block.md +2 -2
  2. package/docs/concepts/agents-and-turns.md +56 -20
  3. package/docs/concepts/architecture.md +30 -17
  4. package/docs/concepts/charts.md +6 -3
  5. package/docs/concepts/converge.md +3 -0
  6. package/docs/concepts/effects.md +86 -31
  7. package/docs/concepts/machines-and-workflows.md +9 -0
  8. package/docs/concepts/pools-and-sources.md +6 -6
  9. package/docs/concepts/secrets-and-trust.md +126 -42
  10. package/docs/concepts/the-menu.md +3 -0
  11. package/docs/concepts/workspaces.md +129 -51
  12. package/docs/get-started/an-agent-in-a-sandbox.md +21 -19
  13. package/docs/get-started/have-your-assistant-write-a-machine.md +111 -40
  14. package/docs/get-started/install.md +4 -0
  15. package/docs/guides/add-tools-to-the-sandbox.md +17 -4
  16. package/docs/guides/bind-open-parts.md +5 -4
  17. package/docs/guides/cut-a-worktree.md +560 -0
  18. package/docs/guides/fix-a-failed-converge.md +1 -1
  19. package/docs/guides/let-an-agent-write-a-chart.md +5 -1
  20. package/docs/guides/look-inside-a-sandbox.md +18 -15
  21. package/docs/guides/move-from-kind-to-a-shared-cluster.md +16 -0
  22. package/docs/guides/push-and-sign-a-branch.md +67 -21
  23. package/docs/guides/run-a-command-or-call-a-url.md +84 -41
  24. package/docs/guides/run-one-worker-per-item.md +19 -18
  25. package/docs/guides/set-an-agents-access-and-dials.md +67 -22
  26. package/docs/guides/size-a-workspace.md +19 -6
  27. package/docs/guides/use-a-hosted-provider.md +6 -0
  28. package/docs/guides/watch-a-run.md +47 -24
  29. package/docs/guides/write-a-workflow.md +1 -1
  30. package/docs/llms.txt +33 -12
  31. package/docs/reference/authoring-surface/agent.md +34 -11
  32. package/docs/reference/authoring-surface/answer.md +19 -3
  33. package/docs/reference/authoring-surface/arg.md +27 -5
  34. package/docs/reference/authoring-surface/branchname.md +15 -0
  35. package/docs/reference/authoring-surface/command.md +36 -21
  36. package/docs/reference/authoring-surface/fail.md +17 -4
  37. package/docs/reference/authoring-surface/file.md +36 -16
  38. package/docs/reference/authoring-surface/http.md +108 -8
  39. package/docs/reference/authoring-surface/isready.md +14 -0
  40. package/docs/reference/authoring-surface/jr2setup.md +1 -1
  41. package/docs/reference/authoring-surface/open.md +36 -5
  42. package/docs/reference/authoring-surface/paramsof.md +22 -4
  43. package/docs/reference/authoring-surface/pool.md +4 -4
  44. package/docs/reference/authoring-surface/push.md +30 -12
  45. package/docs/reference/authoring-surface/readyof.md +21 -0
  46. package/docs/reference/authoring-surface/secret.md +25 -4
  47. package/docs/reference/authoring-surface/source.md +3 -3
  48. package/docs/reference/authoring-surface/type-agentdefinition.md +2 -2
  49. package/docs/reference/authoring-surface/type-agentslots.md +4 -1
  50. package/docs/reference/authoring-surface/type-anyframepath.md +14 -0
  51. package/docs/reference/authoring-surface/type-anyworktreepath.md +15 -0
  52. package/docs/reference/authoring-surface/type-bindactors.md +14 -0
  53. package/docs/reference/authoring-surface/type-binding.md +5 -6
  54. package/docs/reference/authoring-surface/type-commandinput.md +4 -3
  55. package/docs/reference/authoring-surface/type-commandoptions.md +0 -22
  56. package/docs/reference/authoring-surface/type-commandoutput.md +22 -4
  57. package/docs/reference/authoring-surface/type-customize.md +4 -2
  58. package/docs/reference/authoring-surface/type-dispatchoutput.md +8 -1
  59. package/docs/reference/authoring-surface/type-doorlessinput.md +19 -0
  60. package/docs/reference/authoring-surface/type-filebody.md +4 -8
  61. package/docs/reference/authoring-surface/type-framepath.md +14 -0
  62. package/docs/reference/authoring-surface/type-hostinjectedinput.md +2 -4
  63. package/docs/reference/authoring-surface/type-httpdefinition.md +6 -3
  64. package/docs/reference/authoring-surface/type-httpfileinput.md +20 -0
  65. package/docs/reference/authoring-surface/type-httpoutput.md +7 -1
  66. package/docs/reference/authoring-surface/type-lateroutcome.md +21 -0
  67. package/docs/reference/authoring-surface/type-namestart.md +77 -0
  68. package/docs/reference/authoring-surface/type-noslotworkspaceoptions.md +1 -6
  69. package/docs/reference/authoring-surface/type-notworktreekeys.md +12 -0
  70. package/docs/reference/authoring-surface/type-opencommandinput.md +7 -2
  71. package/docs/reference/authoring-surface/type-permissivenoslotworkspaceoptions.md +1 -6
  72. package/docs/reference/authoring-surface/type-permissiveworkspaceoptions.md +5 -10
  73. package/docs/reference/authoring-surface/type-poolnextinput.md +22 -0
  74. package/docs/reference/authoring-surface/type-poolspec.md +2 -2
  75. package/docs/reference/authoring-surface/type-pushinput.md +22 -3
  76. package/docs/reference/authoring-surface/type-pushoutput.md +32 -7
  77. package/docs/reference/authoring-surface/type-reposlot.md +5 -5
  78. package/docs/reference/authoring-surface/type-sandboxoptions.md +11 -4
  79. package/docs/reference/authoring-surface/type-slothandles.md +5 -13
  80. package/docs/reference/authoring-surface/type-sourcespec.md +10 -10
  81. package/docs/reference/authoring-surface/type-workspaced.md +29 -8
  82. package/docs/reference/authoring-surface/type-workspacehandles.md +5 -6
  83. package/docs/reference/authoring-surface/type-workspaceoptions.md +1 -13
  84. package/docs/reference/authoring-surface/type-worktreefound.md +16 -0
  85. package/docs/reference/authoring-surface/type-worktreeinput.md +56 -0
  86. package/docs/reference/authoring-surface/type-worktreekey.md +14 -0
  87. package/docs/reference/authoring-surface/type-worktreeoptions.md +29 -0
  88. package/docs/reference/authoring-surface/type-worktreeoutput.md +45 -0
  89. package/docs/reference/authoring-surface/type-worktreepath.md +16 -0
  90. package/docs/reference/authoring-surface/type-worktreeready.md +37 -0
  91. package/docs/reference/authoring-surface/type-worktreerefused.md +21 -0
  92. package/docs/reference/authoring-surface/workspace.md +65 -37
  93. package/docs/reference/authoring-surface/worktree.md +71 -0
  94. package/docs/reference/authoring-surface.md +30 -10
  95. package/docs/reference/cli.md +1 -1
  96. package/docs/reference/config.md +13 -4
  97. package/docs/reference/decisions/0001-operator-owned-generic-sandbox.md +10 -9
  98. package/docs/reference/decisions/0002-duplex-streaming-actor.md +17 -10
  99. package/docs/reference/decisions/0004-worktree-provisioning-model.md +27 -21
  100. package/docs/reference/decisions/0005-sandbox-pod-composition.md +29 -19
  101. package/docs/reference/decisions/0006-agent-control-surface.md +6 -3
  102. package/docs/reference/decisions/0012-workspace-wrapper-machine.md +30 -30
  103. package/docs/reference/decisions/0013-the-agent-reaches-its-machine-through-a-container-it-cannot-read.md +35 -17
  104. package/docs/reference/decisions/0015-authoring-surface-absorbs-the-mechanism.md +8 -2
  105. package/docs/reference/decisions/0016-agent-turn-mechanics-are-internal.md +9 -7
  106. package/docs/reference/decisions/0017-pool-over-a-source-port.md +6 -4
  107. package/docs/reference/decisions/0019-one-converging-command-against-the-current-context.md +21 -9
  108. package/docs/reference/decisions/0021-workspace-continuity-is-a-lease-that-answers-back.md +2 -1
  109. package/docs/reference/decisions/0023-the-harness-prints-the-conversation.md +8 -9
  110. package/docs/reference/decisions/0024-an-agents-turn-ends-with-the-state-that-asked-for-it.md +62 -65
  111. package/docs/reference/decisions/0027-the-harness-is-jr2s-own-server-flue-retires-the-wire-stays.md +9 -1
  112. package/docs/reference/decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md +13 -12
  113. package/docs/reference/decisions/0031-menu-only-agents-run-on-the-instance-harness.md +4 -1
  114. package/docs/reference/decisions/0033-a-machine-declares-the-input-that-starts-it.md +18 -19
  115. package/docs/reference/decisions/0037-an-instance-builds-its-sandbox-images-jr2-injects-the-harness.md +8 -8
  116. package/docs/reference/decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md +4 -4
  117. package/docs/reference/decisions/0051-a-repo-is-a-slot-on-the-workspace-and-a-cache-on-the-node.md +57 -46
  118. package/docs/reference/decisions/0052-a-sandbox-lands-where-an-ordinary-pod-lands-and-the-cache-follows-it.md +5 -0
  119. package/docs/reference/decisions/0053-a-fetch-inside-the-pod-asks-the-node-cache-and-the-cache-asks-the-remote.md +20 -8
  120. package/docs/reference/decisions/0057-a-turn-is-its-frame-its-dials-and-whether-it-continues.md +24 -24
  121. package/docs/reference/decisions/0058-a-harness-answers-the-orchestrator-alone.md +5 -3
  122. package/docs/reference/decisions/0059-a-harness-holds-stand-ins-and-the-custodian-holds-the-keys.md +110 -67
  123. package/docs/reference/decisions/0062-jr2-briefs-the-agent-on-its-seat-never-on-its-task.md +101 -74
  124. package/docs/reference/decisions/0063-the-orchestrator-watches-the-cluster.md +5 -6
  125. package/docs/reference/decisions/0066-a-model-tier-runs-a-real-model-and-a-change-to-what-it-reads-runs-the-tier.md +2 -0
  126. package/docs/reference/decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md +181 -153
  127. package/docs/reference/decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md +74 -63
  128. package/docs/reference/decisions/0070-a-machine-lends-its-parts-to-a-chart.md +31 -20
  129. package/docs/reference/decisions/0073-a-machine-fails-a-run-with-fail-and-an-uncaught-failure-ends-it-failed.md +1 -1
  130. package/docs/reference/decisions/0075-a-machine-cuts-a-worktree-and-the-workspace-only-clones.md +295 -0
  131. package/docs/reference/decisions/0076-an-agents-control-credential-lives-only-where-no-workspace-code-runs.md +320 -0
  132. package/docs/reference/decisions/0077-jr2-requires-landlock-on-every-sandbox-node.md +79 -0
  133. package/docs/reference/decisions.md +3 -0
  134. package/docs/reference/glossary.md +51 -12
  135. package/docs/reference/http-api.md +45 -7
  136. package/docs/reference/machines.md +0 -1
  137. package/docs/why.md +5 -4
  138. package/package.json +3 -3
  139. package/src/actor.ts +161 -35
  140. package/src/agent.ts +6 -6
  141. package/src/ambient.ts +3 -5
  142. package/src/chart.ts +186 -19
  143. package/src/charts.ts +9 -2
  144. package/src/config.ts +16 -6
  145. package/src/custodian.lua +17 -5
  146. package/src/custodian.ts +251 -77
  147. package/src/customize.ts +11 -3
  148. package/src/effect-checks.ts +50 -3
  149. package/src/effect.ts +343 -127
  150. package/src/effector-wire.ts +6 -3
  151. package/src/fail.ts +17 -4
  152. package/src/harness-client.ts +74 -31
  153. package/src/harness-env.ts +33 -0
  154. package/src/held-secrets.ts +125 -16
  155. package/src/holds.ts +3 -0
  156. package/src/http-effect.ts +88 -32
  157. package/src/http.ts +56 -17
  158. package/src/index.ts +15 -1
  159. package/src/internal.ts +1 -0
  160. package/src/kube-client.ts +6 -3
  161. package/src/machine-doc.ts +3 -4
  162. package/src/model-keys.ts +24 -0
  163. package/src/names.ts +19 -6
  164. package/src/notices.ts +443 -54
  165. package/src/open-body.ts +85 -19
  166. package/src/open.ts +36 -5
  167. package/src/parts.ts +40 -28
  168. package/src/party.ts +33 -0
  169. package/src/pick.ts +41 -7
  170. package/src/pool.ts +44 -23
  171. package/src/registration.ts +53 -11
  172. package/src/repo-identity.ts +7 -3
  173. package/src/repos.ts +20 -2
  174. package/src/run-host.ts +106 -20
  175. package/src/sandbox-effect.ts +217 -66
  176. package/src/sandbox-kube.ts +63 -16
  177. package/src/secret-placement.ts +9 -2
  178. package/src/setup.ts +86 -6
  179. package/src/tokens.ts +107 -32
  180. package/src/vocabulary.ts +23 -4
  181. package/src/wire.ts +10 -10
  182. package/src/workspace.ts +264 -253
  183. package/src/worktree.ts +249 -0
  184. package/docs/reference/authoring-surface/type-noslotspec.md +0 -26
  185. package/docs/reference/authoring-surface/type-workspacespec.md +0 -37
@@ -52,10 +52,9 @@ Decisions since then need pod facts at once: the scheduler's reason for a Pendin
52
52
  merge patch per Workspace every 5 minutes, ±20% jitter so Leases never renew in lockstep after a restart. It no longer
53
53
  carries detection.
54
54
  - **The attach is a Harness call, not an exec.** The Harness runs the attach — ACL stamp, `git clone --shared` from the
55
- node cache, remotes, `git worktree add` — on `POST /attach { slots, branch }`, authenticated like every Harness call
56
- (ADR-0058). No stream per Workspace crosses the API server, and **`pods/exec` leaves the Orchestrator's RBAC**. It
57
- also binds work late: a pod already running receives its Repos and branch, the shape standby Sandboxes and Agent
58
- Substrate need.
55
+ node cache, remotes — on `POST /attach { slots }`, authenticated like every Harness call (ADR-0058). No stream per
56
+ Workspace crosses the API server, and **`pods/exec` leaves the Orchestrator's RBAC**. It also binds work late: a pod
57
+ already running receives its Repos, the shape standby Sandboxes and Agent Substrate need.
59
58
 
60
59
  ## Considered options
61
60
 
@@ -70,8 +69,8 @@ Decisions since then need pod facts at once: the scheduler's reason for a Pendin
70
69
  - **A jr2 WebSocket API.** Nothing to add: a Kubernetes watch is already a pushed stream of events.
71
70
  - **Keep the attach as exec through the new client.** The exec protocol is the hardest part of any Kubernetes client, it
72
71
  keeps one stream per Workspace through the API server, and it keeps `pods/exec`.
73
- - **Attach from an init container.** Declarative, but it fixes the Repos and branch at pod creation, which rules out
74
- late binding, and it must wait on a cache that exists only after scheduling.
72
+ - **Attach from an init container.** Declarative, but it fixes the Repos at pod creation, which rules out late binding,
73
+ and it must wait on a cache that exists only after scheduling.
75
74
 
76
75
  ## Consequences
77
76
 
@@ -147,6 +147,8 @@ recover, finish — are exercised only one scripted tool call at a time.
147
147
  the container before the guard takes the hog, and that trial is void. A claim whose setup the step must race (a Gate
148
148
  answered while the model works, a mode moved while it composes) voids the trials whose setup lost the race; voids are
149
149
  bounded, and a void past the bound counts against the floor and prints as a void in the failure list, never as a miss.
150
+ A trial whose own prompt, the one that carries its marker, is not in its kept conversation is void too: the follow
151
+ lost it, and the calls after another prompt are not the trial's, so they are never read as its miss or its pass.
150
152
  - **Scenarios run `workers` at once, set per profile.** Each scenario has its own namespace, so scenarios are
151
153
  independent, as `@kind`'s are. The profile's `workers` is how many run at once: `just e2e-model` passes it to cucumber
152
154
  as `--parallel` when it is above 1. It is in the profile and not in `cucumber.json`, because its limits are the
@@ -3,9 +3,11 @@
3
3
  An Effect is work a Machine does outside itself. A Machine already runs Agents and Gates as actors (ADR-0049); work such
4
4
  as running the tests had no place of its own, so an author either asked an Agent to do it (and trusted its word) or
5
5
  wrote a raw xstate promise that a restart ran again. jr2 builds four kinds: `command`, run a program in the Workspace;
6
- `http`, call a URL — with a JSON or text body, or a Worktree file as its body; `push`, push the Workspace's branch to
7
- its Repo Slot's Binding; and `dispatch`, start a run of a registered Workflow, on this Orchestrator or another's
8
- ([ADR-0071](0071-a-run-starts-a-run-through-a-dispatch-effect.md)). An Effect that holds a secret runs in an Effector
6
+ `http`, call a URL — with a JSON or text body, or a Worktree file as its body; `push`, push a Worktree's branch to its
7
+ Repo Slot's Binding; and `dispatch`, start a run of a registered Workflow, on this Orchestrator or another's
8
+ ([ADR-0071](0071-a-run-starts-a-run-through-a-dispatch-effect.md)). A fifth, `worktree()`, is a kit Effect on the
9
+ `command` machinery that cuts a Worktree ([ADR-0075](0075-a-machine-cuts-a-worktree-and-the-workspace-only-clones.md)).
10
+ An Effect that holds a secret runs in an Effector
9
11
  ([ADR-0068](0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md)). A `command` whose env names a secret —
10
12
  the credentialed `command` — runs there too, its child confined (below). A `dispatch` with no target runs in the
11
13
  Orchestrator's own process, the one Effect that does: it starts the run through the run host and holds no secret.
@@ -15,20 +17,20 @@ Orchestrator's own process, the one Effect that does: it starts the run through
15
17
  - **An Effect is an actor slot beside `agent()`.** `actors: { tests: command(["pnpm", "test"]) }`, invoked as
16
18
  `src: "tests"`, with an `onDone` that routes on its output. xstate gives the rest: the Effect stops when its state
17
19
  exits, its input persists with the snapshot, a `src` typo is a compile error, and `.provide()` is the unit-test seam.
18
- The slot carries its parts as plain data — kind, placement, timeout; a `command`'s argv, Repo Slot and the secrets its
19
- env names; an `http` Effect's method, fixed host, the names of the secrets it names and whether its body is a Worktree
20
- file; a `push`'s `pin`, `sign`, `squash` and `force` — which `jr2 up` prints and the Machine doc carries, read without
21
- running anything. A packaged Machine may leave an `http` url (whatever its body) or a `command`'s argv Open (`open` in
22
- its place), and the name of one secret its auth, a header or a command's env names (`secret(open)`; never in a url),
23
- for the composer to bind once with `customize(machine, { effects: { <slot>: { url } | { argv } | { secret } } })` —
24
- one object with both keys for an Effect with two Open parts
25
- ([ADR-0054](0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md)); the slot then carries the
26
- Effect built again with the bound parts, and an Effect still Open runs nothing: its state's `onError`. An Effect
27
- written inline (`invoke: { src: http({...}) }`) is refused at build and at load, with the slot form in the message:
28
- xstate gives it a generated key that moves when a state is renamed, so the ledger, the report and the Machine doc
29
- would name it by a number, and `customize()` — `provide`, keyed on `actors` — could not reach it. The same rule holds
30
- for `agent()` and `workspace()` (ADR-0049): a Part is a key of `actors`, and every Effect kind is one (the brand
31
- `isEffect` reads).
20
+ The slot carries its parts as plain data — kind, placement, timeout; a `command`'s argv and the secrets its env names;
21
+ an `http` Effect's method, fixed host, the names of the secrets it names and whether its body is a Worktree file; a
22
+ `push`'s `pin`, `sign`, `squash`, `force` and `slot`; a cut's `expect` — which `jr2 up` prints and the Machine doc
23
+ carries, read without running anything. A packaged Machine may leave an `http` url (whatever its body) or a
24
+ `command`'s argv Open (`open` in its place), and the name of one secret its auth, a header or a command's env names
25
+ (`secret(open)`; never in a url), for the composer to bind once with
26
+ `customize(machine, { effects: { <slot>: { url } | { argv } | { secret } } })` — one object with both keys for an
27
+ Effect with two Open parts ([ADR-0054](0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md));
28
+ the slot then carries the Effect built again with the bound parts, and an Effect still Open runs nothing: its state's
29
+ `onError`. An Effect written inline (`invoke: { src: http({...}) }`) is refused at build and at load, with the slot
30
+ form in the message: xstate gives it a generated key that moves when a state is renamed, so the ledger, the report and
31
+ the Machine doc would name it by a number, and `customize()` — `provide`, keyed on `actors` — could not reach it. The
32
+ same rule holds for `agent()` and `workspace()` (ADR-0049): a Part is a key of `actors`, and every Effect kind is one
33
+ (the brand `isEffect` reads).
32
34
  - **Between a pick and its work: `fromPick`, `paramsOf`, `answer`.** All optional; a plain mapper is legal.
33
35
  `fromPick(def, fill)` is the `input` of a state a pick enters: the pick's params flow into the Effect's input by name,
34
36
  `fill` returns only what the Machine adds, and the sum is checked against the Effect's input type — the security
@@ -51,7 +53,7 @@ Orchestrator's own process, the one Effect that does: it starts the run through
51
53
  is written below (on a state's entry or exit, or on a transition of a state, at or below that Agent's state). On a
52
54
  transition below no Agent's state it shapes the pick of the Agent whose event took the transition — the sender of a
53
55
  pick, or the Agent whose pick started the child whose done or error event it is — and the other Agent's pick keeps its
54
- default answer; when one Agent slot is invoked in two regions, it shapes the pick at the same invoke as the pick that
56
+ default answer; when one Agent slot is invoked by two states, it shapes the pick at the same invoke as the pick that
55
57
  sent the event or started the child, and none when that pick is not being answered; an event that names no Agent
56
58
  shapes the pick in its own send, and outside one shapes no pick while two Agents' states are active; on an entry or an
57
59
  exit below no Agent's state it sets nothing. One action object written in several places runs from each by that
@@ -80,24 +82,35 @@ Orchestrator's own process, the one Effect that does: it starts the run through
80
82
  ([ADR-0071](0071-a-run-starts-a-run-through-a-dispatch-effect.md)). There is no `placement:` key and no kind per
81
83
  placement: naming a secret places a command, the body places an `http`, and the target places a `dispatch` — one name
82
84
  per thing, so there is no `upload` kind beside it (ADR-0068).
83
- - **A `command` that names no secret runs in the Harness container of its Workspace's Sandbox**, as a child of the
84
- Harness process: the Agent's user, the Sandbox Image's tools, the same Stand-ins as the Agent's `bash` (ADR-0059), and
85
- no credential of its own. The Harness serves it on `/exec/:id`, behind the same bearer as every Harness route
86
- (ADR-0058); the Instance Harness holds no Workspace and refuses it (ADR-0031). Outside a `workspace()` a command is
87
- refused at invoke. Its cwd is a Repo Slot's Worktree: the one slot, or the slot it names (`slot`); several and none
88
- named is refused (ADR-0051). In a Workspace with no Repo Slot its cwd is `/work`, which the Workspace's steps share —
89
- named in the start, never left to the Harness, whose own cwd is the Sandbox Image's `WORKDIR`.
85
+ - **A `command` that names no secret runs in the Harness container of its Workspace's Sandbox**, as a confined child of
86
+ the Harness process ([ADR-0076](0076-an-agents-control-credential-lives-only-where-no-workspace-code-runs.md)): the
87
+ Agent's user, the Sandbox Image's tools, the same confined env and Stand-ins as the Agent's `bash` (ADR-0059), and no
88
+ credential of its own. The Harness serves it on `/exec/:id`, behind the same bearer as every Harness route (ADR-0058);
89
+ the Instance Harness holds no Workspace and refuses it (ADR-0031). Outside a `workspace()` a command is refused at
90
+ invoke. Its cwd is the Worktree its input names (`worktree`), which is required under Repo Slots, because a Workspace
91
+ that only clones has no Worktree for a default to name (ADR-0075). In a Workspace with no Repo Slot its cwd is
92
+ `/work`, which the Workspace's steps share — named in the start, never left to the Harness, whose own cwd is the
93
+ Sandbox Image's `WORKDIR`.
94
+ - **`worktree()` runs on the `command` machinery.** `actors: { cut: worktree({ expect? }) }`, with the input
95
+ `{ path, branch, from? }` or `{ path, detach }`: a kit program in the Harness container, its git confined (ADR-0076),
96
+ no new wire kind, marked idempotent. Its outcomes are `ready | refused | unknown`, and its output is the contract in
97
+ ADR-0075. Each thing that an Agent's word can cause settles `refused`, with nothing changed, and never goes to
98
+ `onError`. A settled `ready` row in the ledger holds the cut's Repo Slot, path and branch, and it is the one thing a
99
+ `push`, a credentialed `command` and an `http` file body read for their target.
90
100
  - **Every outcome is output**: `exited | timeout | killed | unknown` for a `command` (`killed` with the signal that
91
101
  ended it; a stopped credentialed command's is `exited` with the stop's signal, D1);
92
102
  `response | unreachable | refused | unknown` for an `http` Effect; `pushed | rejected | diverged | unknown` for a
93
- `push`. A command not found is `exited` 127. A start over the bytes an Effector reads (ADR-0068) is sent nowhere and
94
- settles as its kind's own outcome — an `http` `refused`, a `push` `rejected` at stage `start` (nothing pushed), a
95
- credentialed `command` `exited` 127 with the reason in its tail, the Effector's own form for a command that could not
96
- start — since an Agent's param (a squash message, an argv part) can reach the bound; a path segment that is `.`, `..`
97
- or empty, and a file body's path that is a symlink, leaves the Worktree, is absolute, is a FIFO or has more than one
98
- link, are `refused` with nothing sent — an Agent's param can cause each. `onError` is only a jr2 or config defect: no
99
- Workspace, an argv slot with no value, an input that misses the definition's schema, no Effector to send to, an Open
100
- part nobody bound.
103
+ `push`. A command not found is `exited` 127, and a bad Worktree adds no outcome: a `command` settles `exited` 127 with
104
+ the reason in its tail, and an `http` file body settles `refused`. Every union here is open: `worktree()`, `push`,
105
+ `command` and `http` each hold a stand-in member, so that no author can write an exhaustive check and a later outcome
106
+ is no break. A start over the bytes an Effector reads (ADR-0068) is sent nowhere and settles as its kind's own outcome
107
+ — an `http` `refused`, a `push` `rejected` at stage `start` (nothing pushed), a credentialed `command` `exited` 127
108
+ with the reason in its tail, the Effector's own form for a command that could not start — since an Agent's param (a
109
+ squash message, an argv part) can reach the bound; a path segment that is `.`, `..` or empty, and a file body's path
110
+ that is a symlink, leaves the Worktree, is absolute, is a FIFO or has more than one link, are `refused` with nothing
111
+ sent — an Agent's param can cause each. `onError` is only a jr2 or config defect: no Workspace, a `command` with no
112
+ `worktree` under Repo Slots, an argv slot with no value, an input that misses the definition's schema, no Effector to
113
+ send to, an Open part nobody bound.
101
114
  - **An `http` Effect is a definition plus one function.**
102
115
  `http({ method, url, headers?, auth?, input?, request?, body?, timeout?, maxBody?, idempotent? })`. The url's scheme
103
116
  and host are literal — a secret, named with `secret("name")`, may sit only in its path, through the `text` template,
@@ -108,13 +121,13 @@ Orchestrator's own process, the one Effect that does: it starts the run through
108
121
  the url is refused. `request(input)` returns the run's part alone: `path` segments and a JSON or text body. So an
109
122
  Agent's param reaches a path segment or a body, never the host, a header or a secret. It runs in the Instance
110
123
  Effector, which builds the request and holds the secrets (ADR-0068); the Orchestrator signs the call and holds none.
111
- Its body may instead be a Worktree file, `body: file(path, { slot?, segments?, contentType? })`: the file's path
112
- relative to the Repo Slot's Worktree (the one slot, or the one `slot` names) — or to `/work` itself in a Workspace
113
- with no Repo Slot (ADR-0051), the folder its steps share — and the url's path segments — each a value or a function of
114
- the input; no `request` is written beside it, since `file()` carries the run's part. Such an `http` is placed in the
115
- Sandbox Effector of the Workspace whose body invokes it, and `jr2 up` refuses one that no `workspace()` invokes, where
116
- no Worktree exists to read. It is sent with `PUT`, `POST` or `PATCH`. The Sandbox Effector opens the file with
117
- `openat2` beneath the work root — `RESOLVE_BENEATH`, `RESOLVE_NO_SYMLINKS`, `RESOLVE_NO_MAGICLINKS`,
124
+ Its body may instead be a Worktree file, `body: file(path, { segments?, contentType? })`: the file's path relative to
125
+ the Worktree its input names (`worktree`), which needs a cut's settled row, as a `push` does — or to `/work` itself in
126
+ a Workspace with no Repo Slot (ADR-0051), the folder its steps share — and the url's path segments — each a value or a
127
+ function of the input; no `request` is written beside it, since `file()` carries the run's part. Such an `http` is
128
+ placed in the Sandbox Effector of the Workspace whose body invokes it, and `jr2 up` refuses one that no `workspace()`
129
+ invokes, where no Worktree exists to read. It is sent with `PUT`, `POST` or `PATCH`. The Sandbox Effector opens the
130
+ file with `openat2` beneath the work root — `RESOLVE_BENEATH`, `RESOLVE_NO_SYMLINKS`, `RESOLVE_NO_MAGICLINKS`,
118
131
  `RESOLVE_NO_XDEV`, non-blocking — then `fstat`: a symlink at any component (one that stays inside included), `..`, an
119
132
  absolute path, a FIFO, a directory and a file with more than one link are refused, in words, as output. The content
120
133
  type is `file()`'s `contentType` or a `content-type` header of the definition's, not both: a definition with both is
@@ -129,7 +142,9 @@ Orchestrator's own process, the one Effect that does: it starts the run through
129
142
  run the image's system paths, read and write its own scratch (its `HOME` and its `TMPDIR`; never `/tmp`, which every
130
143
  child would share), and read the secret files it names — nothing else. A node whose kernel cannot confine it runs
131
144
  none: the Effector of a Workspace that holds one does not become ready there, and the provision fails naming the node
132
- (ADR-0068). It runs against one commit: the Agent's branch tip when it starts, or — with `pin` — the commit the
145
+ (ADR-0068). Its input names its Worktree (`worktree`), and that path needs a cut's settled row with a branch, as a
146
+ `push` does: a path alone does not name the target of a credential. With none it settles `exited` 127, and nothing
147
+ runs. It runs against one commit: the tip of that row's branch when it starts, or — with `pin` — the commit the
133
148
  Effect's input names (`{ sha }`, one a Gate approved). That commit is checked out into a fresh scratch of the Effect's
134
149
  own by the push's import procedure (below), so the Agent's uncommitted edits are never seen; the answer carries
135
150
  `dirty: true` beside the output when the Worktree held some (a status in jr2's clean repository over a copy of the
@@ -148,35 +163,41 @@ Orchestrator's own process, the one Effect that does: it starts the run through
148
163
  Workspace with no Repo Slot has no commit to run it against, so there it is refused — by `jr2 up` and at invoke, with
149
164
  the fix: declare a slot, or name no secret, and it runs in `/work` beside the Agent (ADR-0051). A run of the live
150
165
  files under a credential is the claim this kind exists not to make.
151
- - **A `push` pushes the Workspace's branch to its Repo Slot's Binding**, from the Sandbox Effector, with no input:
152
- `push({ pin?, sign?, squash?, force?, slot?, timeout? })`. Its credential is the push credential of the
153
- `git.credentials` entry the Repo Slot's url falls under (ADR-0051): the provision matches the url the run binds —
154
- static, per-run or `customize()`-bound, one path — and names that entry's push Secret on the Sandbox, and the
155
- Effector, which holds only the entries named there, matches the push's url as the fence does. git never runs with the
156
- Agent's repository as its repository: each call makes a new bare repository in the Effector's scratch, configured by
157
- jr2 under a cleared environment; it reads the Agent's branch as data (a loose ref or `packed-refs`, opened beneath
158
- with no symlink, bounded); it imports the Agent's objects as data — one `pack-objects` over the Agent's object store
159
- with a deadline (a FIFO in place of an object blocks an open forever), `index-pack --strict`, and a connectivity check
160
- — borrowing only from the node's Repo cache; and it pushes `<commit>:refs/heads/<branch>` to the Binding url, never to
161
- a remote of the Agent's config, and never to a local path (git's local transport runs that repository's config and
162
- hooks, and a path in the pod can be the Agent's own repository; only the binary's tests can allow one). So no config,
163
- hook, attribute or program of the Agent's runs; a test plants each in the Agent's repository and proves none ran. A
164
- token goes Basic over https through a credential helper only — an `http://` url with a token is `rejected` with
165
- nothing sent — and the helper is the Effector binary (`effector git-credential`), which reads the token's file when
166
- git asks for the Binding's own host over https and answers nothing for any other; the clean repository follows no
167
- redirect, so neither the push nor the token reaches an origin outside the entry; an ssh key is copied into the call's
168
- directory (a Secret mount's mode is one ssh refuses), with `known_hosts` checked strictly. The commit is pinned when
169
- the push starts: the Agent's branch tip, or with `pin` the commit the input names (`{ sha }`); the Effector's first
170
- answer names it, and it is written to the intent row. A pinned commit the Agent pruned fails the import and is never
171
- substituted. `squash` makes one commit with the input's `{ message }`, on the published base: the Agent's tree, its
172
- author line and date, the Machine's message. It is a new commit, so it needs a committer. With `sign`, the signer is
173
- the committer, as for every signed copy. Without it (signing is optional, and `squash` is an option of its own), the
174
- matching `git.credentials` entry's `committer: { name, email }` commits it, at the Effector's clock — or, when the
175
- entry names no committer, its `sign` field's name and email. `jr2 up` refuses `squash` without `sign` only when the
176
- matched entry has neither `sign` nor `committer`, naming both fixes (a `committer`, or a signed push and its `sign`
177
- field), and the provision refuses it the same way for a slot the run or a `customize()` binds. `force` replaces what
178
- the remote holds. A Workspace with no Repo Slot has no branch to push, so a `push` there is refused, by `jr2 up` and
179
- at invoke (ADR-0051).
166
+ - **A `push` pushes a Worktree's branch to its Repo Slot's Binding**, from the Sandbox Effector:
167
+ `push({ pin?, sign?, squash?, force?, slot?, timeout? })`, with `worktree` in its input and no `to` and no `branch`.
168
+ `slot` stays static: a Machine with one slot leaves it out, and a Machine with two names it. The Orchestrator finds
169
+ the cut's settled row in the run's ledger, by the path and this Sandbox, and tells the Effector which branch to
170
+ publish. An Agent can change all of git in the pod, and it cannot change that row. With a read of HEAD,
171
+ `git switch main` would publish `main`. With an input key, a Chart could aim at any remote branch. A push with no row,
172
+ a row of another slot, or a detached Worktree is `rejected` at stage `start`. The ledger key is (slot, branch). The
173
+ local name equals the remote name, so an Agent, a Gate and a person in the pod all see the real branch. Its credential
174
+ is the push credential of the `git.credentials` entry the Repo Slot's url falls under (ADR-0051): the provision
175
+ matches the url the run binds — static, per-run or `customize()`-bound, one path — and names that entry's push Secret
176
+ on the Sandbox, and the Effector, which holds only the entries named there, matches the push's url as the fence does.
177
+ git never runs with the Agent's repository as its repository: each call makes a new bare repository in the Effector's
178
+ scratch, configured by jr2 under a cleared environment; it reads that branch as data (a loose ref or `packed-refs`,
179
+ opened beneath with no symlink, bounded); it imports the Agent's objects as data — one `pack-objects` over the Agent's
180
+ object store with a deadline (a FIFO in place of an object blocks an open forever), `index-pack --strict`, and a
181
+ connectivity check — borrowing only from the node's Repo cache; and it pushes `<commit>:refs/heads/<branch>` to the
182
+ Binding url, never to a remote of the Agent's config, and never to a local path (git's local transport runs that
183
+ repository's config and hooks, and a path in the pod can be the Agent's own repository; only the binary's tests can
184
+ allow one). So no config, hook, attribute or program of the Agent's runs; a test plants each in the Agent's repository
185
+ and proves none ran. A token goes Basic over https through a credential helper only — an `http://` url with a token is
186
+ `rejected` with nothing sent — and the helper is the Effector binary (`effector git-credential`), which reads the
187
+ token's file when git asks for the Binding's own host over https and answers nothing for any other; the clean
188
+ repository follows no redirect, so neither the push nor the token reaches an origin outside the entry; an ssh key is
189
+ copied into the call's directory (a Secret mount's mode is one ssh refuses), with `known_hosts` checked strictly. The
190
+ commit is pinned when the push starts: the tip of that branch, never HEAD, or with `pin` the commit the input names
191
+ (`{ sha }`); the Effector's first answer names it, and it is written to the intent row. A pinned commit the Agent
192
+ pruned fails the import and is never substituted. `squash` makes one commit with the input's `{ message }`, on the
193
+ published base: the Agent's tree, its author line and date, the Machine's message. It is a new commit, so it needs a
194
+ committer. With `sign`, the signer is the committer, as for every signed copy. Without it (signing is optional, and
195
+ `squash` is an option of its own), the matching `git.credentials` entry's `committer: { name, email }` commits it, at
196
+ the Effector's clock — or, when the entry names no committer, its `sign` field's name and email. `jr2 up` refuses
197
+ `squash` without `sign` only when the matched entry has neither `sign` nor `committer`, naming both fixes (a
198
+ `committer`, or a signed push and its `sign` field), and the provision refuses it the same way for a slot the run or a
199
+ `customize()` binds. `force` replaces what the remote holds. A Workspace with no Repo Slot has no branch to push, so a
200
+ `push` there is refused, by `jr2 up` and at invoke (ADR-0051).
180
201
  - **`sign`: nothing unsigned leaves.** The Effector re-creates the Agent's commits, each signed with the entry's `sign`
181
202
  key — ssh (`ssh-keygen -Y sign`) by default, GPG allowed; a GPG key with a passphrase is refused, by name. The author
182
203
  line, its date included, stays the Agent's; the committer is the entry's name and email at the Effector's clock. The
@@ -199,7 +220,7 @@ Orchestrator's own process, the one Effect that does: it starts the run through
199
220
  push and before anything is signed, the same map runs over the new commits, oldest first, and a commit that has a
200
221
  published twin is replaced by that twin in the rewritten history; only the unmapped commits are signed. The twin is a
201
222
  ledger pair, taken as it is — each names the one exact commit a push published for its source, a signed copy or a
202
- squashed commit; the pairs of every push of the Repo Slot are read, each only while the remote still holds its
223
+ squashed commit; the pairs of every push of the (slot, branch) are read, each only while the remote still holds its
203
224
  published commit, the newest push's when two name one source — or else a published commit after the commit's merge
204
225
  base with the remote's tip, each taken once, that has the commit's cherry key, read with the commit's parents as
205
226
  mapped so far (a merge of the Agent's own side branch keys on the published copies of its non-first parents), and is a
@@ -217,68 +238,69 @@ Orchestrator's own process, the one Effect that does: it starts the run through
217
238
  hold). A push that publishes nothing new carries one too: when `pair` or `cherry` maps the published tip itself (a
218
239
  restore that sends a pinned push again, a push after a sync that did not finish), or the published tip is this
219
240
  squash's own (a restore that sends a squash push again), the Agent's branch still holds its own commits. The bundle
220
- never reaches the Machine. A push sends every pair the ledger holds for its Workspace and Repo Slot — one branch on
221
- one remote — oldest push first (`pairs`, omitted when there is none): each push that published, with its published
222
- commit, its source and its `squashed`; the Effector stays stateless. The pair stands for the published tip only while
223
- the remote still holds that push: a remote that moved past it (another writer) is paired by `cherry` or is `diverged`,
224
- never grafted onto. The Agent is never told to rebase: a rebase repair loses a reworded message and duplicates empty
225
- commits and merges. A published commit is never signed twice, for every signer and key type: a side branch the Agent
226
- made before the push and merges later carries the unsigned original of a commit the remote holds signed, which
227
- ancestry calls new, and the map replaces it by its twin — a merge the Agent made before the first push included, and,
228
- through the ledger's pairs, a side branch made before a squash and merged by any later push, whose commits the
229
- squashed commit stands for: the squash's pair maps its source to the squashed commit however many pushes came after
230
- it, so a side branch merged by one push and a branch made on it merged by the next publish only what is new. The pair
231
- maps a squash's SOURCE only, and that is a named limit: a side branch made at an earlier commit of the squashed range
232
- publishes the commits it descends from as signed copies beside the squashed commit. Those commits were never
233
- published, none is signed twice, and the trees are the Agent's; such a commit has no faithful twin, and mapped to the
234
- squashed commit the push would publish a false diff. The committer date stays the Effector's clock; a deterministic
235
- re-sign (the Agent's committer date) was rejected, since it rests on one key type's property, not GPG's or ECDSA's. A
236
- key alone does not pair: a commit the Agent reverts and applies again with cherry-pick has the key of the first one,
237
- and the first one's published copy has older parents, so paired with it the push would offer that older copy as the
238
- new tip — `rejected` as non-fast-forward without `force`, a rewind of the remote with it. The faithful image is the
239
- rule; the cherry fallback keeps its own, that the last paired commit holds the published tip's tree. The map's cost is
240
- bounded by the push's size.
241
+ never reaches the Machine. A push sends every pair the ledger holds for its Workspace and its (slot, branch) — one
242
+ branch on one remote — oldest push first (`pairs`, omitted when there is none): each push that published, with its
243
+ published commit, its source and its `squashed`; the Effector stays stateless. The pair stands for the published tip
244
+ only while the remote still holds that push: a remote that moved past it (another writer) is paired by `cherry` or is
245
+ `diverged`, never grafted onto. The Agent is never told to rebase: a rebase repair loses a reworded message and
246
+ duplicates empty commits and merges. A published commit is never signed twice, for every signer and key type: a side
247
+ branch the Agent made before the push and merges later carries the unsigned original of a commit the remote holds
248
+ signed, which ancestry calls new, and the map replaces it by its twin — a merge the Agent made before the first push
249
+ included, and, through the ledger's pairs, a side branch made before a squash and merged by any later push, whose
250
+ commits the squashed commit stands for: the squash's pair maps its source to the squashed commit however many pushes
251
+ came after it, so a side branch merged by one push and a branch made on it merged by the next publish only what is
252
+ new. The pair maps a squash's SOURCE only, and that is a named limit: a side branch made at an earlier commit of the
253
+ squashed range publishes the commits it descends from as signed copies beside the squashed commit. Those commits were
254
+ never published, none is signed twice, and the trees are the Agent's; such a commit has no faithful twin, and mapped
255
+ to the squashed commit the push would publish a false diff. The committer date stays the Effector's clock; a
256
+ deterministic re-sign (the Agent's committer date) was rejected, since it rests on one key type's property, not GPG's
257
+ or ECDSA's. A key alone does not pair: a commit the Agent reverts and applies again with cherry-pick has the key of
258
+ the first one, and the first one's published copy has older parents, so paired with it the push would offer that older
259
+ copy as the new tip — `rejected` as non-fast-forward without `force`, a rewind of the remote with it. The faithful
260
+ image is the rule; the cherry fallback keeps its own, that the last paired commit holds the published tip's tree. The
261
+ map's cost is bounded by the push's size.
241
262
  - **The sync: after every push whose published commit is not the Agent's own, the Agent's branch moves to it** — signed
242
263
  copies, or one squashed commit, signed or not; the decision keys on `published` ≠ `source`, never on `sign` — in the
243
264
  Harness container (`POST /sync`, behind the Harness bearer, ADR-0058), from the bundle the Effector wrote, which the
244
265
  Orchestrator relays — never a shared volume: the Worktree stays read-only on the credentialed side. Under a cleared
245
- environment and a config that names no hook, no fsmonitor, no alternate-refs command and no maintenance, the Harness
246
- verifies and unbundles the bundle (objects only), checks that the published tip is a commit with the source's tree (it
247
- reads no signature), answers `busy` when a rebase of the branch, or a merge, cherry-pick, revert or sequence in a
248
- worktree whose HEAD is the branch, is in progress, and otherwise copies each commit the Agent made after the source as
249
- its raw object with only its parents changed, then moves the branch with one `git update-ref <new> <old>` — a
250
- compare-and-swap, tried again from the new tip at most 3 times — so files, index, HEAD and stash do not change. Its
251
- answer is a field of the push's output beside the outcome: `sync: synced | already | skipped | busy | not-synced`,
252
- with `syncReason` when it moved nothing (a push that published the Agent's own commit is `skipped`, with no call and
253
- no bundle; every other push is synced, one that published nothing new included, so a plain push of the slot after a
254
- squash is a fast-forward of the squashed commit). A Harness that cannot be reached answers `not-synced`; the push
255
- stays `pushed`. When the last push of a Repo Slot answered `busy` or `not-synced`, jr2 runs its sync again before that
256
- slot's next push, in that slot's Worktree and with that push's bundle, which its row keeps until a sync finished or a
257
- newer push of the slot published. The push never trusts the sync's answer: the Agent owns its repository and can move
258
- the branch at any time, so the next push derives everything again from the remote and the Agent's objects. After such
259
- a push the Agent reads, beside the output, what moved — signed copies of its commits with new ids, or its commits
260
- squashed into one commit, named "signed" only when it is — and that jr2 moved its branch to it, or did not and why;
261
- that its files, index and stash did not change; and that amending, rebasing or resetting the pushed commits makes the
262
- next push `diverged`. The Harness keys that paragraph on a synced push whose published commit is not the Agent's, and
263
- its words on `squashed`. A push in which jr2 counted no new commit (`newCommits: 0`) is still `pushed`, because the
264
- push ran and the remote's branch may have moved (a new branch at a commit the remote held on another branch). But
265
- `pushed` alone does not tell the Agent that its work did not go out: in a real Haiku 5.5 run, the model sent a
266
- `git commit` that failed and the push in one answer, the push published the branch at a commit the remote already
267
- held, and the model read `pushed` as its work published. So beside the output the Agent reads that jr2 counted no new
268
- commit in this push, that it found the published commit already on the remote or in jr2's copy of the remote, and that
269
- a change it did not commit before the push is not in this push. The words name where jr2 looked because the count
270
- reads the Repo cache, which fetches without pruning: a commit the remote dropped can stay there, and then a count of 0
271
- is not a fact about the remote, which is why the first clause names what jr2 counted. No @model claim reaches
272
- `newCommits: 0`, so no measurement has read these words. When the signed-copies or squash paragraph above also
273
- applies, it names "an earlier push" as the one that signed or squashed, so the two do not contradict. The Harness keys
274
- the sentence on `newCommits: 0` alone, and says nothing with no count. The count is optional on the wire: a live
275
- Sandbox keeps the runtime it started with (ADR-0037), so after `jr2 up` its older Effector answers `pushed` with no
276
- `newCommits`, and a required field would fault a push that reached the remote. The count's input to
277
- `git rev-list --stdin` is revisions only (`^<sha>` for each tip the remote held), never `--not`: git takes an option
278
- there only from 2.42, and the Sandbox Effector runs its image's git — the Sandbox Image's, unless the `workspace()`
279
- names one — which can be older (Debian bookworm's is 2.39). A distinct outcome (`unchanged`, `up-to-date`) was
280
- rejected: every consumer of a push keys on `pushed` (the ledger's pairs, the sync, the Machines' guards), and a push
281
- that made a new branch did change the remote.
266
+ environment and a config that names no hook, no fsmonitor, no alternate-refs command and no maintenance — and with its
267
+ git confined, as every process it starts in `/work` (ADR-0076), because a filter or a textconv in the shared
268
+ `.git/config` runs in git's process — the Harness verifies and unbundles the bundle (objects only), checks that the
269
+ published tip is a commit with the source's tree (it reads no signature), answers `busy` when a rebase of the branch,
270
+ or a merge, cherry-pick, revert or sequence in a worktree whose HEAD is the branch, is in progress, and otherwise
271
+ copies each commit the Agent made after the source as its raw object with only its parents changed, then moves the
272
+ branch with one `git update-ref <new> <old>` — a compare-and-swap, tried again from the new tip at most 3 times — so
273
+ files, index, HEAD and stash do not change. Its answer is a field of the push's output beside the outcome:
274
+ `sync: synced | already | skipped | busy | not-synced`, with `syncReason` when it moved nothing (a push that published
275
+ the Agent's own commit is `skipped`, with no call and no bundle; every other push is synced, one that published
276
+ nothing new included, so a plain push of the slot after a squash is a fast-forward of the squashed commit). A Harness
277
+ that cannot be reached answers `not-synced`; the push stays `pushed`. When the last push of a (slot, branch) answered
278
+ `busy` or `not-synced`, jr2 runs its sync again before the next push of that key, in the Worktree of that push and
279
+ with its bundle, which its row keeps until a sync finished or a newer push of that key published. The push never
280
+ trusts the sync's answer: the Agent owns its repository and can move the branch at any time, so the next push derives
281
+ everything again from the remote and the Agent's objects. After such a push the Agent reads, beside the output, what
282
+ moved — signed copies of its commits with new ids, or its commits squashed into one commit, named "signed" only when
283
+ it is — and that jr2 moved its branch to it, or did not and why; that its files, index and stash did not change; and
284
+ that amending, rebasing or resetting the pushed commits makes the next push `diverged`. The Harness keys that
285
+ paragraph on a synced push whose published commit is not the Agent's, and its words on `squashed`. A push in which jr2
286
+ counted no new commit (`newCommits: 0`) is still `pushed`, because the push ran and the remote's branch may have moved
287
+ (a new branch at a commit the remote held on another branch). But `pushed` alone does not tell the Agent that its work
288
+ did not go out: in a real Haiku 5.5 run, the model sent a `git commit` that failed and the push in one answer, the
289
+ push published the branch at a commit the remote already held, and the model read `pushed` as its work published. So
290
+ beside the output the Agent reads that jr2 counted no new commit in this push, that it found the published commit
291
+ already on the remote or in jr2's copy of the remote, and that a change it did not commit before the push is not in
292
+ this push. The words name where jr2 looked because the count reads the Repo cache, which fetches without pruning: a
293
+ commit the remote dropped can stay there, and then a count of 0 is not a fact about the remote, which is why the first
294
+ clause names what jr2 counted. No @model claim reaches `newCommits: 0`, so no measurement has read these words. When
295
+ the signed-copies or squash paragraph above also applies, it names "an earlier push" as the one that signed or
296
+ squashed, so the two do not contradict. The Harness keys the sentence on `newCommits: 0` alone, and says nothing with
297
+ no count. The count is optional on the wire: a live Sandbox keeps the runtime it started with (ADR-0037), so after
298
+ `jr2 up` its older Effector answers `pushed` with no `newCommits`, and a required field would fault a push that
299
+ reached the remote. The count's input to `git rev-list --stdin` is revisions only (`^<sha>` for each tip the remote
300
+ held), never `--not`: git takes an option there only from 2.42, and the Sandbox Effector runs its image's git — the
301
+ Sandbox Image's, unless the `workspace()` names one — which can be older (Debian bookworm's is 2.39). A distinct
302
+ outcome (`unchanged`, `up-to-date`) was rejected: every consumer of a push keys on `pushed` (the ledger's pairs, the
303
+ sync, the Machines' guards), and a push that made a new branch did change the remote.
282
304
  - **The process group ends with the exec.** Each exec leads its own group; its timeout, a kill, and its top process's
283
305
  exit each SIGKILL the group, so nothing that stays in the group outlives it. In the Harness container a descendant
284
306
  that leaves the group (`setsid`) is not killed; it holds no credential. A credentialed command's descendant cannot
@@ -292,30 +314,33 @@ Orchestrator's own process, the one Effect that does: it starts the run through
292
314
  carries that transition, so a restart that loses the transition's save still delivers the output and runs nothing. On
293
315
  restore: settled → the output is delivered; no row → nothing was sent, so it starts; intent → per kind. A `command`
294
316
  that names no secret re-attaches to the exec by id, or settles `unknown` when the Harness no longer knows it (it
295
- restarted); it is never run again by jr2: it runs the Agent's code, which may spend a Stand-in. A `push` intent row
296
- names its Sandbox and, once the Effector's first answer names it, the pinned commit: a restore asks the Effector for
297
- the id and follows it, and when the Effector no longer holds it the push is sent again with only that commit — never
298
- the Agent's tip now — because its run is a function of the commit and its credential, what the intent row records;
299
- with no commit recorded it settles `unknown`. A credentialed command follows the push's rule: its intent row names its
300
- Sandbox and, once the first answer names it, the pinned commit, and one the Effector lost is sent again with only that
301
- commit, since its run is a function of (commit, argv, secrets). An `http` intent row names its placement — the
302
- Instance Effector, or the Sandbox of a file-body `http` — and no replica: the Effect asks every replica of that
303
- Effector for its id and follows the one that holds it; when none does, it is sent again only when the author marked it
304
- `idempotent`, and any other settles `unknown`. Retry is the author's choice — a route back into the state, or
305
- `idempotent` for a call that carries its own idempotency key or only reads. No row is dropped: each settled or aborted
306
- row keeps the Effect's id, kind and outcome for the run's life, the record of what the run's Effects did. A settled
307
- row's output tail is dropped once the save that carries its transition is on disk; the full stream is on the feed. An
308
- `http` response's body and headers are its tail: the row keeps the outcome, the status, the content type and the size,
309
- and the settled line on the feed carries the whole response. A `push` row keeps its Repo Slot, its published commit,
310
- its source, its `squashed` and its sync's answer whole — every later push of its Workspace and Repo Slot sends them as
311
- one of its pairs, and the newest push's sync, when it did not finish, runs again — and drops git's words; it drops its
312
- bundle once its sync answered `synced`, `already` or `skipped`, and keeps it while the sync is `busy` or `not-synced`
313
- only as long as it is the newest push of its Repo Slot that published, because the sync that runs again moves the
314
- branch from it and only the newest push's sync runs again. Once a newer push of the slot published, the older row's
315
- bundle goes at the next save: one bundle per Repo Slot at most. So an Effect in a loop grows the ledger by one short
316
- row per pass, never by its tails. One exception, bounded by one pick: while a pick is outstanding, its hold keeps the
317
- `chain` whole, tails included, because an `answer` action may read it after a restore; a loop below the Agent's state
318
- then grows the hold by one tail per pass. The hold drops its chain when the pick is answered.
317
+ restarted); it is never run again by jr2: it runs the Agent's code, which may spend a Stand-in. A cut is the
318
+ exception: it runs the kit's program and is marked idempotent, so a restore or a Harness restart sends it again with
319
+ the same id. A `push` intent row names its Sandbox and, once the Effector's first answer names it, the pinned commit:
320
+ a restore asks the Effector for the id and follows it, and when the Effector no longer holds it the push is sent again
321
+ with only that commit — never the Agent's tip now — because its run is a function of the commit and its credential,
322
+ what the intent row records; with no commit recorded it settles `unknown`. A credentialed command follows the push's
323
+ rule: its intent row names its Sandbox and, once the first answer names it, the pinned commit, and one the Effector
324
+ lost is sent again with only that commit, since its run is a function of (commit, argv, secrets). An `http` intent row
325
+ names its placement — the Instance Effector, or the Sandbox of a file-body `http` — and no replica: the Effect asks
326
+ every replica of that Effector for its id and follows the one that holds it; when none does, it is sent again only
327
+ when the author marked it `idempotent`, and any other settles `unknown`. Retry is the author's choice — a route back
328
+ into the state, or `idempotent` for a call that carries its own idempotency key or only reads. No row is dropped: each
329
+ settled or aborted row keeps the Effect's id, kind and outcome for the run's life, the record of what the run's
330
+ Effects did. A settled row's output tail is dropped once the save that carries its transition is on disk; the full
331
+ stream is on the feed. An `http` response's body and headers are its tail: the row keeps the outcome, the status, the
332
+ content type and the size, and the settled line on the feed carries the whole response. A `push` row keeps its Repo
333
+ Slot, its branch, its published commit, its source, its `squashed` and its sync's answer whole — every later push of
334
+ its Workspace and (slot, branch) sends them as one of its pairs, and the newest push's sync, when it did not finish,
335
+ runs again — and drops git's words; it drops its bundle once its sync answered `synced`, `already` or `skipped`, and
336
+ keeps it while the sync is `busy` or `not-synced` only as long as it is the newest push of its (slot, branch) that
337
+ published, because the sync that runs again moves the branch from it and only the newest push's sync runs again. Once
338
+ a newer push of that key published, the older row's bundle goes at the next save: one bundle per (slot, branch) at
339
+ most. A cut's `ready` row keeps its Repo Slot, its path and its branch whole, because a later Effect reads them. So an
340
+ Effect in a loop grows the ledger by one short row per pass, never by its tails. One exception, bounded by one pick:
341
+ while a pick is outstanding, its hold keeps the `chain` whole, tails included, because an `answer` action may read it
342
+ after a restore; a loop below the Agent's state then grows the hold by one tail per pass. The hold drops its chain
343
+ when the pick is answered.
319
344
  - **A start is sent once where it may have arrived.** A Harness runs one id once only within its own process; a
320
345
  restarted Harness knows no id. So the Orchestrator sends a start again only when it certainly never left (the
321
346
  connection was refused, the name did not resolve). Any other failure — a reset, a 5xx, no answer — may follow a start
@@ -374,6 +399,9 @@ Orchestrator's own process, the one Effect that does: it starts the run through
374
399
  binds the argv, refuses there a param the bound argv does not read, and gives the bound Machine the warnings the walk
375
400
  gives for that argv (ADR-0054).
376
401
 
402
+ - **The load walk refuses an Effect's `onDone` with no unguarded last arm.** A type cannot see a missing arm, and with
403
+ no match a run stays in that state and shows no fault.
404
+
377
405
  ## Considered options
378
406
 
379
407
  - **Run every command in the Sandbox Effector.** Rejected: a command that names no secret runs the Workspace's own code