Skip to content

Commit 42e9e81

Browse files
committed
refactor(reborn): remove host runtime origin taxonomy (#3095)
1 parent 466e6ac commit 42e9e81

2 files changed

Lines changed: 14 additions & 27 deletions

File tree

crates/ironclaw_host_runtime/src/lib.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
//! - callers see structured capability outcomes instead of lower substrate
1212
//! handles;
1313
//! - approval/auth/resource waits are suspension states, not errors;
14-
//! - request origin and capability projection metadata never grant or bypass
15-
//! authority.
14+
//! - caller/workflow origin taxonomy is intentionally kept outside this lower
15+
//! facade; authority remains in `ExecutionContext` and projection selection
16+
//! remains explicit surface metadata.
1617
1718
use async_trait::async_trait;
1819
use ironclaw_host_api::{
@@ -152,20 +153,6 @@ impl fmt::Display for CapabilitySurfaceVersion {
152153
}
153154
}
154155

155-
/// Product-owned workflow origin for audit/correlation context.
156-
///
157-
/// This is not authority and must never grant or bypass authority. Authority
158-
/// remains exclusively in `ExecutionContext`, principals, grants, leases, and
159-
/// policy. Projection differences belong in [`CapabilitySurfaceKind`]. Runtime
160-
/// adapters are callees of `HostRuntime`, not top-level caller/origin values.
161-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
162-
#[non_exhaustive]
163-
pub enum RuntimeRequestOrigin {
164-
TurnCoordinator,
165-
MissionService,
166-
SystemService,
167-
}
168-
169156
/// Which host-filtered surface a caller is asking to render.
170157
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
171158
#[non_exhaustive]
@@ -176,6 +163,12 @@ pub enum CapabilitySurfaceKind {
176163
}
177164

178165
/// Request to invoke one capability through the composed host runtime.
166+
///
167+
/// Caller/workflow origin is intentionally not part of this lower contract.
168+
/// Host runtime authorization must be derived from [`ExecutionContext`],
169+
/// principals, grants, leases, and policy; upper workflow services can attach
170+
/// audit labels outside this facade when they need product-specific origin
171+
/// vocabulary.
179172
#[derive(Debug, Clone, PartialEq)]
180173
pub struct RuntimeCapabilityRequest {
181174
pub context: ExecutionContext,
@@ -187,8 +180,6 @@ pub struct RuntimeCapabilityRequest {
187180
/// and must not trust caller estimates as binding limits or actual usage.
188181
pub estimate: ResourceEstimate,
189182
pub input: Value,
190-
/// Product workflow origin for audit/correlation only.
191-
pub request_origin: RuntimeRequestOrigin,
192183
pub idempotency_key: Option<IdempotencyKey>,
193184
}
194185

@@ -197,8 +188,8 @@ pub struct RuntimeCapabilityRequest {
197188
pub struct VisibleCapabilityRequest {
198189
pub scope: ResourceScope,
199190
pub correlation_id: CorrelationId,
200-
/// Product workflow origin for audit/correlation only.
201-
pub request_origin: RuntimeRequestOrigin,
191+
/// Projection surface selection only; this is not authority and must not
192+
/// grant or bypass authorization.
202193
pub surface_kind: CapabilitySurfaceKind,
203194
}
204195

crates/ironclaw_host_runtime/tests/host_runtime_contract.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use ironclaw_host_runtime::{
44
CapabilitySurfaceVersion, HostRuntime, HostRuntimeError, HostRuntimeHealth, HostRuntimeStatus,
55
IdempotencyKey, RuntimeApprovalGate, RuntimeAuthGate, RuntimeBlockedReason,
66
RuntimeCapabilityCompleted, RuntimeCapabilityFailure, RuntimeCapabilityOutcome,
7-
RuntimeCapabilityRequest, RuntimeFailureKind, RuntimeGateId, RuntimeRequestOrigin,
8-
RuntimeResourceGate, RuntimeStatusRequest, RuntimeWorkId, RuntimeWorkSummary,
9-
VisibleCapabilityRequest, VisibleCapabilitySurface, testkit::FakeHostRuntime,
7+
RuntimeCapabilityRequest, RuntimeFailureKind, RuntimeGateId, RuntimeResourceGate,
8+
RuntimeStatusRequest, RuntimeWorkId, RuntimeWorkSummary, VisibleCapabilityRequest,
9+
VisibleCapabilitySurface, testkit::FakeHostRuntime,
1010
};
1111
use serde_json::json;
1212

@@ -40,7 +40,6 @@ async fn fake_runtime_records_invocation_and_preserves_structured_outcomes() {
4040
capability_id: capability_id.clone(),
4141
estimate: ResourceEstimate::default(),
4242
input: json!({"message": "hello"}),
43-
request_origin: RuntimeRequestOrigin::TurnCoordinator,
4443
idempotency_key: Some(IdempotencyKey::new("turn-1/tool-1").unwrap()),
4544
};
4645

@@ -88,7 +87,6 @@ async fn fake_runtime_surfaces_approval_auth_and_resource_waits_as_values_not_er
8887
capability_id: capability_id.clone(),
8988
estimate: ResourceEstimate::default(),
9089
input: json!({}),
91-
request_origin: RuntimeRequestOrigin::TurnCoordinator,
9290
idempotency_key: None,
9391
})
9492
.await
@@ -121,7 +119,6 @@ async fn fake_runtime_returns_versioned_visible_surface_and_records_requests() {
121119
let request = VisibleCapabilityRequest {
122120
scope: context.resource_scope.clone(),
123121
correlation_id: context.correlation_id,
124-
request_origin: RuntimeRequestOrigin::TurnCoordinator,
125122
surface_kind: CapabilitySurfaceKind::AgentLoop,
126123
};
127124

@@ -213,7 +210,6 @@ async fn fake_runtime_reports_sanitized_failures_as_outcomes() {
213210
capability_id,
214211
estimate: ResourceEstimate::default(),
215212
input: json!({}),
216-
request_origin: RuntimeRequestOrigin::SystemService,
217213
idempotency_key: None,
218214
})
219215
.await

0 commit comments

Comments
 (0)