Skip to content

fix(codex): classify busy session retirement as global preflight - #188640

Open
dubr1k wants to merge 1 commit into
openclaw:release/2026.10.10from
dubr1k:fix/10.10-busy-session-preflight
Open

dubr1k wants to merge 1 commit into
openclaw:release/2026.10.10from
dubr1k:fix/10.10-busy-session-preflight

Conversation

@dubr1k

@dubr1k dubr1k commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Related: #181046

Selectively backports the session-retirement correction from #181204 to release/2026.10.10.

What Problem This Solves

Fixes a claimed Codex thread being reported as an ordinary execution error when a session deletion or context reset is refused.

User Impact

Classifies the refusal as a model-independent preflight failure while preserving its original diagnostic, active-thread claim, binding, and ownership checks. If propagated to the core fallback owner, that unscoped preflight failure stops before the next candidate. The producer-to-fallback composition has not been demonstrated at a shipped entry point; the evidence below keeps that gap explicit. No configuration or migration is required.

Why This Change Was Made

The release branch already uses AgentHarnessPreflightError when releasing a busy retained thread, but its session-retirement path still throws Error. Use the same globally scoped preflight contract at that remaining producer. This is the error-class portion of the merged fix; it does not remove an adoption guard or add harness-local scope.

Published 2026.10.10: partial inclusion of #181204

The release notes correctly credit #181204 for stopping model fallback when a policy change encounters a busy Codex thread. The published tag contains the typed refusal in thread-lifecycle-warm.ts, but session-retirement.ts still throws an ordinary Error for a claimed thread.

This release backport changes only that remaining retirement producer to the existing unscoped AgentHarnessPreflightError. It does not reapply the warm-thread correction, remove an adoption guard, or add harness-local scope. Please evaluate it as completion of the release's error-classification contract, rather than as a new claim that ordinary Gateway reset triggers model fallback. The shipped retirement-refusal-to-fallback composition remains unproven, as detailed below.

Evidence

Additional published-release check — November 3, 2026

The remaining error-class correction was included in a selective port installed on official 10.10 packages on macOS and Linux. The combined port's 50 focused checks passed, including the nine session-retirement cases. A successful live parent/child continuation on those installations is operational continuity evidence only: it did not trigger the claimed-thread retirement refusal or prove suppression of a subsequent model candidate. The exact-head contract checks and the unresolved shipped-entry-point gap below remain the evidence for this PR.

  • The existing context-reset regression fails on the base because the refusal is an ordinary Error. With the correction, deletion and context reset both return an unscoped AgentHarnessPreflightError before mutation; the binding and active claim remain, and no session transaction or native request runs.
  • Node 24.22.1: 9 session-retirement cases and 16 existing fallback terminal-boundary cases pass (41.60 s including both worker preparations). Extension production and test typechecking, focused lint, formatting, and git diff --check pass. The full plugin lane was also attempted; its pre-existing local failures are described below.
  • Shared autoreview of the complete local delta and surrounding cleanup against 06d598c818155a5ac6ad00c9611bbb4b6ed57d45, P0–P2: no actionable findings. The reviewer inspected code; tests were executed separately.

This proves the producer contract and the existing fallback owner's terminal behavior with controlled fixtures. A live network fallback was not deliberately triggered.

Local plugin-lane result on macOS: pnpm test:extension codex --maxWorkers=6 exits 1 in its 433-file batch: 5,053 passed, 3 failed, 1 skipped (460.86 s including preparation). The wrapper announces 439 discovered test files; the actual Vitest summary reports 433 executed files. The three failures also reproduce without this session-retirement change, using identical Codex sources from the release base:

  • Two transport-startup.test.ts cases fail while observing native descendants, with ProcessInspectionError (reason: "permission"). The unchanged file reproduces 2 failed / 2 passed.
  • One thread-shell-environment.native.test.ts case expects an empty Git identity after shell-environment filtering but observes a nonempty identity. The unchanged file reproduces 1 failed / 3 passed.

These failures were retained and were not hidden with retries, skips, relaxed assertions, or timeout changes. They do not exercise session retirement; the 9 changed-owner cases and 16 fallback-consumer cases pass. This is not a clean full local plugin run.

Remaining runtime proof: the shipped CLI source-runtime build and help entry point pass on this head. An audit of the supported reset, deletion, rewind/branch-switch, and initialization-cleanup callers did not establish a faithful live reproduction of this particular retirement refusal inside an eligible model-fallback chain. Normal reset cancels and retires work first; rewind/history mutation rejects competing work before this participant. Those RPC handlers are outside runWithModelFallback. The producer-to-fallback connection remains unproven at a shipped entry point; the tests above establish those contracts separately. No cancelled reset, injected native claim, or run without eligible fallback candidates is presented as that missing proof.

Exact-head production-path clarification (2026-10-31)

A fresh Linux source audit distinguishes persistent-session reset (AgentHarness.reset → retireCodexAppServerSessionGeneration) from history context reset (withSessionContextReset → this changed deletion producer). Ordinary persistent-session Gateway reset drains work before harness cleanup; history mutation rejects live source work before native context preparation. The mutation RPCs are not a fallback runner. Consequently the combined shipped Gateway reset-refusal → next-model suppression trace remains unestablished; no modified reset flow, injected claim, or artificial combination of boundaries is presented as that proof. A maintainer needs to identify the intended supported caller, or scope acceptance to the actual retirement boundary. See the companion technical clarification comment for exact-head source locations.

Incognito exception: this distinction does not cover every reset. session-reset-service.ts:656–667 routes incognito reset through deleteIncognitoSessionForReset; session-reset-incognito.ts:61 invokes deleteSessionEntryLifecycle, and the memory lifecycle owner (session-accessor.memory-lifecycle.ts:121) enters withSqliteSessionDeletions. Thus an incognito reset can reach the changed deletion hook, after admission drain and harness cleanup. This path still does not establish propagation into an eligible model-fallback chain. Generic maintenance/prepared-write/cleanup callers also exist and are not ruled out by this scoped audit.

Fresh isolated Linux checks (2026-10-31)

On unchanged exact head 961110a9a073e9c133fb624f17f3e758bf96151a, Node v24.22.1 and pinned pnpm 12.15.0: session-retirement 9/9 passed (384.30 s including worker preparation), fallback terminal-boundary 16/16 passed (345.72 s including worker preparation). Both repository wrappers exited 0. These are separate production-owner contract tests, not the missing combined live trace. Independent read-only source review confirmed the persistent/incognito distinction and broader cleanup callers; it did not establish the combined fallback flow. No production Gateway, data, or installed packages were changed.

Selectively backport the session-retirement error-class correction from openclaw#181204 to release/2026.10.10, preserving active-thread ownership checks.
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR classifies busy Codex session retirement refusals as globally scoped preflight errors while preserving existing ownership checks.

Example: Deleting session-before-deletion while its native Codex thread remains claimed.

  • Before: The retirement owner throws an ordinary Error before mutation.
  • After: It throws an unscoped AgentHarnessPreflightError with the same diagnostic, preserving the binding and claim.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-correct, but the required real-behavior evidence remains fixture-only.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A busy-session retirement refusal is classified as an ordinary execution failure rather than a model-independent coordination failure.
Reason: The narrow correction preserves existing safeguards and matches the accepted main contract; the revised description appropriately limits its fallback claim.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this is a focused, correct backport of an accepted main correction, and the release branch still needs the error-class change.

Priority: P2
Reviewed head: 961110a9a073e9c133fb624f17f3e758bf96151a

Before merge

  • Add real behavior proof - The reported exact-head producer and fallback tests establish separate contracts using controlled fixtures; CLI build/help does not exercise the changed refusal. Supply redacted CLI or Gateway output from a supported deletion or history-mutation path showing the typed refusal with binding and claim preserved before mutation. The previous proof request is narrowed to this actual boundary; no artificial reset-to-fallback composition is requested. Remove IPs, API keys, phone numbers, and non-public endpoints from evidence. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Provide shipped-entry-point evidence for the actual claimed-thread deletion or history-mutation refusal; a combined reset-to-fallback trace is unnecessary for the revised scoped claim.
Agent review details

How this fits together

Session deletion and history mutation invoke the Codex harness retirement participant, which checks native thread ownership before allowing the session transaction; core fallback separately recognizes globally scoped preflight errors.

flowchart TD
  A[Session deletion or history mutation] --> B[Harness retirement participant]
  B --> C[Native thread claim check]
  C --> D[Global preflight refusal]
  C --> E[Session transaction when idle]
  D --> F[Calling operation receives error]
Loading

Technical review

Best possible solution:

Retain this minimal producer correction and validate the claimed-thread refusal through a supported deletion or history-mutation entry point.

Do we have a high-confidence way to reproduce the issue?

Source establishes the release branch's ordinary-error refusal and the corrected producer contract; a supported retirement-to-fallback reproduction remains unestablished, and no target code was executed during this review.

Is this the best way to solve the issue?

Changing the error at its existing producer is the smallest complete correction for the stated classification contract and matches accepted main behavior without adding fallback policy or another owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fbb9bc44e8c6.

Provenance checked

  • Claimed-thread retirement refusal keeps the original intent (0924fd9: Prevent deletion of live native ownership while reclaiming durable bindings at the session deletion boundary.)
  • History-context retirement keeps the original intent (f0cc42f: Retire native context after successful history cuts while preserving context when mutation is rejected or rolled back.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0924fd9 adds extensions/codex/src/app-server/session-retirement.ts:79 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0924fd9a0c40; files: extensions/codex/src/app-server/session-retirement.ts)
  • Jacqueline Henriksen: Raw commit b4d60fa adds extensions/codex/src/app-server/session-retirement.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b4d60fa5edfc; files: extensions/codex/src/app-server/session-retirement.ts)

PR surface

Source +1, Tests +7. Total +8 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 5 +1
Tests 1 9 2 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 7 +8

Root-cause cluster

Relationship: partial_overlap
Canonical: #181204
Summary: The merged main fix includes this retirement correction; this PR selectively carries it to a release branch that still lacks it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded correction to coordination-error classification, with existing ownership protection preserved.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add shipped-entry-point evidence for the scoped retirement refusal described in the proof assessment.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-30T19:53:07.577Z sha 961110a :: needs real behavior proof before merge. :: none

Reviewed October 31, 2026, 3:37 PM ET / 19:37 UTC (Revision 2).

@dubr1k

dubr1k commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I checked the supported reset, deletion, rewind/branch-switch, and initialization-cleanup callers on 961110a. Normal reset cancels admissions and retires the generation first; rewind/history mutation rejects active work before this retirement participant. These RPC handlers are outside runWithModelFallback. I have not established a supported live entry point that reaches this particular refusal with an active physical-client claim and then enters an eligible fallback chain.

The source-runtime CLI build passes, and the producer and fallback boundary tests remain valid separate evidence. I updated the PR body to keep the shipped-entry-point gap explicit. I have not requested another review, because that proof is still missing. If a maintainer can point to the intended supported calling path for this condition, I can target the live trace there.

@dubr1k dubr1k changed the title fix(codex): stop fallback after active-session reset refusals fix(codex): classify busy session retirement as global preflight Oct 31, 2026
@dubr1k

dubr1k commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

I audited the requested shipped-entry-point trace on the exact reviewed head 961110a9a073e9c133fb624f17f3e758bf96151a in a fresh, secretless Linux checkout. I found an important distinction between ordinary persistent-session reset and history context reset:

  • Ordinary persistent-session Gateway reset interrupts/drains work admissions first (src/gateway/session-reset-service.ts:452), returns unavailable if draining fails (:478), runs runtime cleanup (:565), and dispatches AgentHarness.reset (:604, src/agents/harness/registry.ts:154). The Codex reset method invokes retireCodexAppServerSessionGeneration (extensions/codex/harness.ts:496), not the changed withCodexAppServerSessionDeletion refusal.
  • The changed producer is registered separately as withSessionDeletion and withSessionContextReset (extensions/codex/harness.ts:484–494). The latter participates in history rewind/branch mutation, not the ordinary persistent-session /reset path. The Gateway rejects a live source run before that mutation (src/gateway/server-methods/sessions-rewind.ts:251–284); the generic native mutation owner also checks competing admissions before plugin hooks (src/config/sessions/session-accessor.sqlite-deletion.ts:226–238).
  • These mutation RPCs do not run inside runWithModelFallback. Atomic Gateway initialization cleanup converts rollback failure into an unavailable response (src/gateway/session-create-completion.ts:78–89), rather than starting another model.
  • If an unscoped AgentHarnessPreflightError does reach the fallback owner, it is rethrown before the next eligible candidate (src/agents/model-fallback-runner.ts:540–546). This is a separate public contract, not evidence that a particular reset reaches this producer through fallback.

Incognito exception: this distinction does not cover every reset. session-reset-service.ts:656–667 routes incognito reset through deleteIncognitoSessionForReset; session-reset-incognito.ts:61 invokes deleteSessionEntryLifecycle, and the memory lifecycle owner (session-accessor.memory-lifecycle.ts:121) enters withSqliteSessionDeletions. Thus an incognito reset can reach the changed deletion hook, after admission drain and harness cleanup. This path still does not establish propagation into an eligible model-fallback chain. Generic maintenance/prepared-write/cleanup callers also exist and are not ruled out by this scoped audit.

The focused backport remains appropriate as error-contract consistency with the merged main correction. However, I cannot honestly supply the requested combined Gateway trace without identifying a supported caller/sequence carrying the refusal into fallback or artificially joining independent boundaries. I have not altered the public reset flow or bypassed its admission checks to create such a trace.

Could the proof requirement be scoped to the actual deletion/history-mutation boundary, or can a maintainer identify the supported caller that carries this specific claimed-thread retirement refusal into an eligible fallback chain? The existing contract tests are not claimed as that missing shipped-entry-point proof.

Fresh exact-head Linux checks: session-retirement 9/9 and fallback terminal-boundary 16/16 passed; both repository wrappers exited 0. An independent source review confirmed the distinctions above, without claiming an exhaustive impossibility proof. The title and impact description now state the actual error-classification contract rather than an unproven end-to-end reset claim.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@dubr1k

dubr1k commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Published 10.10 follow-up: the release notes credit #181204, and the published warm-thread refusal is already typed. The retirement sibling still throws an ordinary Error; the updated body links both exact-tag locations.

This PR is the remaining narrow release backport, preserving the busy-thread guards and using global preflight classification. The successful installed-port checks do not prove the previously requested retirement-to-fallback trace. Could a maintainer assess this as error-contract consistency with the merged main fix, or identify the supported caller needed for that combined trace? No ordinary-reset fallback claim is made.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant