Commit d1d8b49
authored
feat: graduation machinery wave B — external execution (ak run drives an admitted host) (ADR-0031 P2) (#155)
* feat(adapters): manifest execution block + hook-runner stdin/cwd (ADR-0031 P2, schema half)
Manifest gains an optional execution.run hook, coupled to canRouteActivities
(else refused 'execution-not-routable'); it is part of the hashed content.
runAdapterHook gains stdin (EPIPE-safe), an absolute-validated cwd, and
separate stdoutText/stderrText captures — the substrate the derived execution
adapter needs to run a hook without inheriting ak's cwd or promoting stderr
into a downstream prompt.
* feat(execution): ak run drives an admitted external host as a supervised subprocess (ADR-0031 P2)
executionAdapterFor falls through to a manifest-derived subprocess adapter for
an admitted host; routing is overlay-aware via a lazy effectiveRoutableHostIds().
No third-party code runs in-process — the hook is one subprocess ak owns.
Security-hardened across an adversarial review (blockers + regressions all
re-verified closed):
- hooks spawn with cwd pinned to the adapter's own resolved directory, never
the operator's cwd; a relative hook on a remote (unanchorable) source is
refused ('execution-unanchored'). The consent hash still pins the manifest
text; resolution is a pure function of it plus the pinned source.
- AK_WORKER_CWD carries the target repo without reopening that pin
- an unresolved-launch cancellation reports non-escalating 'orphaned', never an
escalatable 'timed_out' (no double-run)
- the structured payload is parsed from stdout alone, so a stray stderr line
never collapses a worker's handoff or leaks logs into a cross-vendor prompt
- reserved hook exit codes 77/78 express permission_required/auth_required
- a self-declared provider is stamped 'inferred', handoff data is redacted from
public results, and driving.surfaces must include cli-subprocess (no downgrade)
The black-box conformance test now drives the real command resolver end-to-end:
a genuinely spawned subprocess, cwd anchored by production code.
* docs(adr): ADR-0029 cli-subprocess execution contract; ADR-0031 external-execution row Working
Records the command-resolution policy, reserved exit codes, and the
no-trust-laundering rules settled while wiring external execution, plus the
honest boundary of the remote-source anchorability screen.1 parent f54e841 commit d1d8b49
15 files changed
Lines changed: 1546 additions & 54 deletions
File tree
- docs/adr
- src/lib
- adapters
- execution
- tests
- fixtures/adapters/acme
- kit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
145 | 183 | | |
146 | 184 | | |
147 | 185 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
15 | 40 | | |
16 | 41 | | |
17 | 42 | | |
| |||
193 | 218 | | |
194 | 219 | | |
195 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
196 | 262 | | |
197 | 263 | | |
198 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| |||
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
107 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
108 | 123 | | |
109 | 124 | | |
110 | 125 | | |
| |||
127 | 142 | | |
128 | 143 | | |
129 | 144 | | |
130 | | - | |
131 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
132 | 149 | | |
133 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
138 | 157 | | |
139 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
140 | 166 | | |
141 | 167 | | |
142 | 168 | | |
143 | 169 | | |
144 | 170 | | |
| 171 | + | |
145 | 172 | | |
146 | 173 | | |
147 | 174 | | |
148 | 175 | | |
149 | 176 | | |
150 | | - | |
| 177 | + | |
151 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
152 | 183 | | |
153 | 184 | | |
154 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
155 | 188 | | |
156 | 189 | | |
157 | 190 | | |
158 | 191 | | |
159 | 192 | | |
160 | 193 | | |
161 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
162 | 210 | | |
163 | 211 | | |
164 | 212 | | |
| |||
175 | 223 | | |
176 | 224 | | |
177 | 225 | | |
| 226 | + | |
| 227 | + | |
178 | 228 | | |
179 | 229 | | |
180 | 230 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
185 | 234 | | |
186 | 235 | | |
187 | 236 | | |
188 | 237 | | |
189 | 238 | | |
190 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
191 | 242 | | |
192 | 243 | | |
193 | 244 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
198 | 255 | | |
199 | | - | |
200 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
201 | 262 | | |
0 commit comments