Repository navigation
fix(codex): retain failed conversations for guarded continuation - #139246
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 5, 2026, 1:58 PM ET / 17:58 UTC. ClawSweeper reviewWhat this changesPreserves failed Codex conversations for guarded later messages and classifies misalignment refusals through the existing terminal-error path, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review This repair remains necessary on current main. The revised head resolves the previous settlement-integration concern, and no blocking patch defect was found. Priority: P1 Review scores
Verification
How this fits togetherThe Codex plugin connects OpenClaw chat turns to native Codex conversations. Its lifecycle owner retains reusable threads, validates later requests, and returns terminal outcomes for chat delivery. flowchart TD
A[Chat message] --> B[Codex conversation owner]
B --> C[Ownership and configuration checks]
C --> D[Native Codex turn]
D --> E[Terminal outcome]
E --> F[Visible reply or refusal]
E --> G[Retain safely settled thread]
G --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +21, Tests +118, Docs +13. Total +152 across 11 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Retain settled failures through the existing subscription owner while preserving configuration attestation and terminal refusals; distinguishing safe failure from success and interrupted teardown justifies the small state expansion. Do we have a high-confidence way to reproduce the issue? Yes—the native HTTP401 → completed failure → later message sequence is supported by current-main source and supplied before/after results; this review did not execute it. Is this the best way to solve the issue? Yes. Repairing retention at its lifecycle owner avoids unnecessary reconfiguration, while extending the existing refusal diagnostic avoids a competing core error contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e4becea5e2c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Ready to land at
Validation commands: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt-thread-cleanup.test.ts extensions/codex/src/app-server/event-projector.terminal-errors.test.ts extensions/codex/src/app-server/run-attempt.settlement.test.ts
OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-codex-refusal-product-proof.e2e.test.ts
GOMEMLIMIT=4GiB GOMAXPROCS=1 node scripts/run-oxlint.mjs --tsconfig extensions/tsconfig.json extensions/codex/src/app-server/run-attempt-finalize.ts
OPENCLAW_BUILD_PRIVATE_QA=1 OPENCLAW_BUNDLED_PLUGIN_BUILD_IDS=codex,openai,qa-lab,qa-channel NODE_OPTIONS=--max-old-space-size=6144 node --import ./scripts/tsx.mjs scripts/build-all.mts qaRuntimeResults: 54 affected focused tests, four Gateway scenarios, lint and build pass. Formatting and contribution ratchets pass. Production +21 lines; tests/support +118; docs +13. The independent runtime pass did not fault-inject every hidden lifecycle/configuration or direct-input/confirmation guard; those remain covered by source and focused regression evidence. First-time adoption or changed generic configuration of a loaded failed thread still requires native unloading. No real policy refusal was requested or overridden. |
|
Thanks @Colton-Harris! Landed in 64c543a78b7fe2497bb40e5b73c47483e900ff06, with your contributor credit retained. Proof: Real Gateway and pinned native Codex HTTP401 recovery, independent ordinary/manual continuation and ownership rejection, plus harmless terminal/retry protocol controls. Exact-head CI, 54 affected focused tests, four Gateway scenarios and both reviews passed for dda04893deb433098864bc65a6fdf5208c0f4f3e.
The existing configuration, ownership and native confirmation guards remain. No public SDK error, schema or configuration option was added. Issue #138835 is closed; the original #138846 is superseded by this verified replacement. |
* commit '911d7d5b0c107f7274f2415ca9655dcc6105f0e8': (867 commits) fix(skills): deliver pending Workshop approval controls (#139248) fix(gateway): deliver loopback ask_user prompts to the originating channel (#138831) docs: keep root agent instructions focused on repository policy (#139258) fix(matrix): exclude archived state roots from scans and selection (#112329) perf(agents): prepare exact tool names once per catalog batch (#139267) fix: preserve Swarm progress and simplify owner plumbing (#139269) fix(tailscale): release claims after gateway process-group exit (#139261) refactor(cli): simplify lazy command registration (#139108) test(ui): retain synthetic widget failure evidence (#139229) fix(buzz): keep implicit replies at thread root (#138879) test(diagnostics): await graceful Gateway shutdown before cleanup (#139247) fix(ci): unblock releases with different tooling package managers (#139259) feat(ui): add social preview links for private sessions (#139250) fix(codex): retain failed conversations for guarded continuation (#139246) chore(ui): refresh control ui locales (#139200) fix(ci): run browser checks for real-gateway inputs (#139256) fix(llama-cpp): reconcile managed router state before requests (#136363) chore(i18n): refresh native locales (#139237) refactor(worker): unify inference payload handling (#139245) refactor(terminal): replay wrapped prefixes in one pass (#139240) ...
Require a named reasoning parameter before retrying with a different thinking level, preserving model/account failures and configured fallback decisions. Consolidate supported-value parsing. Related: #139246.
…nclaw#139246) Retain fully settled failed native conversations through the existing configuration owner so later user turns can continue on the same thread. Preserve typed misalignment decisions through the established refusal diagnostic, without recovery or model fallback replay. Keep active-owner, generation, configuration, catalog, unload and direct-input boundaries intact. No new public SDK error, schema, protocol or configuration option. Verified with real Gateway/pinned-native HTTP401 recovery, independent ordinary/manual continuation and cross-conversation rejection, terminal/retry protocol controls, 54 affected focused tests and four Gateway scenarios. Fixes openclaw#138835. Supersedes openclaw#138846. Thanks @Colton-Harris for the report and original repair. AI-assisted. Co-authored-by: Colton Harris <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…#139295) Require a named reasoning parameter before retrying with a different thinking level, preserving model/account failures and configured fallback decisions. Consolidate supported-value parsing. Related: openclaw#139246.
What Problem This Solves
After a completed native failure, the next message could falsely report that the persistent thread was active elsewhere. A typed policy refusal also lost its classification.
Why This Change Was Made
Retain fully settled failed ordinary threads under the existing subscription, configuration, generation, and tool checks. Map the typed policy outcome to the existing refusal diagnostic, preserving no-retry/no-fallback behavior. Configuration changes still require confirmed native unloading.
User Impact
Users can continue the same failed conversation without losing its thread. Terminal refusals stop the current request; later input does not override policy. No public API or schema is added.
Evidence
Real Gateway/native-runtime checks reproduced a controlled HTTP 401 followed by false activity, then verified recovery on the same thread. Registered refusal scenarios delivered one refusal without retry, and an ordinary retryable error still retried. Focused retention, settlement, and cleanup tests passed. Synthetic protocol events tested delivery rather than real policy refusals.
Closes #138835. Supersedes #138846; the original contribution is retained. Thanks @Colton-Harris for the report and original repair. AI-assisted.