FN-9109: add resilient cross-runtime Cursor fallback
Route eligible CLI fallback failures into one bounded, auditable Cursor runtime handoff.
- defer cursor-cli fallback selection until a retryable primary prompt failure
- serialize concurrent swaps, retry the primary after failed handoffs, and dispose replacements safely
- transfer text-only conversation context within strict turn and total character limits
- document routing behavior and cover provider, runtime, concurrency, and failure cases
Files changed:
.../fn-9109-cross-runtime-cursor-fallback.md | 7 +
AGENTS.md | 2 +
docs/cursor-cli-contract.md | 8 +
.../src/__tests__/cli-provider-routing.test.ts | 18 +-
.../cli-runtime-routing-conformance.test.ts | 64 ++++-
.../src/__tests__/cross-runtime-fallback.test.ts | 146 +++++++++++
.../engine/src/agents/agent-session-helpers.ts | 211 ++++++----------
packages/engine/src/agents/cli-provider-routing.ts | 4 +-
.../engine/src/agents/cross-runtime-fallback.ts | 277 +++++++++++++++++++++
packages/engine/src/util/run-audit.ts | 8 +
10 files changed, 602 insertions(+), 143 deletions(-)
Fusion-Task-Id: FN-9109
Fusion-Task-Lineage: 30664371-8410-4d6f-a263-cc86c8e0dc72
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>