Skip to content

fix: preserve nested write uncertainty across lease failures - #150055

Merged
steipete merged 1 commit into
mainfrom
codex/native-lease-nested-uncertainty-20260916
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/native-lease-nested-uncertainty-20260916

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

An outer state lease could replace a nested unknown write outcome with a lease-loss or cancellation error, allowing caller recovery to treat uncertainty as an ordinary failure.

User Impact

Nested uncertainty now reaches caller recovery with its existing outcome-unknown classification. Direct Error objects retain their identity; structured markers keep their original cause. Combined failures retain the original failure and selected authority cause. Admission, settlement, and release behavior remain unchanged.

Why This Change Was Made

The existing lease-owner classifier recognizes canonical uncertainty in the shared error graph when the outer owner has not recorded its own uncertain write. Locally recorded uncertainty keeps precedence. Non-Error markers use the existing uncertainty wrapper; this does not mark the outer owner's own settlement as unknown.

Evidence

Eight pure controls call the actual lease wrapper with fake storage and timers. The original source fails three uncertainty-precedence cases and the structured-marker normalization control; the fix passes all eight. All five existing owner regressions also pass. These controls cover direct and wrapped errors, loss and cancellation, error identity, and unchanged release behavior. They do not execute SQLite or heartbeat workers or reproduce a native failure.

All 31 selected static, type, lint, export, and guard checks passed. Both cycle checks found zero cycles; fresh independent review found no actionable issues.

@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 12:44
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 8:51 AM ET / 12:51 UTC.

ClawSweeper review

What this changes

Preserves unknown write outcomes found inside nested errors when a state lease fails, with regression coverage for error identity, cancellation, lease loss, and release behavior.

Merge readiness

✅ Ready for maintainer review

The fix remains useful: current main preserves locally recorded uncertainty but can still replace nested uncertainty with cancellation or lease loss. No actionable patch defect was found.

Priority: P2
Reviewed head: 969668b8d3e74bb4ec1d79e446acb5dff266ed60

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level fix with meaningful regression controls and clearly disclosed native-proof limits.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer classification exempts this PR from the external-contributor proof gate. Its evidence exercises the lease wrapper with synthetic failures and fake storage, not native runtime recovery; the diff does not materially change authority.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer classification exempts this PR from the external-contributor proof gate. Its evidence exercises the lease wrapper with synthetic failures and fake storage, not native runtime recovery; the diff does not materially change authority.
Evidence reviewed 6 items Current main still lacks nested classification: At the fetched main revision, rethrowIfUncertain returns immediately unless the local owner recorded uncertainty. The surrounding lease wrapper can then select cancellation or lease loss instead. The wrapper is identical between fetched main and this head.
Focused repair at the existing owner: The classifier prefers local uncertainty, otherwise searches the shared error graph for outcome-unknown, and retains the original failure and selected authority error. Admission, settlement tracking, canRelease, and drain are unchanged.
Shared error graph contract: The imported workspace implementation traverses cause, reason, original, error, data, and aggregate errors with identity-based cycle detection; error-code extraction tolerates throwing property access. This is an OpenClaw workspace dependency, with no Codex runtime dependency signal.
Findings None None.
Security None None.

How this fits together

State leases coordinate trusted operations against OpenClaw’s shared SQLite state. Their error boundary reports operation failures to caller recovery while the lease owner separately controls admission, settlement, and release.

flowchart TD
  A[Lease-scoped operation] --> B[Operation result or failure]
  B --> C[Lease error boundary]
  D[Locally recorded uncertainty] --> C
  E[Nested errors and authority failure] --> C
  C --> F[Classified failure for caller recovery]
  B --> G[Owner-controlled drainage and release]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +192. Total +197 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 8 +5
Tests 1 192 0 +192
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 205 8 +197

Review metrics

None.

Technical review

Best possible solution:

Keep uncertainty classification in the existing lease owner while preserving original causes and the separate settlement-based release decision.

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

Yes, from source: a lease callback rejecting with nested outcome-unknown after cancellation or lease loss reaches the current-main authority-error override. The added controls target that path; no native failure was reproduced in this review.

Is this the best way to solve the issue?

Yes. Extending the existing classifier with the shared error traversal addresses the missing case without introducing another owner or changing release authority.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded recovery-classification defect under nested write uncertainty and concurrent lease failure.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer classification exempts this PR from the external-contributor proof gate. Its evidence exercises the lease wrapper with synthetic failures and fake storage, not native runtime recovery; the diff does not materially change authority.

Label justifications:

  • P2: This is a bounded recovery-classification defect under nested write uncertainty and concurrent lease failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer classification exempts this PR from the external-contributor proof gate. Its evidence exercises the lease wrapper with synthetic failures and fake storage, not native runtime recovery; the diff does not materially change authority.

Evidence

What I checked:

  • Current main still lacks nested classification: At the fetched main revision, rethrowIfUncertain returns immediately unless the local owner recorded uncertainty. The surrounding lease wrapper can then select cancellation or lease loss instead. The wrapper is identical between fetched main and this head. (src/state/openclaw-state-lease-worker-owner.ts:55, 0aba68fd734d)
  • Focused repair at the existing owner: The classifier prefers local uncertainty, otherwise searches the shared error graph for outcome-unknown, and retains the original failure and selected authority error. Admission, settlement tracking, canRelease, and drain are unchanged. (src/state/openclaw-state-lease-worker-owner.ts:59, 969668b8d3e7)
  • Shared error graph contract: The imported workspace implementation traverses cause, reason, original, error, data, and aggregate errors with identity-based cycle detection; error-code extraction tolerates throwing property access. This is an OpenClaw workspace dependency, with no Codex runtime dependency signal. (packages/normalization-core/src/error-coercion.ts:342, 969668b8d3e7)
  • Regression coverage and proof limits: Eight controls exercise the actual lease wrapper with fake storage and timers; existing owner tests separately cover locally unknown settlement and pending custody. The captured PR body reports four pre-fix failures and passing after-fix controls, explicitly excluding native SQLite and heartbeat-worker reproduction. Tests were inspected, not executed during this read-only review. (src/state/openclaw-state-lease.nested-uncertainty.test.ts:94, 969668b8d3e7)
  • Related merged work does not supersede this repair: GitHub verifies fix: preserve uncertain lease outcomes before caller recovery #149881 as merged at 3bfe6c6. Its scope is publishing locally recorded uncertainty before caller recovery, rather than discovering uncertainty from nested failures. (src/state/openclaw-state-lease-worker-owner.ts:146, 3bfe6c63c19b)
  • History and release inspection: Current-main history identifies prior lease-owner work by Peter Steinberger and recent lease-timer work by Patrick Erichsen. Local detailed blame encountered an unavailable historical blob; GitHub’s commit API supplied the relevant prior patch and author mapping. The lease-worker-owner path is absent from v2026.9.4; no shipped implementation of this repair was established. (src/state/openclaw-state-lease-worker-owner.ts, 3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 226307e into main Sep 16, 2026
258 checks passed
@steipete
steipete deleted the codex/native-lease-nested-uncertainty-20260916 branch September 16, 2026 13:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant