Skip to content

feat(reborn): wire built-in obligations and handoffs#3080

Merged
serrrfirat merged 6 commits into
reborn-integrationfrom
reborn-land-06-obligations-handoff
May 1, 2026
Merged

feat(reborn): wire built-in obligations and handoffs#3080
serrrfirat merged 6 commits into
reborn-integrationfrom
reborn-land-06-obligations-handoff

Conversation

@serrrfirat
Copy link
Copy Markdown
Collaborator

Summary

Draft/snapshot carve-out for PR6 from the existing Reborn obligations branch material.

This branch contains the PR6 contract surface for built-in V1 obligations and runtime handoffs:

  • all unsupported/unconfigured V1 obligations fail closed;
  • metadata-only audit obligations before/after dispatch;
  • network policy storage/runtime handoff;
  • secret lease/injection handoff;
  • prepared mount handoff with subset checks;
  • prepared resource reservation handoff and abort cleanup;
  • output limit enforcement before publication;
  • output redaction before publication;
  • pre-dispatch obligation propagation through dispatcher/runtime lanes.

Primary contract files in this snapshot include:

crates/ironclaw_host_runtime/tests/builtin_obligation_handler_contract.rs
crates/ironclaw_capabilities/tests/capability_obligation_handler_contract.rs
crates/ironclaw_dispatcher/tests/dispatch_contract.rs
crates/ironclaw_dispatcher/tests/event_dispatch_contract.rs
crates/ironclaw_dispatcher/tests/vertical_slice_contract.rs
crates/ironclaw_resources/tests/resource_governor_contract.rs
docs/reborn/contracts/capabilities.md
docs/reborn/contracts/dispatcher.md
docs/reborn/contracts/host-api.md
docs/reborn/contracts/host-runtime.md
docs/reborn/contracts/resources.md

Draft / dependency note

This PR is intentionally opened as a draft snapshot so the contracts are visible on a PR now.

It is not yet a clean merge candidate because the source branch is an older integrated Reborn stack snapshot. The PR6 branch needs to be retargeted/narrowed after the prerequisite branches land/rebase, especially:

Until then, this PR should be treated as contract/reference material, not a ready-to-merge diff.

Verification

Not rerun after opening this snapshot PR. The source material is present from the existing Reborn obligations branch; it will need a fresh rebase/narrowing pass and targeted verification before merge readiness.

Refs #2987.

@github-actions github-actions Bot added size: XL 500+ changed lines scope: channel/web Web gateway channel scope: db/postgres PostgreSQL backend scope: db/libsql libSQL / Turso backend scope: docs Documentation scope: dependencies Dependency updates DB MIGRATION PR adds or modifies PostgreSQL or libSQL migration definitions risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Apr 29, 2026
@serrrfirat serrrfirat added reborn IronClaw Reborn architecture and landing work scope: safety Prompt injection defense labels Apr 29, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a modular architecture for the IronClaw Reborn system by defining clear boundaries between service crates and implementing contract tests to enforce these dependencies. It adds several new crates (ironclaw_approvals, ironclaw_authorization, ironclaw_capabilities, ironclaw_dispatcher, ironclaw_events, ironclaw_extensions, ironclaw_filesystem, ironclaw_host_api, ironclaw_host_runtime) and updates the workspace configuration. My feedback highlights that the architectural boundary test in crates/ironclaw_dispatcher/tests/boundary_contract.rs is currently fragile due to string-based parsing of Cargo.toml and should be refactored to use cargo_metadata for more robust dependency inspection, following the pattern established in ironclaw_architecture.

Comment on lines +1 to +19
#[test]
fn dispatcher_crate_does_not_depend_on_higher_level_workflow_crates() {
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let manifest = std::fs::read_to_string(&manifest_path)
.unwrap_or_else(|error| panic!("failed to read {manifest_path:?}: {error}"));

for forbidden in [
"ironclaw_authorization",
"ironclaw_capabilities",
"ironclaw_wasm",
"ironclaw_scripts",
"ironclaw_mcp",
] {
assert!(
!manifest.contains(forbidden),
"ironclaw_dispatcher examples/tests should exercise the dispatcher boundary directly, not depend on higher-level workflow crate {forbidden}"
);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test dispatcher_crate_does_not_depend_on_higher_level_workflow_crates uses a simple string check on the Cargo.toml file content to enforce architectural boundaries. This is fragile and prone to false negatives. Consider using cargo_metadata to programmatically inspect the dependency graph, similar to how crates/ironclaw_architecture/tests/reborn_dependency_boundaries.rs does it. If you do, ensure that the setup (e.g., fetching metadata) uses expect() to fail the test with a clear message if environmental requirements are not met, avoiding silent fallbacks like unwrap_or().

References
  1. In tests, when setting up a state that depends on environmental factors, prefer expect() to explicitly fail the test with a clear message if the setup is not possible. Avoid fallbacks like unwrap_or() that could cause the test to silently check the wrong logic.

@serrrfirat serrrfirat force-pushed the reborn-land-06-obligations-handoff branch from fd50f2f to 98f821e Compare April 30, 2026 19:42
@github-actions github-actions Bot added risk: low Changes to docs, tests, or low-risk modules and removed risk: medium Business logic, config, or moderate-risk modules labels Apr 30, 2026
@serrrfirat serrrfirat marked this pull request as ready for review April 30, 2026 19:47
@github-actions github-actions Bot added risk: medium Business logic, config, or moderate-risk modules and removed risk: low Changes to docs, tests, or low-risk modules labels Apr 30, 2026
…land-06-obligations-handoff-recarve-v2

# Conflicts:
#	Cargo.lock
@github-actions github-actions Bot added risk: low Changes to docs, tests, or low-risk modules and removed risk: medium Business logic, config, or moderate-risk modules labels May 1, 2026
@serrrfirat serrrfirat merged commit 9255c31 into reborn-integration May 1, 2026
14 checks passed
@serrrfirat serrrfirat deleted the reborn-land-06-obligations-handoff branch May 1, 2026 08:28
serrrfirat added a commit that referenced this pull request May 1, 2026
Refs: #3145, #3080, #3017, #3087.

Decisions: host-runtime now wraps process stores with ProcessObligationLifecycleStore so spawn-phase resource reservations are reconciled on success or released on failure/kill, and staged network/secret handoffs are discarded at terminal lifecycle. Process-start failure remains CapabilityHost abort-owned.

Files changed: ironclaw_host_runtime lib exports, obligations lifecycle/store cleanup, HostRuntimeServices process graph wiring, host_runtime_services_contract tests.

Notes: full host-runtime tests need CARGO_BUILD_JOBS=1 in this environment to avoid linker OOM.
serrrfirat added a commit that referenced this pull request May 1, 2026
* RALPH: complete issue 3145 background obligation lifecycle

Refs: #3145, #3080, #3017, #3087.

Decisions: host-runtime now wraps process stores with ProcessObligationLifecycleStore so spawn-phase resource reservations are reconciled on success or released on failure/kill, and staged network/secret handoffs are discarded at terminal lifecycle. Process-start failure remains CapabilityHost abort-owned.

Files changed: ironclaw_host_runtime lib exports, obligations lifecycle/store cleanup, HostRuntimeServices process graph wiring, host_runtime_services_contract tests.

Notes: full host-runtime tests need CARGO_BUILD_JOBS=1 in this environment to avoid linker OOM.

* Fix process obligation cleanup lifecycle

* Fix stale reservation lifecycle cleanup

* Fix background obligation cleanup failures

* fix(reborn): harden process obligation cleanup

* fix(host-runtime): preserve cancel side effects on cleanup failure

* fix(reborn): enforce single active process handoff

* fix: address review findings (iteration 1)
serrrfirat added a commit that referenced this pull request May 2, 2026
* RALPH: wire EnforceResourceCeiling handoff

Task: complete issue #3144; refs obligations PR #3080 and resource authority #3141.

Decisions: support invoke/resume ceilings by decomposing them into host-owned estimate checks plus post-dispatch ResourceUsage/output checks; keep spawn and unenforced sandbox CPU/memory/disk quotas fail-closed; preserve EnforceOutputLimit behavior.

Files: host-runtime obligation handler/tests/docs, capabilities post-dispatch classification, host-runtime Cargo metadata.

Notes: no FEATURE_PARITY.md update needed; Reborn resource-ceiling behavior is tracked in docs/reborn/contracts/host-runtime.md.

* fix(host-runtime): fail closed unsupported resource ceilings

* fix(host-runtime): enforce resource output ceiling on published bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs DB MIGRATION PR adds or modifies PostgreSQL or libSQL migration definitions reborn IronClaw Reborn architecture and landing work risk: low Changes to docs, tests, or low-risk modules scope: channel/web Web gateway channel scope: db/libsql libSQL / Turso backend scope: db/postgres PostgreSQL backend scope: dependencies Dependency updates scope: docs Documentation scope: safety Prompt injection defense size: XL 500+ changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant