feat(FN-3914): add durable heartbeat model fallback
Adds durable heartbeat model fallback logic to the engine's heartbeat subsystem (`agent-heartbeat.ts`, `agent-session-helpers.ts`, `pi.ts`), allowing heartbeats to gracefully use alternative AI models when the primary model is unavailable, with documentation updates to `agents.md` and `settings-refe Fusion-Task-Id: FN-3914
This commit is contained in:
@@ -184,6 +184,17 @@ Executor precedence for task runs:
|
||||
|
||||
If the assigned agent runtime model is missing or incomplete, Fusion falls back to the normal task/settings execution hierarchy.
|
||||
|
||||
### Durable-agent heartbeat model precedence and unavailable-provider behavior
|
||||
|
||||
Heartbeat sessions for durable agents resolve models with heartbeat-specific fallback semantics:
|
||||
|
||||
1. Agent runtime model (`runtimeConfig.model` or `runtimeConfig.modelProvider` + `runtimeConfig.modelId`) when present
|
||||
2. Execution-lane settings fallback (`executionProvider`/`executionModelId` → `executionGlobalProvider`/`executionGlobalModelId` → project/global defaults)
|
||||
|
||||
When the runtime model is present and differs from execution-lane settings, heartbeat passes the execution-lane model as a fallback pair for session creation.
|
||||
|
||||
If a **timer heartbeat** still cannot create/run a session due to unavailable provider credentials or missing provider registration, the run completes with `resultJson.reason = "heartbeat_model_unavailable"` and diagnostics in `resultJson.detail`/`stderrExcerpt` instead of leaving the durable agent stuck in persistent `state="error"`.
|
||||
|
||||
### Assigned-agent identity + planning model precedence for task triage
|
||||
|
||||
When a triage/specification run targets a task with `assignedAgentId` and that agent is durable, planning now inherits the assigned agent context instead of only generic triage-role defaults.
|
||||
|
||||
@@ -482,6 +482,19 @@ Fusion uses a dual-scope model settings system with five lanes. Global settings
|
||||
6. Global `defaultProvider` + `defaultModelId`
|
||||
7. Automatic provider/model resolution
|
||||
|
||||
### Heartbeat model (durable agents)
|
||||
|
||||
Heartbeat sessions for durable agents use this order:
|
||||
|
||||
1. Assigned durable agent runtime model (`runtimeConfig.model` or `runtimeConfig.modelProvider` + `runtimeConfig.modelId`) when present
|
||||
2. Project `executionProvider` + `executionModelId`
|
||||
3. Global `executionGlobalProvider` + `executionGlobalModelId`
|
||||
4. Project `defaultProviderOverride` + `defaultModelIdOverride`
|
||||
5. Global `defaultProvider` + `defaultModelId`
|
||||
6. Automatic provider/model resolution
|
||||
|
||||
When heartbeat has both (1) and (2-5), the runtime model is used as primary and the execution-lane model is passed as fallback. On timer-triggered runs, unrecoverable missing-provider credential/registry failures complete as `heartbeat_model_unavailable` instead of permanently setting the durable agent to `state=error`.
|
||||
|
||||
### Reviewer model
|
||||
|
||||
1. Per-task `validatorModelProvider` + `validatorModelId`
|
||||
|
||||
Reference in New Issue
Block a user