Repository navigation
fix(openai): recover item conflicts before output and across runs - #199896
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@clawsweeper re-review Please review final head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR permits item-conflict recovery after compaction-only events, carries deferred repairs into copied histories, and logs successful saved repairs. Example: A Responses stream emits response.compaction.compacting and then item_conflict before assistant output.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses concrete recovery gaps still present on main; no actionable correctness or security findings were identified. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Responses transport converts saved conversation history into provider requests and consumes SSE or WebSocket events, producing assistant output and durable replay receipts. flowchart TD
A[Saved transcript] --> B[Replay conversion]
B --> C[Responses client]
C --> D[SSE or WebSocket]
D --> E[Recovery decision]
E --> F[Assistant output]
E --> B
E --> A
Technical reviewBest possible solution: Keep the shared recovery owner, distinguish compaction from output, and let existing repair receipts follow copied history without relaxing checkpoint or credential fences. Do we have a high-confidence way to reproduce the issue? Current-main source explains both failures: compaction progress marks output observed, and copied repair receipts fail session matching; the supplied regressions target those paths, although the incident's exact wire sequence remains unconfirmed. Is this the best way to solve the issue? The patch repairs existing classification and replay owners with a transient applied flag, preserving bounded retries and avoiding another persistence or recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7e48c6be722a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +45, Tests +141, Docs +4. Total +190 across 10 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 15, 2026, 9:58 PM ET / November 16, 2026, 02:58 UTC. |
|
Merged via squash.
|
…enclaw#199896) * fix(openai): recover item conflicts before output and across runs * fix(openai): bind the applied repair callback lexically
Related: #199757
What Problem This Solves
Fixes failed or repeatedly wedged turns when Responses reports
item_conflictbefore assistant output, or a later internal session-effects run inherits a deferred repair.User Impact
Pre-output conflicts retry once within the same turn. Conflicts after text, reasoning, or tool activity remain deferred to avoid repeating work; the saved repair applies after reload and when that history is copied into an internal session-effects run. Successful requests applying a saved repair log
recovered. No configuration or migration is needed.Why This Change Was Made
The shared SSE/WebSocket classifier inferred output from every event outside a short prelude list. Compaction progress and compaction item lifecycle events emit no assistant content, so they must not disable recovery. The replacement checks actual output items, deltas, and tool activity.
Deferred receipts already survive SQLite reopen, but their session identity fence prevented a copied history from applying its repair. Item-repair receipts now follow that history while preserving provider, model, endpoint, and credential fences. Encrypted checkpoints and ordinary compaction suppression remain session-bound. The converter reports when it applies a repair, including prepared-input reuse, so completion logging needs no additional history scan. Production delta: +62/−17, net +45 lines; growth carries the applied fact across conversion and request completion. No new cache or persistence format.
Evidence
dd2d58be, including fix(agents): recover sessions after Responses item conflicts #199757 (d1307e61), loggedModel request failedat 2026-11-16 02:07:13.716Z,item_conflict_recovery outcome=deferredat .717Z, andEmbedded agent failed before replyat .760Z (rune8dafb99, request 1; dashboard hash9e428ae0, recovery hashsha256:e1dc26a2550b). The same recovery hash loggeddeferredat 02:13:22Z and 02:13:54Z on request 1 of new internal-session-effects runs. These logs establish recurrence; the incident's preceding wire events were not captured, so exact production attribution remains unconfirmed.443e9730695d6fa1549d84d9f45187883e9570f1; two full compaction-lifecycle cases fail before the review correction. All 21 pass with the fix. Real text/function/hosted-tool output still defers over both transports.964b8c5b0a5f8567b7e163cd77e83874a276b9e0, base443e9730695d6fa1549d84d9f45187883e9570f1). Its compaction-lifecycle finding was fixed with red/green proof.pnpm check:changedfound an unbound-method lint error; the arrow callback fixes it, focused type-aware lint passes, and all 21 integration cases pass again. The fullpnpm check:changed --base 443e9730695d6fa1549d84d9f45187883e9570f1rerun passes every check except the attributed baseline dead export (including corrected lint, core and all 29 test type graphs, formatting, and import-cycle guards). Exact-head CI run 43794223591 andopenclaw/ci-gatepassed. ClawSweeper’s final-head review has zero findings and zero open items. Native landing merged the reviewed head ase1f84d9cf7709ddb23e1e0ab0a906a298c363ee5on 2026-11-16 at 03:06:09Z; no admin CI exception was needed. The dead-export gate independently fails on the exact parent forresolveRollbackWorkerInputs; perf(update): replace the candidate canary with a runtime contract check #198268 (e4a30936bb35) removed its external caller while leaving it exported. This is an inherited main regression, not a passing check.