Add turn error lifecycle contributor (#24916)

Summary
- Add TurnErrorInput and TurnLifecycleContributor::on_turn_error to the
extension API.
- Emit the turn-error lifecycle from core turn error paths, including
usage limit failures.
- Add direct lifecycle coverage for the emitted error facts and stores.

Tests
- just fmt
- git diff --check
- Not run: full tests or clippy (per instructions)
This commit is contained in:
jif-oai authored and GitHub committed 2026-05-28 16:13:54 +02:00
1 parent ec803fe6c7
commit e7d156eb08
6 files changed
+135 -4

No files matched your search

@@ -1,4 +1,5 @@
use codex_protocol::config_types::CollaborationMode;
use codex_protocol::protocol::CodexErrorInfo;
use codex_protocol::protocol::TokenUsage;
use codex_protocol::protocol::TurnAbortReason;
@@ -41,3 +42,17 @@ pub struct TurnAbortInput<'a> {
/// Store scoped to this turn runtime.
pub turn_store: &'a ExtensionData,
}
/// Input supplied when the host observes an error for a turn.
pub struct TurnErrorInput<'a> {
/// Stable host-owned turn identifier.
pub turn_id: &'a str,
/// Error surfaced by the host for this turn.
pub error: CodexErrorInfo,
/// Store scoped to the host session runtime.
pub session_store: &'a ExtensionData,
/// Store scoped to this thread runtime.
pub thread_store: &'a ExtensionData,
/// Store scoped to this turn runtime.
pub turn_store: &'a ExtensionData,
}