Skip to content

Commit e40353f

Browse files
committed
πŸ“ Align the target with #203 as merged and restore the printing contract
Rebased onto 511776e. #326 closed #203 by proving the two projection lifetimes with real modifiers β€” L8 for a projected `persist` resource and Q14 for a projected daemon β€” which were the acceptance criteria this target had the weakest evidence for. Projected content keeping its caller's bindings while its live effects belong to the component invocation is now stated as shipped, along with why it matters: a process a stage starts stops before the workspace it ran in is removed, which is the ordering `<Worktree>` (#293) is built on. `architecture.md` is authoritative on the error model, so the `output` row reads "fails the run; `<PrintErrors>` can print instead" as the registry states it. The engine does not do that yet β€” an outer boundary ends the run instead, whether the failure arose in the region itself or in content projected into it β€” so the discrepancy is classified as missing and filed as #327 rather than allowed to redefine the settled contract. No stage writes `<PrintErrors>`, so nothing here depends on it. The distinction the target does keep is the one the registry makes: a `throw` decision is the mode a boundary cannot replace. Every stage's parsing sits in documentation, so the final `<Parse>` is a gate for that reason and not because printing is unavailable.
1 parent 6d92b50 commit e40353f

3 files changed

Lines changed: 47 additions & 11 deletions

File tree

β€Žspecs/adversarial-implementation-workflow.mdβ€Ž

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,23 @@ stage's output is also material a user reads at a checkpoint.
217217

218218
A stage's `<Output>` region runs under the `output` error mode; everything
219219
outside it is documentation and runs under `throw`. An undecided error at either
220-
position fails the run rather than producing a result a caller would bind, and
221-
no `<PrintErrors>` region can convert a documentation failure into a printed
222-
error. That is what makes each stage's final `<Parse>` a gate: malformed agent
223-
output cannot reach control flow or a deterministic effect.
220+
position fails the run rather than producing a result a caller would bind. The
221+
two modes differ in what a printing boundary may do about it: a `<PrintErrors>`
222+
region can print an `output` decision instead of failing, and `throw` is the one
223+
mode it cannot replace β€” a printed error in documentation is one nobody can
224+
read. Neither rescues a stage here, because every stage's parsing sits in
225+
documentation. That is what makes each stage's final `<Parse>` a gate: malformed
226+
agent output cannot reach control flow or a deterministic effect.
224227

225228
A failing region keeps only what it had already rendered. That partial text
226229
reaches the output stream; nothing after the failure does. Continuing after a
227230
failure is always explicit β€” a bounded repair turn the document shows, not
228231
recovery the engine performs on the author's behalf.
229232

233+
Printing an `output` decision is settled contract that the engine has not built
234+
yet: an outer `<PrintErrors>` currently ends the run instead (#327). No stage
235+
depends on it today.
236+
230237
`throwOnError` on a `<Prompt>` is required for the same reason: without it a
231238
failed prompt records its failure and returns its text, raising nothing for the
232239
error mode to decide, and the stage would continue with an empty reply.
@@ -374,6 +381,15 @@ Resources clean up with their execution by default. Agent sessions, processes,
374381
streams, and other ongoing effects always stop before their enclosing scope
375382
closes.
376383

384+
Ownership follows the invocation, not the author. Content a caller writes and a
385+
component only projects keeps the caller's bindings, but its live effects belong
386+
to the component invocation and stop before that invocation cleans up its own
387+
(#203). A daemon or a `persist` resource started inside projected content is
388+
signalled while the component's directory still exists, and is gone once the
389+
invocation returns. That ordering is what makes `<Worktree>` safe to build: a
390+
process a stage starts stops before the workspace it ran in is removed, so
391+
cleanup cannot pull the ground out from under a running effect.
392+
377393
An execution may explicitly retain its workspace for inspection. A failed or
378394
cancelled execution also retains a worktree when removing it would discard
379395
uncommitted or unpushed changes. The execution reports the retained path, branch,

β€Žworkflows/adversarial-implementation/primitives.mdβ€Ž

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
XMD already supplies component expansion, root document props, prompt capture,
66
agent selection, named sessions, collection iteration, scoped permission
7-
policies, and scope-owned process and agent teardown. Its durable execution
7+
policies, and scope-owned process and agent teardown. Every component invocation
8+
owns a resource scope: projected content keeps its caller's bindings but its
9+
live effects β€” daemons, `persist` resources, watchers β€” belong to the invocation
10+
and stop before it cleans up its own, on success, failure, and cancellation
11+
alike (#203). Its durable execution
812
layer also assigns deterministic execution identities, journals effects, and
913
observes completion, failure, or cancellation. Replay restores a recorded
1014
outcome without re-executing it, and a run that failed is still a complete
@@ -57,16 +61,28 @@ structure and read where an error is raised:
5761
| Mode | An undecided error… | Installed by |
5862
| --- | --- | --- |
5963
| `print` | is printed into the document; the run continues | the root; `<PrintErrors>` |
60-
| `output` | fails the run; the region keeps what it already rendered | every `<Output>` region |
64+
| `output` | fails the run; `<PrintErrors>` can print instead | every `<Output>` region |
6165
| `throw` | fails the run, and no printing boundary replaces it | documentation; value roots |
6266

67+
A failing region keeps what it had already rendered: that text reaches the
68+
output stream, and nothing after the failure does.
69+
6370
A component body is split by its `<Output>` boundary: the region inside runs
6471
under `output`, everything outside is documentation and runs under `throw`.
6572
Every stage in this workflow puts its prompts, parsing, and control flow outside
6673
`<Output>`, so a stage returns a complete validated result or it fails β€” it
6774
never returns a half-record. `<Retry>` and `<Result as>` would let a document
6875
handle a failure instead of ending on it; both are defined and unbuilt.
6976

77+
**Missing: printing an `output` decision.** The `output` row above is the
78+
settled contract, and the engine does not meet it yet β€” an outer
79+
`<PrintErrors>` around a region that failed under `output` ends the run instead
80+
of printing, whether the failure arose in the region itself or in content
81+
projected into it ([issue
82+
#327](https://github.com/taras/executable.md/issues/327)). Nothing in this
83+
workflow writes `<PrintErrors>`, so no stage depends on it today; a stage that
84+
wanted to survive a failed region would.
85+
7086
## What the workflow already writes
7187

7288
**Structural syntax** is the language's own. A registration cannot claim one of
@@ -208,8 +224,10 @@ The remaining contracts are missing on the same terms:
208224
sets `Env.cwd` while rendering its children, and cleans up safely
209225
([#293](https://github.com/taras/executable.md/issues/293)). This workflow
210226
keeps discovery, implementor planning, implementation, and review in that
211-
same workspace. `Env.cwd` itself is implemented; what is missing is the
212-
workspace that establishes it and the retention rules that survive failure.
227+
same workspace. `Env.cwd` itself is implemented, and so is the lifetime rule
228+
it composes with: a process a stage starts stops before the invocation that
229+
established the directory cleans up (#203). What is missing is the workspace
230+
that establishes it and the retention rules that survive failure.
213231
4. `<Commit>` validates exact changes and owns Git metadata writes
214232
([#294](https://github.com/taras/executable.md/issues/294)).
215233
5. `<PullRequest>` ([#295](https://github.com/taras/executable.md/issues/295))

β€Žworkflows/adversarial-implementation/start.mdβ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ fail differently:
117117
`<PrintErrors>` region can print it instead β€” which is what makes each
118118
stage's final `<Parse>` a real gate rather than a formality.
119119
- The **`<Output>` region** runs under the `output` error mode: an undecided
120-
error there fails the run too, and the region keeps what it had already
121-
rendered. That partial text reaches the output stream; nothing after the
122-
failure does.
120+
error there fails the run too, though a `<PrintErrors>` region may print it
121+
instead. Either way the region keeps what it had already rendered β€” that
122+
partial text reaches the output stream, and nothing after the failure does.
123+
Printing an `output` decision is the contract; the engine does not do it yet
124+
(#327).
123125

124126
So a stage either returns a complete, schema-validated result or it fails. It
125127
never returns a half-record. The `throwOnError` on each `<Prompt>` is

0 commit comments

Comments
Β (0)