Skip to content

feat(subagent): enforce transitive constraint propagation across delegation chains#4681

Merged
bug-ops merged 2 commits into
mainfrom
3993-constraint-drift
May 29, 2026
Merged

feat(subagent): enforce transitive constraint propagation across delegation chains#4681
bug-ops merged 2 commits into
mainfrom
3993-constraint-drift

Conversation

@bug-ops

@bug-ops bug-ops commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes constraint drift (arXiv:2605.10481): safety constraints (trust_level, tool_allowlist) set at orchestration time were silently dropped when a sub-agent spawned its own sub-agents, allowing trust and tool escalation deep in delegation chains.

  • Add max_trust_level and inherited_tool_allowlist to SpawnContext
  • apply_constraint_propagation narrows executor trust via min_trust (never raises) and intersects tool allowlists
  • FilteredToolExecutor::set_effective_trust now delegates to inner PolicyGateExecutor (previously hit the trait default no-op)
  • PolicyGateExecutor::set_effective_trust clamps via min_trust instead of unconditional assignment
  • DenyList children with a parent allowlist are converted fail-closed to an explicit AllowList
  • Constraint narrowing is logged at info level for auditability

Known limitation: the resume() path does not apply constraint propagation (documented in source).

Test plan

  • cargo build --workspace passes
  • cargo clippy --workspace --features "desktop,ide,server,chat,pdf,scheduler" -- -D warnings — 0 warnings
  • cargo nextest run --workspace --lib --bins — 10327/10327 pass
  • New unit tests: trust clamp narrows down, higher cap does NOT raise privilege, DenyList fail-closed (2 cases), InheritAll replaced, AllowList intersection, empty parent allowlist blocks all tools

Closes #3993

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate enhancement New feature or request size/L Large PR (201-500 lines) labels May 29, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 29, 2026 21:33
…gation chains

Addresses constraint drift (arXiv:2605.10481): safety constraints set at
orchestration time were silently dropped when a subagent spawned its own
subagents, allowing trust-level and tool-allowlist escalation deep in
delegation chains.

Changes:
- Add `max_trust_level: Option<SkillTrustLevel>` and
  `inherited_tool_allowlist: Option<HashSet<String>>` to `SpawnContext`
- Add `apply_constraint_propagation(def, ctx)` in zeph-subagent that:
  - Clamps executor trust via `min_trust` (narrows only, never raises)
  - Intersects AllowList with parent set; replaces InheritAll with parent set
  - Converts DenyList to AllowList(parent \ deny_entries) when parent
    allowlist is present (fail-closed)
  - Logs constraint narrowing at `info` level for auditability
- Add `set_effective_trust` delegation in `FilteredToolExecutor` so the
  cap reaches `PolicyGateExecutor` (previously hit the trait default no-op)
- Fix `PolicyGateExecutor::set_effective_trust` to clamp via `min_trust`
  instead of unconditional assignment

Known limitation: the `resume()` path does not apply constraint
propagation; documented in source.

Closes #3993
@bug-ops bug-ops force-pushed the 3993-constraint-drift branch from 28afea4 to 06838c5 Compare May 29, 2026 21:34
@bug-ops bug-ops merged commit 957211b into main May 29, 2026
32 checks passed
@bug-ops bug-ops deleted the 3993-constraint-drift branch May 29, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research(orchestration): constraint drift — enforce safety constraints across subagent delegation chains (arXiv:2605.10481)

1 participant