Skip to content

fix(subagent): deliver resolved vault secret value to sub-agents#5990

Merged
bug-ops merged 1 commit into
mainfrom
fix/5941-subagent-secret-delivery
Jul 10, 2026
Merged

fix(subagent): deliver resolved vault secret value to sub-agents#5990
bug-ops merged 1 commit into
mainfrom
fix/5941-subagent-secret-delivery

Conversation

@bug-ops

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

Copy link
Copy Markdown
Owner

Summary

  • The sub-agent vault-secret request/approval flow only ever forwarded the requested key name back through the delivery channel and discarded whatever value it received; PermissionGrants::is_active was never called by any production code path, leaving GrantKind::Secret bookkeeping fully inert. The end-to-end "sub-agent requests secret → user approves → sub-agent uses it" capability was non-functional.
  • Agent::resolve_subagent_secret now resolves the real value from the existing vault-backed custom-secrets map (the same one skills use for requires_secrets) at all three approval call sites before delivery.
  • SubAgentManager::deliver_secret now carries the resolved Secret value and gates delivery on PermissionGrants::is_active for the exact requested key, making the grant check load-bearing for the first time.
  • The sub-agent's agent_loop.rs no longer discards the delivered value — it attaches it to each subsequent tool call via a per-call ExecutionContext env override, deliberately not the shared ToolExecutor::set_skill_env slot (which would have leaked the secret into the parent agent's later, unrelated tool calls).

Test plan

  • 11 new unit tests + 1 strengthened existing e2e test (grant-gate denial/positive-path, key normalization, ExecutionContext injection — see .local/handoff/2026-07-11T00-56-16-testing.md for the full list)
  • cargo +nightly fmt --check — clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 12641 passed, 0 failed
  • Rustdoc gate (RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler") — clean
  • Testing playbook added: .local/testing/playbooks/subagent-secret-delivery.md; coverage-status.md row added
  • Live verification (real vault secret, real sub-agent spawn, approve, confirm tool call sees the value) — pending, see playbook Scenarios 1-4

Known scope cut (tracked separately)

Grant TTL is enforced only once at the delivery gate — a value already delivered to a running sub-agent remains usable for the rest of that sub-agent's turn even after its TTL would have elapsed (no live per-tool-call re-check). Follow-up issue to be filed.

Closes #5941
Closes #5942

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate size/XL Extra large PR (500+ lines) and removed bug Something isn't working labels Jul 10, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 10, 2026 23:17
Sub-agent secret request/approval only ever forwarded the requested
key name back through the delivery channel and discarded whatever it
received; PermissionGrants::is_active was never consulted by
production code, leaving GrantKind::Secret bookkeeping inert.

Resolve the real value via the existing vault-backed custom-secrets
map before delivery, gate deliver_secret on an active grant for the
exact key, and inject the resolved value into the sub-agent's
subsequent tool calls via a per-call ExecutionContext env override
rather than the tool executor's shared skill_env slot, which would
have leaked it into the parent agent's later tool calls.

Closes #5941
Closes #5942
@bug-ops
bug-ops force-pushed the fix/5941-subagent-secret-delivery branch from 51cb168 to cfc89c8 Compare July 10, 2026 23:24
@github-actions github-actions Bot added the bug Something isn't working label Jul 10, 2026
@bug-ops
bug-ops merged commit f65b02d into main Jul 10, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/5941-subagent-secret-delivery branch July 10, 2026 23:32
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/XL Extra large PR (500+ lines)

Projects

None yet

1 participant