fix(subagent): deliver resolved vault secret value to sub-agents#5990
Merged
Conversation
This was referenced Jul 10, 2026
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
force-pushed
the
fix/5941-subagent-secret-delivery
branch
from
July 10, 2026 23:24
51cb168 to
cfc89c8
Compare
Merged
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PermissionGrants::is_activewas never called by any production code path, leavingGrantKind::Secretbookkeeping fully inert. The end-to-end "sub-agent requests secret → user approves → sub-agent uses it" capability was non-functional.Agent::resolve_subagent_secretnow resolves the real value from the existing vault-backed custom-secrets map (the same one skills use forrequires_secrets) at all three approval call sites before delivery.SubAgentManager::deliver_secretnow carries the resolvedSecretvalue and gates delivery onPermissionGrants::is_activefor the exact requested key, making the grant check load-bearing for the first time.agent_loop.rsno longer discards the delivered value — it attaches it to each subsequent tool call via a per-callExecutionContextenv override, deliberately not the sharedToolExecutor::set_skill_envslot (which would have leaked the secret into the parent agent's later, unrelated tool calls).Test plan
ExecutionContextinjection — see.local/handoff/2026-07-11T00-56-16-testing.mdfor the full list)cargo +nightly fmt --check— cleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— cleancargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 12641 passed, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler") — clean.local/testing/playbooks/subagent-secret-delivery.md;coverage-status.mdrow addedKnown 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