Skip to content

Report content-filter retries and failures to App Server clients - #19

Merged
Harold Hunt (huntharo) merged 2 commits into
pwragentfrom
agent/content-filter-protocol
Nov 15, 2026
Merged

Harold Hunt (huntharo) merged 2 commits into
pwragentfrom
agent/content-filter-protocol

Conversation

@huntharo

@huntharo Harold Hunt (huntharo) commented Nov 14, 2026 •

Copy link
Copy Markdown

When a Responses API sample ends with response.incomplete / reason: content_filter, a release App Server could recover without notifying its client: the first WebSocket retry was suppressed, reported retries were labeled responseStreamDisconnected, and exhausted retries became other.

This change always reports content-filter retries with codexErrorInfo: "contentFilter" and Response blocked by content filter; retrying (1/N). Terminal failures carry the same code. It preserves the developer-guidance sampling retry, ordinary first WebSocket reconnect suppression, and the reason: content_filter text in additionalDetails used by older PwrAgent builds.

Rebased on pwrdrvr/pwragent at 26c43ca834ab91383e6f911a853519ff1bdd7c20. Both bugs remain present on this updated base; the original reproduction was against f4bf86151960caeee799e0e434cba482eee21072 and upstream 81b995a6c9. This is a downstream draft PR targeting pwragent. No release tag is created.

Regression evidence

Original pre-fix evidence was captured on tests-only commit ebd46fbbb4eec534c832b40d8ec3ae3c44f31414. The rebased tests-only commit is 10064da1b1; the same regression assertions are retained.

  • content_filter_recovery_reports_first_retry::{http,websocket} checks exactly one raw App Server error, willRetry: true, the wire code/message/details, and successful completion with error: null.
  • content_filter_exhaustion_reports_failed_turn checks the retry notification, terminal notification, and failed turn error code.
  • ordinary_first_websocket_reconnect_stays_hidden checks the release behavior with a real dropped sampling connection after successful startup prewarming.
  • Protocol and v2 conversion tests cover the dedicated code. TUI recovery coverage checks the content-filter message, the updated base's HTTP 429 busy message, and status restoration after both notifications.

Pre-fix runs with debug assertions disabled produced 3 failing content-filter transport tests and 1 passing ordinary reconnect test. The WebSocket regression received zero errors instead of one; HTTP/exhaustion received responseStreamDisconnected instead of contentFilter. The core mapping and v2 conversion regressions independently failed with other. Logs are retained in the assigned worktree's .local/red-{app-server,protocol,app-server-protocol}.log. The final fix also removes the unused HTTP expectation from the WebSocket fixture's teardown.

Compatibility and scope

Audited enum consumers: core serialization/status replay, v2 conversion, guardian reviewer exhaustive retry classification, TUI, analytics/telemetry, generated TypeScript, and Python SDK. Existing Rust unknown-tag fallbacks and TypeScript open unions accept new classifications. The regenerated Python SDK accepts both contentFilter and an unknown futureError string. Guardian terminal retry policy is preserved. No PwrAgent change is needed for its existing detectProviderResponseBlock rule in pwrdrvr/PwrAgent#3720.

Regenerated stable JSON/TypeScript fixtures, stable/experimental embedded exports, and Python SDK types using the repository generator.

Open question: a recovered block still leaves no item in thread/read. Persisting a dedicated marker would require a separate protocol change.

Validation

Post-rebase validation uses Rust 1.99.1 on 2026-11-15: 856 selected tests passed, plus formatting and scoped all-targets clippy. Pre-fix rows below retain the original regression evidence; all other results are rerun on the updated base. Run from codex-rs unless a command explicitly starts at the repository root. Transport tests use the release notification policy without an optimized rebuild:

unset CODEX_SANDBOX_NETWORK_DISABLED
export RUST_MIN_STACK=8388608
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export CARGO_PROFILE_DEV_DEBUG_ASSERTIONS=false
export CARGO_PROFILE_TEST_DEBUG_ASSERTIONS=false
export CARGO_INCREMENTAL=0
export PATH="$PWD/../.local/tools/bin:$PATH"
export RUSTY_V8_ARCHIVE="$PWD/../.local/v8-152.2.0/librusty_v8_ptrcomp_sandbox_release_aarch64-apple-darwin.a.gz"
export RUSTY_V8_SRC_BINDING_PATH="$PWD/../.local/v8-152.2.0/src_binding_ptrcomp_sandbox_release_aarch64-apple-darwin.rs"

The inherited sandbox network marker was removed only for authorized test execution against local mocks; otherwise skip_if_no_network! returns without exercising the test. The release-mode fixture omits the App Server's debug-only startup flag.

Command Result
cargo nextest run --locked -p codex-protocol --lib -E 'test(content_filter_maps_to_protocol)' (tests only, before fix) Failed: other instead of content_filter.
cargo nextest run --locked -p codex-app-server-protocol --lib -E 'test(content_filter_error_info_converts_to_camel_case)' (before fix) Failed: other instead of contentFilter.
cargo nextest run --locked -p codex-app-server --test all --no-fail-fast -E 'test(suite::v2::content_filter::)' (before fix) 3 failed, 1 passed.
cargo nextest run --locked -p codex-protocol -p codex-app-server-protocol -p codex-guardian-reviewer --lib --no-fail-fast 782 passed; 1 ignored generator test. Includes stable/experimental export consistency.
cargo nextest run --locked -p codex-core --lib --no-fail-fast -E 'test(responses_retry::)' 2 passed.
cargo nextest run --locked -p codex-core --test all --no-fail-fast -E 'test(content_filter) | test(websocket_fallback) | test(turn_error_details) | test(retry_after)' 63 passed; HTTP/WebSocket mocks exercised.
cargo nextest run --locked -p codex-app-server --test all --no-fail-fast -E 'test(suite::v2::content_filter::)' (after fix) 4 passed; HTTP/WebSocket recovery, exhaustion, hidden ordinary reconnect.
cargo nextest run --locked -p codex-tui --lib --no-fail-fast -E 'test(live_app_server_stream_recovery) | test(stream_error)' 5 passed after adapting the shared helper to case-specific header expectations.
cargo clippy --locked -p codex-core -p codex-protocol -p codex-app-server-protocol -p codex-app-server -p codex-tui -p codex-guardian-reviewer --all-targets Passed; warnings in unchanged upstream code.

From the repository root:

just write-app-server-schema
just write-app-server-schema --experimental
PATH="$PWD/.local/tools/bin:$PATH" RUSTC_BOOTSTRAP=1 just fmt
PATH="$PWD/.local/tools/bin:$PATH" RUSTC_BOOTSTRAP=1 just fmt-check
git diff --check

All five commands passed. Formatting used CI-pinned just 1.51.0 and a worktree-local DotSlash launcher. No unrelated formatter changes are included.

Helper build: downloaded the new base's 152.2.0 ptrcomp_sandbox_release Darwin arm64 archive/binding pair from the same Codex release used by fork CI, verified the manifest against third_party/v8/rusty_v8_152_2_0_release_manifests.sha256, and verified both artifact SHA-256 checksums. The helper build passed:

RUSTY_V8_ARCHIVE="$PWD/../.local/v8-152.2.0/librusty_v8_ptrcomp_sandbox_release_aarch64-apple-darwin.a.gz" \
RUSTY_V8_SRC_BINDING_PATH="$PWD/../.local/v8-152.2.0/src_binding_ptrcomp_sandbox_release_aarch64-apple-darwin.rs" \
cargo build --locked --bin codex-code-mode-host

Python compatibility smoke (repository root) passed:

PYTHONPATH="$PWD/sdk/python/src" uv run --project sdk/python --frozen --only-group test python -c 'from openai_codex.generated.v2_all import CodexErrorInfo; assert CodexErrorInfo.model_validate("contentFilter").model_dump(mode="json") == "contentFilter"; assert CodexErrorInfo.model_validate("futureError").model_dump(mode="json") == "futureError"; print("known and unknown error codes accepted")'

Unposted upstream issue

Searched upstream issues again on 2026-11-14, including "content_filter" "codexErrorInfo" in:body (no matches), and reviewed openai#60145, openai#56432, openai#56875, and openai#38831. Their bodies do not describe this combined protocol visibility gap. A draft following .github/ISSUE_TEMPLATE/4-bug-report.yml is saved at .local/upstream-content-filter-issue.md in the assigned worktree. It has not been posted; the operator decides whether to file it.

@huntharo
Harold Hunt (huntharo) force-pushed the agent/content-filter-protocol branch from a511efd to 8125ea4 Compare November 15, 2026 20:10
@huntharo
Harold Hunt (huntharo) marked this pull request as ready for review November 15, 2026 21:58
@huntharo
Harold Hunt (huntharo) merged commit 3486be5 into pwragent Nov 15, 2026
12 checks passed
@huntharo
Harold Hunt (huntharo) deleted the agent/content-filter-protocol branch November 15, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant