Fail closed on a missing provider key instead of sending an unauthenticated request - #2566
All clear
Code Review Summary
PR #2566 addresses two reliability failures in the core agent runtime. First, AISDKEngine now fails closed with missing_credentials before constructing a provider or sending a request when a required provider key is absent, while preserving keyless custom baseUrl gateways and providers such as Ollama. Second, stale-run recovery distinguishes in-process background automations from HTTP-redispatchable runs: payload-less runs receive the wider background stale window and are reported as not_redispatchable rather than implying payload loss.
This is a high-risk change because it affects credential handling and background-run recovery, but the implementation is consistent with the existing engine error contract and run-store recovery flow. The regression tests cover missing keys, explicit keys, custom gateways, and both stale-window variants. Independent reviews found no confirmed bugs or compatibility issues.
✅ Good patterns: fail-closed behavior avoids unauthenticated provider requests; the baseUrl exemption is explicit; stale recovery semantics are documented and tested; diagnostic naming now reflects the actual condition.
🧪 Browser testing: Skipped — PR only modifies backend/config/docs/tests, no UI impact