Add opt-in structured errors for Guardian circuit-breaker interruptions (#48796)

## Why

Guardian denial-limit interruptions lack a structured error identifying the cause. Make this opt-in because older clients may not recognize the new error in shared history.

## What changed

- Add `auto_review.circuit_break_action = "strict"` to attach `TooManyDenials` to the interrupted turn. The default leaves the error unset.
- Expose `turn.error.codexErrorInfo = "tooManyDenials"` in app-server notifications and saved history, and update protocol schemas and generated types.
- Preserve the warning, denial limit, and interrupted status without emitting a separate error notification.

## Testing

Add an integration test covering omitted, `default`, and `strict` settings, checking warnings, live turn errors, the absence of separate error notifications, and persisted turn errors after restart.

GitOrigin-RevId: cb5d379e64728d4d7b9daf834c13756e4a70db31
This commit is contained in:
Won Park
2026-09-27 22:05:19 +00:00
committed by copyberry
parent ea64727556
commit d7748e1185
56 changed files with 325 additions and 38 deletions
+6
View File
@@ -1861,6 +1861,7 @@ pub enum CodexErrorInfo {
CyberPolicy,
BioPolicy,
MisalignmentPolicyViolation,
TooManyDenials,
HttpConnectionFailed {
http_status_code: Option<u16>,
},
@@ -1905,6 +1906,7 @@ impl CodexErrorInfo {
| Self::CyberPolicy
| Self::BioPolicy
| Self::MisalignmentPolicyViolation
| Self::TooManyDenials
| Self::HttpConnectionFailed { .. }
| Self::ResponseStreamConnectionFailed { .. }
| Self::InternalServerError
@@ -4255,6 +4257,10 @@ pub struct Chunk {
pub struct TurnAbortedEvent {
pub turn_id: Option<String>,
pub reason: TurnAbortReason,
/// Optional error describing why the turn was interrupted.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub error: Option<ErrorEvent>,
/// Unix timestamp (in seconds) when the turn started.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "number | null", optional)]