一键导入
agent-spawn-provider-inheritance
When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How the multi-backend adapter system works — AgentAdapter interface, ACP protocol, session resume, and how to add new provider adapters
How to get agents to use group chats for peer coordination in flightdeck-based crews. Covers hub-and-spoke anti-pattern, auto-grouping triggers, and file-lock-linked groups. Use when setting up multi-agent crews with 3+ agents or diagnosing why agents aren't collaborating directly.
When fetching from the `/coordination/activity` API and you only need specific action types (e.g., `progress_update`, `task_completed`, `delegated`).
When fetching activity data for UI display, or debugging why activity-based features show empty/stale data.
Architecture decisions and patterns from Flightdeck development (Phases 2–4). Covers feature architecture, state management, component patterns, and API design.
Known bugs and root causes encountered during Flightdeck development. Check this list before debugging — you may be hitting a known issue.
| name | agent-spawn-provider-inheritance |
| description | When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows. |
When to use: When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows.
When a new agent is spawned (via DELEGATE command or API), the flow is:
AgentLifecycle.ts handleDelegate()AgentLifecycle.ts:100-104AgentManager.ts:570-584 persists to agent_roster tableAgentManager.ts:858-- Note: provider is stored in the `metadata` JSON column, not a top-level column
-- The agent_roster schema has: agent_id, role, model, status, session_id, project_id,
-- created_at, updated_at, last_task_summary, metadata, team_id (crew assignment; stored as `team_id` column for legacy reasons)
File: packages/server/src/agents/commands/AgentLifecycle.ts:100-104
const spawnOptions = {
provider: req.provider, // Only set if LLM explicitly includes it in DELEGATE JSON
model: req.model,
// ...
};
When the lead delegates to a developer, the DELEGATE command JSON rarely includes provider. So req.provider is undefined → child agent gets no provider → falls back to system default.
Fix: Inherit from parent:
provider: req.provider || agent.provider,
File: packages/server/src/agents/SessionResumeManager.ts:100-112
The onAgentSpawned() handler calls rosterRepo.upsertAgent() but doesn't pass the agent's provider. Since upsertAgent uses onConflictDoUpdate, it overwrites the provider field to null/empty.
Fix: Pass provider through in the upsert call.
GET /agents returns agent list from roster DB (includes metadata with provider)agent.provider and agent.model to display badgesThe Critical Reviewer suggested a shared "agent defaults resolution" function that both DELEGATE and resume paths call. This is worth considering if more fields need inheritance in the future, but for now two surgical fixes are simpler.
| File | Lines | Role |
|---|---|---|
packages/server/src/agents/commands/AgentLifecycle.ts | 100-104 | Spawn options — provider inheritance gap |
packages/server/src/agents/AgentManager.ts | 525 | Provider set from options |
packages/server/src/agents/AgentManager.ts | 570-584 | upsertAgent to roster with provider |
packages/server/src/agents/SessionResumeManager.ts | 97-116 | onAgentSpawned — overwrites provider |
packages/server/src/db/AgentRosterRepository.ts | 25-80 | upsertAgent with onConflictDoUpdate |