Skip to content

fix(subagent)!: reject unknown keys in nested tools/permissions frontmatter#6626

Merged
bug-ops merged 1 commit into
mainfrom
feat/issue-6583/subagent-deny-unknown-fields
Jul 21, 2026
Merged

fix(subagent)!: reject unknown keys in nested tools/permissions frontmatter#6626
bug-ops merged 1 commit into
mainfrom
feat/issue-6583/subagent-deny-unknown-fields

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • RawToolPolicy and RawPermissions (the tools:/permissions: nested sections of sub-agent frontmatter) did not propagate RawSubAgentDef's #[serde(deny_unknown_fields)] into their own structs, so a typo inside either section (e.g. pemission_mode:, alow:) was silently ignored and fell back to the section's fail-safe default instead of failing to load. Both structs now carry deny_unknown_fields directly.
  • Adds a regression test that drives the real handle_scheduler_spawn_action/intersect_task_tool_allowlist wiring end-to-end through run_scheduler_loop, asserting the tool definitions delivered to a spawned sub-agent's LLM are the true intersection of the parent-permission floor and the per-task planner-emitted allowlist. The existing composition test only exercised the decomposed zeph_subagent::intersect_allowlists/task_tool_allowlist_for_task helpers in isolation, never the actual call site.

Breaking change

A sub-agent frontmatter file with a misspelled key inside its tools: or permissions: section now fails to load instead of silently falling back to defaults for that section. Not an exploitable privilege escalation (every existing default is already conservative/restrictive) — this closes a silent-misconfiguration trap where an operator's intended tool/permission restriction never took effect.

Closes #6583
Closes #6539

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins (2736/2736 in touched crates, full workspace clean)
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • gitleaks protect --staged --no-banner --redact
  • 2 new #6583 tests independently verified as genuine regression guards (temporarily removed deny_unknown_fields, confirmed both new tests fail, restored)
  • New #6539 test independently verified as a genuine regression guard (temporarily reverted intersect_allowlists to a naive overwrite, confirmed the test fails with the expected leaked-tool mismatch, restored)
  • CHANGELOG.md updated under [Unreleased]/Fixed with breaking-change note

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Jul 21, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 21, 2026 00:14
…matter

RawToolPolicy and RawPermissions did not propagate RawSubAgentDef's
deny_unknown_fields into their own nested structs, so a typo inside a
sub-agent's tools: or permissions: section (e.g. pemission_mode:,
alow:) was silently ignored and fell back to the section's fail-safe
default instead of failing to load. Also adds a regression test that
drives the real handle_scheduler_spawn_action wiring end-to-end
(previously only the decomposed intersect_allowlists helper was
tested directly), confirming the parent-permission floor and
per-task allowlist are composed by true intersection.

BREAKING CHANGE: a sub-agent frontmatter file with a misspelled key in
its tools: or permissions: section now fails to load instead of
silently falling back to defaults for that section.

Closes #6583
Closes #6539
@bug-ops
bug-ops force-pushed the feat/issue-6583/subagent-deny-unknown-fields branch from 115b283 to cd6b5e8 Compare July 21, 2026 00:32
@bug-ops
bug-ops merged commit 4daf940 into main Jul 21, 2026
43 checks passed
@bug-ops
bug-ops deleted the feat/issue-6583/subagent-deny-unknown-fields branch July 21, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

1 participant