fix(review): retain safe diagnostics for Codex failures - #1335
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 7:47 AM ET / 11:47 UTC. ClawSweeper reviewWhat this changesThe PR adds a bounded, sanitized failure-diagnostics artifact for caught Codex failures in exact reviews and documents its workflow upload policy. Merge readinessKeep this member-authored PR open for normal maintainer review. The introduced path keeps failure diagnostics separate from review publication, bounds and sanitizes the three retained diagnostic inputs, and uploads only after a caught exact-review failure. Priority: P2 Review scores
Verification
How this fits togetherExact reviews run Codex over queued repository items and normally produce durable review records. This change creates a separate failure-only artifact for maintainers when Codex fails, without making that artifact an input to publication or queue state. flowchart LR
A[Exact review request] --> B[Codex review process]
B --> C{Caught failure?}
C -->|Yes| D[Sanitize bounded diagnostics]
D --> E[Failure artifact upload]
C -->|No| F[Normal review publication]
E --> G[Maintainer inspection]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the failure artifact limited to the three sanitized diagnostic fields, with no queue, publication, or durable-record dependency. Do we have a high-confidence way to reproduce the issue? Not applicable as issue reproduction: this is a PR review. The PR body supplies a concrete compiled-CLI trace exercising caught synthetic Codex failures through the introduced exact-review path. Is this the best way to solve the issue? Yes. A failure-only artifact, isolated from publication and restricted to sanitized diagnostic fields, is a narrow maintainable way to retain useful operational evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b445c64591bc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where an exact review could catch a Codex process failure, keep the runner alive long enough to write a local failure report, and then finish without durable diagnostic evidence for the underlying startup or execution cause.
Why This Change Was Made
Caught exact-review failures now produce a publication-isolated
failure-diagnostics/bundle containing a typed manifest plus bounded, sanitized error, structured stdout error, and stderr-tail files. The writer storesmanifest.jsonlast as the readiness marker, caps the complete bundle at 24 KiB, and fails closed per file when content remains unsafe.The security boundary is deliberately narrow:
error/turn.failedJSONL detail is retained from stdoutThe workflow uploads this bundle only for a non-cancelled failed exact-review job, with a unique run/attempt name and 14-day retention. It does not feed queue publication or exact-review bundle construction.
User Impact
Maintainers can inspect useful, bounded evidence for caught Codex execution failures after the runner has exited. Cancellation and runner loss remain outside this guarantee.
OpenClaw Bay Impact
Bay, queue, dashboard, publication, ledger, and persistent schemas are unchanged. The new artifact is failure-only and has no dependency edge into durable exact-review publication.
Documentation Impact
Updated the active scheduler runbook to describe the failure-only artifact, its retained file set, sanitization boundary, and 14-day retention. The workflow is the source of truth; this documentation should be updated when the diagnostic file set, upload condition, or retention policy changes. No changelog entry is included because this is an internal operational diagnostic repair within the independently reviewed seven-file scope.
Evidence
fa9b1e2e938bcdc77e79ae115e5b0b76d8fe1022git diff --check: passedgpt-5.6-sol: passedpnpm run checkitself was not used in the linked worktree because pnpm attempted to reconcile the required sharednode_modulessymlink. Its static, build, lint, format, and changed-owner coverage surfaces were run directly. A prior repo-wide coverage attempt reached 4,252 tests and passed coverage thresholds, with unrelated host-specific failures and one unrelated live-proof timeout.Real Behavior Proof
node dist/clawsweeper.js review --local-range.codex_executionfailures containing adversarial prompt, model, prefixed assignment, credential, private-path, internal-host, and unstructured stdout values. A third run omitted exact mode.--local-range.run_c4ff948163e5, leasecbx_48bbe54562d8, resultsucceeded,leaseStopped=true.Codex contract inspection covered
codex-rs/cli/src/main.rs:220-245,2840-2870,codex-rs/exec/src/event_processor_with_jsonl_output.rs:103-115,531-550, andcodex-rs/exec/src/exec_events.rs:1-65.Scope And LOC
Changed paths are limited to the approved workflow, scheduler docs, command wiring, private diagnostics writer, and three focused tests.
The +190-line private writer owns the new bounded sanitization and atomic readiness capability. The remaining production growth is +21 lines of failure-only command wiring; workflow and docs add the upload contract and operator description.
Overlap
origin/mainadvanced throughb445c64591bcf9bf6d68122f28f6c95c4fa1dbf4; those intervening commits do not touch the seven retained paths.