1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! Which commit answers the **workflow** question (ARCH §6 *The workflow
//! mark*, `docs/DESIGN_WORKFLOW_SWITCH.md`).
//!
//! The workflow — the named what-happens-next policy, `workflow.yaml`
//! (§6) — is the one control fact with a per-agent override: a standing
//! **workflow mark** ([`crate::workspace::workflow_mark`]) names the
//! config commit whose `workflow.yaml` governs the agent instead of
//! the followed config commit's (§2.2 follow-the-tip, bl-403b — so the
//! mark both switches the workflow and pins it against tip movement). Because resolution runs fresh at every hop (§6 "no resident
//! interpreter"), consulting the mark here makes the switch effective at
//! the agent's next step boundary with no landing machinery at all —
//! writing the ref *is* the switch.
//!
//! The derivation is **nearest mark on the agent's descent**: the
//! agent's own id first, then each ancestor by
//! [`crate::prompt::inbox::parent_of`] — so marking a root switches its
//! whole tree, and a child's own mark overrides its ancestors', the same
//! nearest-wins shape as governing-config ancestry (§2.2). A fresh root
//! about to fork ([`ConfigSource::Fork`]) has no id yet and so no mark:
//! the followed commit answers, which is the whole path every unmarked
//! agent takes.
use ;
use crateWorkflow;
use crateVersion;
use crate;
use crateGitRunner;
use crateworkflow_mark;
use Path;
/// The agent's workflow (§6) **and the commit it was read from**: the
/// nearest workflow mark's commit when one stands, else the governing
/// config commit — the general path. A marked commit gets its own §10
/// schema-version guard before its workflow is interpreted, exactly as
/// the governing commit did in [`super::resolve_worker`]: a mark aimed
/// at a commit authored by a newer harness declines before parsing
/// shapes it cannot read.
///
/// The commit comes back rather than being re-derived by whoever wants
/// it: the mark is a ref an operator may rewrite at any moment, so a
/// second read of it after the step is a different question with a
/// different answer. The step record's provenance (bl-e4a0) is what
/// *this* resolution answered.
pub
/// **Which commit answers the workflow question for one agent, and
/// why** — the derivation above as a value, so the resolver and the
/// operator read (`litany workflow <ws> <agent>`, bl-5c02) compose it
/// once instead of each spelling out "nearest mark, else the followed
/// commit". Without this the only way to ask was raw git against a ref
/// namespace no verb printed.
pub
/// Compose the derivation: the nearest mark on the descent, else
/// `followed`. A [`ConfigSource::Fork`] is a root that has no id yet and
/// therefore no mark — the general path with empty inputs, not a case.
pub
/// One workflow read: `<commit>:workflow.yaml`, parsed under the closed
/// §6 vocabulary. The same read whichever commit answers — marked or
/// governing — so no second code path exists to drift.
/// The nearest workflow mark on `agent_id`'s descent — its own, else
/// the walk up `parent_of` to the root. `None` — no mark anywhere on
/// the chain — is the ordinary state of every agent. Shared with the §6
/// dispatch budget gate ([`crate::prompt::child_dispatch`]), so the
/// ceiling a fork is refused under and the ceiling the child's own
/// steps check are one answer, not two.
/// The answer is the **holder and the commit**, not the commit alone:
/// which id on the descent carries the mark is the half an operator
/// cannot derive from the agent they asked about, and it is what makes
/// "marking a root switches the tree" legible on the read surface.
pub