Skip to content

fix(session-spawner): propagate runtime overlay agents and skill capability to child sessions (#233) - #178

Merged
bkrabach merged 2 commits into
mainfrom
fix/issue-233-runtime-overlay-spawn-propagation
May 13, 2026
Merged

fix(session-spawner): propagate runtime overlay agents and skill capability to child sessions (#233)#178
bkrabach merged 2 commits into
mainfrom
fix/issue-233-runtime-overlay-spawn-propagation

Conversation

@bkrabach

Copy link
Copy Markdown
Collaborator

Summary

Fixes microsoft-amplifier/amplifier-support#233: same-mode sibling agents are not reachable from each other's sub-sessions.

Root cause

spawn_sub_session builds the child's config from parent_session.config — the STATIC snapshot captured at session-init. Runtime additions (mode contributions via RuntimeOverlay) live only in parent_session.coordinator.config["agents"] and are invisible to that read.

The static-snapshot read also handles the agents-filter via merge_configs internal logic, which means even an explicit agents: [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 after merge_configs. Two key properties:

  1. 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_configs through" symptom fix was considered and rejected; it depends on caller cooperation and would silently fail for non-tool-delegate paths.)

  2. 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_overlay capability from parent coordinator to child coordinator so the child's tool-skills can resolve contributed skill URIs. runtime_context_overlay is 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

  • Does NOT propagate mode policies (tool gates) to sub-sessions
  • Does NOT propagate the mode body / system reminder to sub-sessions
  • Does NOT propagate runtime_context_overlay (contributed context) to sub-sessions

Mode-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

  • 5 new tests in test_session_spawner_issue_233.py:
    • S1: top-level baseline (regression guard) — GREEN before and after
    • S2: same-mode siblings (the headline) — RED→GREEN
    • S3: mixed (bundle-declared + mode-contributed) — RED→GREEN
    • S4: caller-independence (programmatic spawn, no agent_configs parameter) — RED→GREEN
    • S5: skill capability propagation — RED→GREEN
  • Full app-cli test suite green, no regressions
  • DTU end-to-end with real Anthropic LLM: 3/3 validation scenarios pass; events.jsonl confirms sibling-b in sub-session A's agent registry; runtime_skill_overlay capability present in child coordinator events. Cost: ~$2.40

One operational note for users

For full LLM-driven A→delegate(B) call chains, the spawned agent's frontmatter must include the delegate tool 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). Without delegate in 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).

Brian Krabach and others added 2 commits May 13, 2026 13:34
…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
bkrabach merged commit 8b8da29 into main May 13, 2026
1 check passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant