fix(session-spawner): propagate runtime overlay agents and skill capability to child sessions (#233) - #178
Merged
Conversation
…ropagation
Add tests/test_session_spawner_issue_233.py with 5 scenarios verifying that
mode-contributed agents and skill capabilities in the parent's live coordinator
state propagate correctly to spawned child sessions.
S1 — top-level baseline (regression guard): bundle agents in session.config
must remain visible in child (never broken, regression guard).
S2 — same-mode siblings (headline bug): mode-contributed agents in
coordinator.config but NOT in session.config must be visible in child.
S3 — mixed: both static and live-registry agents visible in child.
S4 — caller-independence: propagation works regardless of spawn caller.
S5 — skill capability: runtime_skill_overlay propagated to child coordinator.
S1 PASSES before fix. S2-S5 FAIL before fix (confirmed RED on current main).
Co-authored-by: Microsoft Amplifier <amplifier@microsoft.com>
…bility to child sessions (#233) ROOT CAUSE: spawn_sub_session reads from parent_session.config (static snapshot). Mode contributions (via RuntimeOverlay) live only in parent_session.coordinator.config["agents"]. Without propagation, same-mode siblings cannot delegate to each other. FIX (two coordinated changes): 1. Agents propagation block (after merge_configs): Reads coordinator.config["agents"] directly after merge_configs and copies live-registry agents NOT already in merged_config. Local declarations win; deep-copy for snapshot semantics — subsequent parent-side mode changes do NOT propagate to an already-running child. Architecture: reads coordinator.config directly, NOT from any caller parameter. Works for all spawn callers (tool-delegate, recipe orchestrator, programmatic spawn, etc.). 2. Skill capability propagation block (after child_session.initialize()): Copies RUNTIME_SKILL_OVERLAY_CAPABILITY from parent coordinator to child coordinator. Mode-contributed skills are stored as a coordinator capability; without this copy, the child's tool-skills cannot discover them. RUNTIME_CONTEXT_OVERLAY_CAPABILITY is intentionally NOT propagated: context injection is root-session-only (hooks-mode provider:request). Tests: S2-S5 in test_session_spawner_issue_233.py go GREEN with this commit. Co-authored-by: Microsoft Amplifier <amplifier@microsoft.com>
bkrabach
added a commit
that referenced
this pull request
Aug 3, 2026
…255) An agent can declare agents: -- a Smart Single Value that controls which sub-agents its spawned session may delegate to. merge_configs() honors it. The runtime-registry propagation block added later then silently undid it. This commit: - Applies agent_config declarations to the live registry propagation (not just merge_configs) - Ensures same-name local-wins collision avoidance is preserved - Adds comprehensive spawn-level test coverage for all declaration forms - Fixes PR #178's original complaint about allowlists under-delivering Blast radius: zero. Surveyed all 749 config files under ~/.amplifier/cache/ -- 51 agents: occurrences exist, all are dict-shaped agent rosters. Zero access-control declarations in the installed ecosystem, so nothing changes for deployed systems. Preserves from #253: fresh-dict-and-rebind (no cross-session mutation), deepcopy per agent, local-wins. Follow-up to #178 and #253. Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-authored-by: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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
Fixes microsoft-amplifier/amplifier-support#233: same-mode sibling agents are not reachable from each other's sub-sessions.
Root cause
spawn_sub_sessionbuilds the child's config fromparent_session.config— the STATIC snapshot captured at session-init. Runtime additions (mode contributions via RuntimeOverlay) live only inparent_session.coordinator.config["agents"]and are invisible to that read.The static-snapshot read also handles the agents-filter via
merge_configsinternal logic, which means even an explicitagents: [sibling_b]declaration in agent A's config wouldn't reach sibling_b — the source dict is the wrong one.Architectural fix (not the symptom fix)
Reads
parent_session.coordinator.config["agents"]directly aftermerge_configs. Two key properties:Caller-independent. Works for ALL spawn callers — tool-delegate, recipe orchestrator, programmatic spawn, future bundle helpers — because we read from the source of truth, not from a caller-supplied parameter. (An alternative "pass
agent_configsthrough" symptom fix was considered and rejected; it depends on caller cooperation and would silently fail for non-tool-delegate paths.)Snapshot semantics preserved. Child gets a deep-copy at spawn time. Subsequent parent-side mode changes do NOT propagate to in-flight children. Local agent_config declarations win over inherited live registry (never overwrite).
A second block propagates the
runtime_skill_overlaycapability from parent coordinator to child coordinator so the child's tool-skills can resolve contributed skill URIs.runtime_context_overlayis intentionally NOT propagated — context injection is root-session-only, since sub-sessions execute their own agent's task and shouldn't inherit "you are in mode X" framing.Companion to:
What this does NOT do
runtime_context_overlay(contributed context) to sub-sessionsMode-contributed capabilities (agents, skills) propagate because they're additive resources. Mode policies and prompt context belong to the root session and stay there. This matches how
bundle.app-declared agents already propagate today — the fix just extends the same rule to runtime additions.Test plan
test_session_spawner_issue_233.py:agent_configsparameter) — RED→GREENOne operational note for users
For full LLM-driven A→delegate(B) call chains, the spawned agent's frontmatter must include the
delegatetool in its tool list. The fix makes B reachable in A's REGISTRY; the agent's tool COMPOSITION is a separate concern (agent author responsibility). Withoutdelegatein A's tools, the LLM in A's sub-session sees B in the registry but has no tool to call it — which the structural validation confirms is exactly the right separation.Closes microsoft-amplifier/amplifier-support#233 (jointly with companion PRs).