Skip to content

Commit a9310b1

Browse files
committed
Add ADR for runtime observability contracts
1 parent 92a4617 commit a9310b1

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# ADR-0012: Runtime observability and capability governance contracts
2+
3+
## Status
4+
5+
Accepted for review.
6+
7+
## Context
8+
9+
SourceOS needs a shared contract layer for runtime capability state, browser assistance sessions, terminal workspace classification, session-event recovery, and runtime installation provenance.
10+
11+
The motivating design issue is cross-plane drift: configuration, UI, runtime, server, plugin, policy, schema, and transport planes can disagree about whether a capability is available or effective. Without typed evidence records, downstream components can only infer state from logs.
12+
13+
## Decision
14+
15+
Add an additive runtime observability contract family:
16+
17+
| Schema | Purpose |
18+
|---|---|
19+
| `CapabilityLedger` | Records effective capability state after cross-plane reconciliation. |
20+
| `BrowserAutomationReceipt` | Records visible, owned, scoped, policy-governed browser assistance sessions. |
21+
| `GitWorkspaceState` | Records typed Git/workspace classification before passive or requested Git operations. |
22+
| `OrphanEventReceipt` | Records recovery or quarantine for lifecycle events without immediate session attachment. |
23+
| `RuntimeInstallReceipt` | Records runtime manifest resolution, artifact verification, install lifecycle state, and compact log mode. |
24+
25+
These contracts complement existing `SessionReceipt`, `AgentMachineReceipt`, `PolicyDecision`, `TelemetryEvent`, release, and provenance records.
26+
27+
## Design constraints
28+
29+
1. Effective capability state must be reconciled, not locally asserted.
30+
2. Browser assistance sessions must have visible ownership and revocation state.
31+
3. Terminal Git discovery must classify expected negative states without misleading warning noise.
32+
4. Lifecycle events without immediate session attachment must enter a typed recovery or quarantine path.
33+
5. Runtime installation must record manifest and artifact evidence while keeping ordinary logs compact.
34+
6. Examples must carry evidence references, policy-decision references, stable URN prefixes, and parseable timestamps.
35+
36+
## Validation
37+
38+
The repository adds `tools/validate_runtime_observability_examples.py` and wires it into `make validate` through `validate-runtime-observability-examples`.
39+
40+
The validator checks schema conformance plus evidence-discipline invariants:
41+
42+
- unique example IDs
43+
- required URN prefixes
44+
- non-empty `evidenceRefs`
45+
- required `policyDecisionRef`
46+
- timestamp parseability
47+
- no raw path storage in `GitWorkspaceState`
48+
- browser-session timestamp ordering
49+
- orphan-event recovery/quarantine consistency
50+
- compact runtime-install log mode in the canonical example
51+
52+
## Downstream ownership
53+
54+
| Downstream repo | Contract responsibility |
55+
|---|---|
56+
| `SourceOS-Linux/sourceos-shell` | Emit and surface `CapabilityLedger` entries. |
57+
| `SourceOS-Linux/BearBrowser` | Emit `BrowserAutomationReceipt` entries and expose visible session controls. |
58+
| `SourceOS-Linux/agent-term` | Emit `GitWorkspaceState` entries and enforce severity discipline. |
59+
| `SocioProphet/sociosphere` | Emit `OrphanEventReceipt` entries and implement event recovery/quarantine. |
60+
| Agent Machine / runtime installer lane | Emit `RuntimeInstallReceipt` entries. |
61+
62+
## Consequences
63+
64+
Positive:
65+
66+
- Makes capability drift detectable and reviewable.
67+
- Gives downstream repos concrete schema targets.
68+
- Improves log quality by using compact receipt references.
69+
- Provides a path for cross-repo validation before downstream runtime implementation.
70+
71+
Costs:
72+
73+
- Adds five new schemas and examples.
74+
- Requires downstream emitters and validators to adopt the contract family.
75+
- Requires future schema evolution discipline as implementations mature.
76+
77+
## Related issues
78+
79+
- Parent spec: `SourceOS-Linux/sourceos-spec#99`
80+
- Browser implementation: `SourceOS-Linux/BearBrowser#25`
81+
- Terminal implementation: `SourceOS-Linux/agent-term#39`
82+
- Shell implementation: `SourceOS-Linux/sourceos-shell#12`
83+
- Sociosphere implementation: `SocioProphet/sociosphere#283`

0 commit comments

Comments
 (0)