Expose resumable misalignment details through app server (#40952)

## Why

App-server clients need the explanation and steering instruction returned with a
misalignment policy violation to offer a user-confirmed continuation. Missing or
incomplete details must continue to behave as a terminal block.

## What changed

- Parse optional misalignment classification, explanation, and steering details
  from streamed and HTTP Responses errors and propagate them through core errors.
- Include the details in live app-server `error` and `turn/completed` payloads and
  export the corresponding protocol schemas and TypeScript types.
- Keep explanations and steering messages out of serialized rollout events and
  redact them from debug output.
- Document how clients can resume with `turn/start` after user confirmation.

## Testing

- Cover streamed, HTTP, and WebSocket-wrapped errors, including malformed and
  classification-only details.
- Verify live app-server notifications expose resumable details without writing
  the explanation or steering message to the rollout.

GitOrigin-RevId: 329258a444c2cd91d0c57ab1720830b33ddcfac5
This commit is contained in:
Francis Chalissery authored and copyberry committed 2026-08-26 18:42:44 +00:00
1 parent 0e9a2bae52
commit 7276d67081
63 files changed
+1604 -15

No files matched your search

@@ -88,6 +88,7 @@ fn deliver_usage_limit_error(app: &mut App) {
app.chat_widget.handle_server_notification(
ServerNotification::Error(ErrorNotification {
error: AppServerTurnError {
misalignment: None,
message: "Usage limit reached.".to_string(),
codex_error_info: Some(CodexErrorInfo::UsageLimitExceeded),
additional_details: None,
@@ -86,6 +86,7 @@ async fn misalignment_policy_blocks_queued_turns_and_goal_resumption() -> Result
let queued_turn = next_user_turn_op(&mut op_rx);
let failed_turn = Turn {
error: Some(AppServerTurnError {
misalignment: None,
message: "misalignment policy violation".to_string(),
codex_error_info: Some(CodexErrorInfo::MisalignmentPolicyViolation),
additional_details: None,
@@ -176,6 +177,7 @@ async fn misalignment_policy_in_parent_stops_active_side_conversation() -> Resul
parent_thread_id,
ServerNotification::Error(ErrorNotification {
error: AppServerTurnError {
misalignment: None,
message: "misalignment policy violation".to_string(),
codex_error_info: Some(CodexErrorInfo::MisalignmentPolicyViolation),
additional_details: None,