You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/vrs/03-host-local/spec.md
+44-35Lines changed: 44 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,60 +7,68 @@ policy, or a second Doctor health model.
7
7
8
8
## Subject selection and ownership
9
9
10
-
The CLI selects a catalog and an explicit or locally detected host. A
11
-
[`HostLock`](../../../src/host_lock.rs#L1-L67) tracks resident ownership of
12
-
that `(catalog, host)` subject independently from another host's slice of the
13
-
same synced catalog.
10
+
A resident st2 control-plane instance selects one catalog and an explicit or
11
+
locally detected host, then reconciles only that pair. A host may run separate
12
+
resident instances for other catalogs. This instance is the st2 process, not
13
+
the host's root agent or an ordinary supervisor persona. A
14
+
[`HostLock`](../../../src/host_lock.rs#L1-L67) tracks resident ownership of the
15
+
selected `(catalog, host)` subject independently from another host's slice of
16
+
the same synced catalog.
14
17
15
18
## Current mechanism and evidence
16
19
17
20
| Requirement | Current mechanism | Evidence |
18
21
| --- | --- | --- |
19
22
| HOST-R01 | Reconciliation filters every declaration through its resolved host; remote declarations are reported but not acted on. |[`reconcile`](../../../src/reconcile.rs#L106-L191); [host-placement tests](../../../tests/reconcile.rs#L135-L153)|
20
-
| HOST-R02 | One pass discovers declarations, obtains an authoritative local session view, computes desired versus actual, and then adopts or executes the plan. A failed session listing skips the whole pass. |[reconcile pass](../../../src/run.rs#L737-L813); [reconcile-plan model](../../../src/reconcile.rs#L66-L81)|
21
-
| HOST-R03 | The long-running CLI checks for a live owner of the same catalog and host, records its own PID, and reclaims stale ownership. |[catalog supervisor entry](../../../src/main.rs#L1738-L1838); [`HostLock` tests](../../../src/host_lock.rs#L83-L143)|
22
-
| HOST-R04 | PTY and exec tasks survive normal or forced control-plane termination and binary replacement; the successor preserves PID and creation identity while adopting them. |[replacement acceptance](../../../tests/nomad_survival.rs#L592-L701)|
23
-
| HOST-R05 | Normal supervisor exit leaves tasks running. Teardown and retirement are separate paths that target only the selected host's declared task IDs. |[`down` and teardown](../../../src/run.rs#L987-L1056); [explicit-lifecycle acceptance](../../../tests/nomad_survival.rs#L703-L780)|
24
-
| HOST-R06 | The deterministic loop surfaces bounded crash-loop failure to the declared supervisor; the root-agent responsibility itself is owned by root R04. |[crash-loop surfacing](../../../src/run.rs#L1090-L1189); [R04](../requirements.md#L43-L46)|
25
-
| HOST-R07 | Agent/task liveness and the resident supervisor lock are separate observations. A replacement adopts matching work visible in its selected current state. Sidecar-only work does not make an otherwise unrunnable agent live. No global catalog-liveness classifier is implemented. |[replacement adoption](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/tests/nomad_survival.rs#L608-L717); [separate supervisor report](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/src/main.rs#L985-L1008); [DING-only boundary](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/tests/reconcile.rs#L533-L561)|
23
+
| HOST-R02 | One resident-instance pass discovers declarations, obtains an authoritative local session view, computes desired versus actual, and then adopts or executes the plan. A failed session listing skips the whole pass. |[reconcile pass](../../../src/run.rs#L737-L813); [reconcile-plan model](../../../src/reconcile.rs#L66-L81)|
24
+
| HOST-R03 | The resident st2 control-plane instance checks for a live owner of the same catalog and host, records its own PID, and reclaims stale ownership. |[control-plane entry](../../../src/main.rs#L1738-L1838); [`HostLock` tests](../../../src/host_lock.rs#L83-L143)|
25
+
| HOST-R04 | PTY and exec tasks survive normal or forced resident st2 control-plane instance termination and binary replacement; the successor instance preserves PID and creation identity while adopting them. |[replacement acceptance](../../../tests/nomad_survival.rs#L592-L701)|
26
+
| HOST-R05 | Normal resident st2 control-plane instance exit leaves tasks running. Teardown and retirement are separate paths that target only the selected host's declared task IDs. |[`down` and teardown](../../../src/run.rs#L987-L1056); [explicit-lifecycle acceptance](../../../tests/nomad_survival.rs#L703-L780)|
27
+
| HOST-R06 | The deterministic loop surfaces bounded crash-loop failure to the declared supervisor persona; the distinct root-agent responsibility is owned by root R04. |[crash-loop surfacing](../../../src/run.rs#L1090-L1189); [R04](../requirements.md#L43-L46)|
28
+
| HOST-R07 | Agent/task liveness and the resident st2 control-plane instance's `HostLock` record are separate observations. A replacement instance adopts matching work visible in its selected current state. Sidecar-only work does not make an otherwise unrunnable agent live. No global catalog-liveness classifier is implemented. |[replacement adoption](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/tests/nomad_survival.rs#L608-L717); [separate control-plane report](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/src/main.rs#L985-L1008); [DING-only boundary](https://github.com/compoundingtech/st2/blob/661c88b6e50cddbdf85e8ffaca9245c46491a1e0/tests/reconcile.rs#L533-L561)|
26
29
| HOST-R08 | Stable catalog-root and PTY-root path lifetime is an accepted constraint. The guided coordinated relocation operation is not implemented. |[migration contract](https://github.com/compoundingtech/st2/issues/85)|
27
30
28
31
## Catalog liveness and path lifetime
29
32
30
-
A live canonical catalog agent keeps the catalog live across supervisor
31
-
downtime. The missing supervisor is separate factual state: it can delay
32
-
convergence, but it cannot turn the continuing agent into dead work, erase the
33
-
last-applied catalog, or authorize teardown. On restart, st2 adopts matching
34
-
work that is visible in the selected current state and launches only genuinely
35
-
missing work. A surviving generated DING sidecar without a canonical agent does
36
-
not satisfy the catalog-agent liveness predicate.
33
+
A live canonical catalog agent keeps the catalog live across resident st2
34
+
control-plane instance downtime. The absent instance is separate factual state:
35
+
it can delay convergence, but it cannot turn the continuing agent into dead
36
+
work, erase the last-applied catalog, or authorize teardown. On restart, st2
37
+
adopts matching work that is visible in the selected current state and launches
38
+
only genuinely missing work. A surviving generated DING sidecar without a
39
+
canonical agent does not satisfy the catalog-agent liveness predicate.
37
40
38
41
This is a host-local contract, not cross-root or global discovery. Under a
39
42
partition or otherwise incomplete observation, st2 cannot infer that a catalog
40
43
is globally not live merely because it cannot currently see a canonical agent.
41
-
Supervisor state remains independently reportable.
44
+
Resident st2 control-plane instance state remains independently reportable.
42
45
43
-
While the catalog is live, or while its resident supervisor is running, its
44
-
resolved catalog root and PTY root are stable mounted state paths. Ordinary
45
-
edits and file sync within the catalog remain allowed under the separate
46
-
complete-version and last-known-good rules; this is a path-lifetime constraint,
47
-
not an opaque-database contract. Relocating either resolved root requires the
48
-
explicit coordinated operation in
46
+
While the catalog is live, or while its resident st2 control-plane instance is
47
+
running, its resolved catalog root and PTY root are stable mounted state paths.
48
+
Ordinary edits and file sync within the catalog remain allowed under the
49
+
separate complete-version and last-known-good rules; this is a path-lifetime
50
+
constraint, not an opaque-database contract. Relocating either resolved root
0 commit comments