Skip to content

refactor: consolidate core settlement and cleanup errors - #180148

Closed
steipete wants to merge 2 commits into
mainfrom
deslop/z33-71-settlement-errors-20261015
Closed

steipete wants to merge 2 commits into
mainfrom
deslop/z33-71-settlement-errors-20261015

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Withdrawn, not merged: the final exact-head node failure remains unattributed after head/main setup failures. All 33 production paths are runtime-reachable from that test, leaving no graph-disjoint production remainder. The complete cut is preserved without a replacement PR on deslop/z33-parked-settlement-ci-20261015; see the closing evidence comment. No merged LOC is credited.

Measured clone groups repeat session-identity publication and cleanup-error handling across core lifecycle owners.

User Impact

No user-visible change is intended. Session publication, cancellation, resource cleanup, error messages, and failure identity retain their existing contracts. No migration or operator action is required.

Why This Change Was Made

Keep settled identity publication in the existing session-identity owner, settled SQLite rejection handling in the existing lifecycle-error owner, and rejected-operation cleanup in the existing error-graph owner. Migrate the matching callers without moving their admission, settlement, or cleanup boundaries.

This is the settlement area of a 505-net-production-line clone cleanup split by ownership area to keep CI attribution bounded. This slice removes 159 net production lines across 33 production files, with four focused test files changed. The remaining areas use disjoint files.

Best-effort tradeoffs accepted

None newly introduced: no guard, authority check, durability mechanism, or supported edge case is removed. Cleanup starts immediately and is awaited; single failures keep their identity, and combined failures retain their original order and cause. In particular, workspace checkpoint discard must settle before transfer authority is revoked, so the caller deliberately keeps return await inside its try/finally.

No SQL, schema, transaction, retention, permissions, config shape, protocol, dependency, or public SDK contract changes. The standalone session-memory backend is untouched.

Evidence

Targeted native types, typed lint, formatting, wrapper closure, and changed-file planner dry run passed. Runtime and static import-cycle checks each report zero cycles; all 14 suppression-ratchet cases passed with no baseline changes. Focused proof passed 373 distinct cases across 46 files. Identity-publication coverage adds 26 primary cases and 21 selected cases across all ten requested consumer files; repeated helper-suite invocations and duplicated runner summaries are not counted twice.

Fresh isolated review of the composed slice found no actionable P0–P2 findings. All 2,041 captured source identities across 97 unique inputs were verified before and after the original signed commit. The subsequent one-file test repair has its own fresh captured inputs and independent clean review; production source is unchanged. Local proof is isolated from operator state, low priority, and serial with one Vitest worker; hosted PR CI is the broad gate and is not yet claimed passing. No broad local suite, build, live Gateway, provider, or device proof is claimed.

The changed cleanup-error owner suite took 2.84 seconds in its focused wrapper; the SQLite-error suite took 7.07 seconds. The workspace-publication suite passed all five existing scenarios in 228.49 seconds overall, including worker preparation and imports. It uses real transfers, repository checkpoints, and the publication owner because a helper-only test cannot prove that transfer authority outlives the caller's awaited discard. The lifecycle-publication suite passed in the seven-file primary batch, which took 258.20 seconds; that is batch wall time, not a standalone file timing. Selected consumer coverage took 476.47 seconds. CI timing is pending. No test timeout, retry, skip, or retained assertion was weakened.

Initial exact-head CI found one PR-caused ratchet failure: the new checkpoint-discard wait introduced a wall-clock deadline. The test now uses the existing completion gate plus Vitest cancellation signal, with all five scenarios and the authority-ordering assertion retained. The repaired five-case suite passed in 145.46 seconds overall, including worker preparation/imports, and the timeout ratchet passes without baseline changes. The initial UI shard also timed out focusing “Reorder Beta”; the latest completed scheduled main run 39707038848 independently has that same case, locator, and failure signature. The current-head hosted gate remains authoritative; this is not a claim that failed CI passed.

@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@steipete
steipete marked this pull request as ready for review October 22, 2026 01:51
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: L labels Oct 22, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T02:25:05.902414Z 0334aec New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 0334aec23775f4856123233a4383c254431eaa29
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/docker-persistent-exec.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR consolidates repeated session-identity publication and cleanup-error handling in existing internal owners.

Example: Repository checkpoint preparation fails and checkpoint discard also rejects.

  • Before: The caller preserves both failures and awaits discard before revoking transfer custody.
  • After: The shared cleanup owner preserves the same failures and ordering.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful consolidation with production-owner test coverage, but a definite introduced ratchet violation blocks readiness and remaining failed checks are not fully attributed.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored, behavior-preserving refactor is outside the ordinary contributor proof gate; supplied evidence reports focused owner and consumer tests, including real workspace transfers and checkpoints, without claiming shipped-entry-point execution.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated lifecycle implementations make it easier for publication and cleanup behavior to drift during maintenance.
Reason: The maintainer-authored direction reduces duplicated production logic in existing owners without introducing configuration, public APIs, or state.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored consolidation preserves the inspected runtime contracts, but its new test deadline exceeds an enforced baseline and blocks CI.

Priority: P3
Reviewed head: 12b023c9a4750acef5d5424cf4426f0ff255ead3

Before merge

  • Replace the new timeout race with an owned completion wait (P2) - This new withTestTimeout call raises the file's governed reference count from two to three, exceeding its allowance of two in config/test-timeout-race-baseline.txt. The exact-head baseline job reports timeout-race failure, and scripts/check-test-timeout-race-ratchet.mts explicitly rejects increases. Replace this added deadline with awaitGateBeforeSettlement(checkpointDiscardStarted.promise, first, ...) and the existing withinTest cancellation pattern, retaining the assertion that revocation waits for discard; do not expand the baseline.

Findings

  • [P2] Replace the new timeout race with an owned completion wait — src/gateway/worker-environments/node-worker-workspace-publication.test.ts:269-273

Tests

  • Missing end-to-end proof: No shipped CLI or Gateway execution is supplied; the reported proof exercises production owners through focused in-process tests.
Agent review details

How this fits together

Session writers, cancellation controllers, plugin inspections, and state readers pass committed publications or operation failures into shared internal owners, which publish identity changes or propagate settled errors.

flowchart TD
  A[Session writers] --> B[Identity publication owner]
  B --> C[Session observers]
  D[Plugin and workspace operations] --> E[Cleanup error owner]
  F[State reader settlement] --> G[SQLite lifecycle error owner]
  E --> H[Caller failure]
  G --> H
Loading

Technical review

Best possible solution:

Keep the consolidation and replace the new checkpoint-discard deadline with the existing owned-completion helpers.

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

The introduced timeout-helper reference raises the file's count from two to three against a baseline of two, matching the reported timeout-race check failure; no target code was executed.

Is this the best way to solve the issue?

The existing owners provide a small, coherent consolidation while preserving domain-specific error policies; the added test should use the supported gate-waiting pattern.

Full review comments:

  • [P2] Replace the new timeout race with an owned completion wait — src/gateway/worker-environments/node-worker-workspace-publication.test.ts:269-273
    This new withTestTimeout call raises the file's governed reference count from two to three, exceeding its allowance of two in config/test-timeout-race-baseline.txt. The exact-head baseline job reports timeout-race failure, and scripts/check-test-timeout-race-ratchet.mts explicitly rejects increases. Replace this added deadline with awaitGateBeforeSettlement(checkpointDiscardStarted.promise, first, ...) and the existing withinTest cancellation pattern, retaining the assertion that revocation waits for discard; do not expand the baseline.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-timeout-race-ratchet --base 469da15
  • pnpm test src/gateway/worker-environments/node-worker-workspace-publication.test.ts --maxWorkers=1
  • git diff --check

What I checked:

PR surface

Source -159, Tests +131. Total -28 across 37 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 33 143 302 -159
Tests 4 137 6 +131
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 280 308 -28

Review metrics

Metric Value Why it matters
Production versus test LOC Production +143/-302; tests +137/-6 Production shrinks through shared owners; test growth protects error identity, cause ordering, and cleanup custody.

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with a focused test-gate repair, without an established urgent user-facing failure.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with a focused test-gate repair, without an established urgent user-facing failure.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed October 21, 2026, 10:08 PM ET / October 22, 2026, 02:08 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Withdrawing this settlement slice without merging it. Exact head: 0334aec. The implementation is preserved, without a replacement PR, on deslop/z33-parked-settlement-ci-20261015 pending attributable broad proof.

Exact-head CI failure Attribution and disposition
CI 39711015878, checks-node-changed-11 / 119602661702: background-process-restart SIGKILL case rejects sessions.patch because a run is still active Unknown. The rejection occurs before any restart, after presentation/history report idle. Source inspection identifies an unfinished controller-operation interval, but no independent matching current-main CI failure was verified.
openclaw/ci-gate / 119608682174 Downstream aggregate of that failed node job; not a separate product failure.

The failed job tested synthetic merge f3a21ac9d5c8d2abbc682930d2856f2006520684, with main parent e897d98. A source-verified runtime import/dispatch graph from the failing test and its spawned Gateway entry reaches all 33 changed production paths. There is no smaller graph-disjoint production remainder that can be retained under the campaign's selective-drop rule. The four sibling test changes either depend on the withdrawn helpers or specifically protect the withdrawn extraction; they are preserved with that cut rather than published as a separate tiny PR.

One serial head/main proof attempt used focused Blacksmith Testboxes, one active lease at a time. Both selected-source installs failed downloading the pinned pnpm 12.12.1 Linux binary, before the test payload ran. These are setup failures, not passing replays or evidence that CI is inherited. Main-side source was pinned to 787a433. No local E2E, CI rerun, timeout increase, retry/skip, security-check removal or admin exception was used.

Earlier focused proof and independent reviews remain recorded above; they do not settle this hosted failure. No production deletion or merged LOC is credited for this slice. The lane continues on the other disjoint areas. Phase E remains unchanged.

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

Labels

agents Agent runtime and tooling commands Command implementations gateway Gateway runtime security-sensitive-changed size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant