Troubleshooting Sub-Agent Model Routing in Desktop AI Agent Frameworks

    When a sub-agent plugin saves a model setting but still uses the parent session model, the cause is usually config semantics, merge order, and verification—not a failed save. This guide explains the merge chain, nested preset paths, allow-list vs. default routing, evidence-based debugging, patch targets, and how to prove routing actually took effect.

    The desktop AI agent framework release brings local delegation, plugin toolchains, and session-level routing closer to everyday development. Releases like this should be judged not only by install experience, but by whether configuration is observable and verifiable.

    A common issue: you set a model in a sub-agent plugin, save succeeds, then restart, open a new session, and re-check the config—yet the sub-agent still uses the parent session model, or says it “cannot confirm its own model.” The behavior looks mysterious, but it comes from configuration semantics, layered merging, and how you verify results.

    Symptoms and impact

    The UI often looks fine. You enter a sub-agent model on the plugin settings page and save without errors. The config file shows the write. After restart and a new session, you ask the main agent to delegate a sub-agent that reports its model. The sub-agent reports the parent session model name, or answers that it cannot confirm. The first case looks like the setting never applied; the second looks like config was never read.

    This is hard to debug for three reasons. First, the setting really was written—plugin UI and config file both show it, with no “unsaved” warning. Second, session events were written, and policy event content may be fully correct, so “config was not read” is also a weak hypothesis. Third, a sub-agent’s self-report is not reliable: at runtime it may not have its own routing information, so reporting the parent model or “cannot confirm” can be normal. UI, events, and self-report cannot individually prove that configuration took effect.

    One-sentence conclusion

    The authorization allow-list is not a default. The allowed-models list only validates an explicitly passed routing field. What actually sets a sub-agent’s default route is the agent default options. If you configure only the allow-list and omit defaults, a sub-agent with no explicit route falls back to the parent session model.

    Another easy miss is config hierarchy. On desktop and web, sub-agent tool config often lives on a nested row inside an agent preset. A same-named host-level setting does not apply. When you patch by identifier with an imprecise path, you may hit the wrong target with no error.

    Full mechanism chain

    The following chain is based on checking session events, projection cache, and packaged application artifacts. Some merge order is inferred and was validated with new sessions; treat the actual version as source of truth.

    After save, the system typically merges: host defaults → agent preset overrides → tool plugin defaults → session runtime values. When a sub-agent starts, the routing decision first checks for an explicit route field. If present, the allow-list authorizes it. If there is no explicit route, it reads the model from agent default options. If those defaults are missing, it falls back to the parent session model. A complete allow-list is never used as the default.

    Hierarchy makes this worse. Tool config on desktop and web may hang under a nested path on the agent preset. The host-level row may be display or host-wide default only, and may not enter that preset’s final merge. Patching by preset id that matches only the host layer or a similar path can hit the wrong target, and the merger may not error. Result: config exists, events look correct, runtime values are still wrong.

    Evidence collection

    Debug along an evidence chain instead of repeatedly changing the UI.

    1. Reproduce and record the save, and confirm which config layer was written.
    2. Export the merged effective config, not only the raw file. Focus on default options under the agent preset nested path.
    3. Inspect policy records in session events. Correct policy events do not mean correct runtime values.
    4. Check routing decisions in the projection cache: the model the sub-agent actually received and its source.
    5. Unpack the app artifact and locate the config loader, preset merger, and routing decision logic; verify fallback.
    6. After a patch, validate with a new session so old session cache cannot interfere. Label inferences separately.

    Fix

    Write the default at the correct layer. Field names below are illustrative, not a specific API:

    1. # Wrong: host layer only; may not participate in preset merge
    2. host:
    3. tools:
    4. delegate:
    5. defaults:
    6. model: target-model
    1. # Correct: nested under the agent preset’s tools
    2. agentPreset:
    3. id: delegate-default
    4. tools:
    5. delegate:
    6. defaults:
    7. model: target-model
    8. routePolicy:
    9. allowList:
    10. - target-model

    Keep the allow-list if needed, but it only validates explicit routes; it does not set default routing. If the system also supports effort level, context window, and max output, check whether defaults and explicit-route fallbacks come from the same source. In some implementations, switching routes clears cross-route parameters so effort or output limits fall back to another default set. Context window and max output fallbacks may also come from different layers; trust the merged effective values.

    Patch target and coverage

    The patch should target a nested path such as agentPreset[id=...].tools.delegate.defaults.model, scoped by preset id and tool name to avoid approximate matches. Before and after, dump a merged snapshot and confirm the target preset is unique and coverage is correct. If the patch tool supports dry-run, inspect hits first; otherwise use a read-only probe of the merge result. Keep a rollback point so same-named configs cannot silently override each other.

    How to prove it actually works

    Do not rely on sub-agent self-report. Read the routing decision or merged effective config. Example probe:

    1. effective = resolveEffectiveConfig(preset="delegate-default")
    2. assert effective.tools.delegate.defaults.model == "target-model"
    3. decision = routeDecision(parentSession, delegateTask, explicitRoute=null)
    4. assert decision.model == "target-model"
    5. assert decision.source == "preset.defaults"

    Use a new session, clear old projection cache, and test two paths: no explicit route, and explicit route that is not authorized. The first should hit default options; the second should be rejected by the allow-list. If it still falls back to the parent model, re-check the preset nested path and what the patch actually hit.

    Delegated vs. derived agents

    Delegated sub-agents fit independent subtasks and usually take default routing from the agent preset. Derived agents copy parent session context for branch exploration; routing may inherit from the parent or follow other rules. Do not use a derived agent to verify delegated default routing, or inheritance will look like a failed config.

    Troubleshooting order

    Confirm save layer → inspect merged effective config → check session policy events → check explicit route fields → check agent default options → check preset nested path → check patch hit target → verify routing decision in a new session → only then look at sub-agent self-report.

    Implementation index

    Focus on the config loader, preset merger, routing decision, event projection cache, plugin registry, and preset resolver. Treat merged effective values and routing-decision source as ground truth. Do not treat a successful UI save or a correct policy event as the final conclusion. When evaluating a desktop AI agent framework release, configuration observability, hierarchy clarity, and verification methods matter more than install experience alone.