Repository navigation
fix(errors): preserve diagnostics and successful tool results - #140362
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 3:31 PM ET / 19:31 UTC. ClawSweeper reviewWhat this changesPreserves cross-realm and disposal error details, prevents unreadable observer errors from discarding successful Codex tool results, and strengthens consumer regression coverage. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, focused repair absent from the reviewed main revision. No blocking correctness finding remains, and the maintainer-owned PR is not a cleanup candidate. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s shared error formatter turns thrown values into caller-redacted diagnostics. The Codex tool bridge executes OpenClaw tools and returns their results to Codex while separately notifying internal observers. flowchart TD
A[Codex tool request] --> B[OpenClaw tool execution]
B --> C[Successful tool result]
C --> D[Result observer]
D -->|Observer throws| E[Safe error formatter]
F[Cross-realm and disposal errors] --> E
E --> G[Redacted diagnostics]
C --> H[Codex response]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +43, Tests +224. Total +267 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep error normalization centralized and make observer diagnostics preserve completed tool outcomes without changing execution authority or the wire contract. Do we have a high-confidence way to reproduce the issue? Yes, from source: a successful tool followed by an observer throwing an Error with an unreadable message can escape main’s String(error) catch and enter failure handling. This review did not execute the reproduction. Is this the best way to solve the issue? Yes. Reusing the existing safe formatter at both observer catches and extending its shared diagnostic traversal repairs the owning boundaries without introducing a parallel API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d8cff593dcb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review The final follow-up fixes two observer diagnostics that could discard a successful tool result when formatting an unreadable error. Both consumers use the existing safe formatter; protocol and execution facts are preserved. Causal tests, 243 affected tests, changed-code checks, and a plain Node probe with real temporary-file writes passed. The PR body records the precise baseline and sibling-control results. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
…aw#140362) * fix(errors): preserve cross-realm and async disposal failures * test(restart): preserve cleanup across diagnostic failures * fix(codex): preserve tool results when observer diagnostics fail
VM-created errors could lose their messages and causes, async disposal could hide both failures, and throwing diagnostic getters could interrupt error reporting. In the Codex tool bridge, an observer’s unreadable error could also escape logging after a tool succeeded, discard the response, and notify the observer again.
Recognize cross-realm errors and suppressed disposal failures in the shared formatter, retaining its existing graph traversal, deduplication and caller-owned redaction. Route the two Codex observer diagnostics through the existing safe formatter so successful results and execution evidence survive reporting failure. Native response fields, retry and authority rules stay unchanged. Restart and Codex consumer tests distinguish safe getter handling from actual reporting failures and verify exact observer, completion and protocol facts.
Validation: all 12 formatter regressions failed before repair, then 81 formatter/adapter tests passed. The restart follow-up passed 91 tests; the Codex follow-up passed 243 tests. Independent P0–P2 reviews, changed-code gates, typed lint and the existing line-limit ratchet passed. CI exposed the obsolete consumer expectations; those are repaired without weakening cleanup or failure assertions.
Four direct Node 24.19 VM/native-disposal scenarios passed with the fix. A separate plain Node source probe drove the actual bridge and watchdog with an exclusive temporary-file write: all four current ordinary/hostile-observer cases kept one write, one notification and the successful response. The baseline direct bridge wrote once but notified twice and rejected; the baseline combined watchdog remained a passing sibling control. Processes exited naturally with no unhandled rejection, and loaded source hashes differed only in the two baseline producer substitutions. This is source-level tool-host proof, without a native Codex app-server or external provider/authentication run. The unchanged wire contract was checked in the pinned official Codex response schema and dynamic tool handler.
Extracted from #135599. Production +43 lines for the demonstrated error-formatting contracts; the two observer repairs are net zero. Tests +224. No plugin lifecycle implementation dependency, new public API, configuration or storage schema.