Skip to content

fix(state): settle restart reads after caller retirement - #175461

Merged
steipete merged 1 commit into
mainfrom
fix/restart-cold-open-regressions
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/restart-cold-open-regressions

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the restart-readiness regression introduced by #175307 without removing its revoked-caller and cancellation guarantees. When an old reply's lifecycle retires while a cold agent registration reports its already-completed COMMIT, the inner admission helper returned but the outer callback still checked caller authority. That refused a bookkeeping acknowledgement while the worker had an open connection but had not installed its identity. Settlement then replaced the expected stale-lifecycle refusal with an unknown-outcome error.

The committed-registration exception now ends the outer authorization callback. The admission observer still validates and records the exact registration receipt. The next validation and every actual operation still require live authority. First-use creation wrappers keep their independent checks, and genuine reporting failures still require retirement.

The queued-collector failure is a separate fixture assumption. Since #174111, “uncaptured lifecycle events publish current updated facts without predecessor label/swarm/capacity overrides.” The fixture selected only reason: create. It now selects the sessions.changed publication for either documented create or updated form, retaining all label, status, runtime, Stop and authorization assertions.

Evidence

Main hourly 39025102777 reported both failures. The correct restart job is 117374543019 (compact-small-10); the supplied 117374542980 is compact-small-7 and does not contain that test. The collector job is 117374542999. Each log was fetched once.

  • On current-main base 8839e329ea70, a local diagnostic revert of fix: keep revoked and cancelled callers from affecting shared database preparation #175307 passed both complete reported files: 48 tests. Restoring fix: keep revoked and cancelled callers from affecting shared database preparation #175307 reproduced both cold-registration cases with the exact unsettled native connection/unknown-outcome signature. The diagnostic revert is not part of this PR.
  • The natural collector run passed. A controlled initial projection-capture miss reproduced both exact CI assertions while the real broadcaster emitted a valid Collector B updated row with queued status and null runtime. The corrected selection passed that same forced condition. All temporary diagnostic hooks were removed.
  • Final local Node proof with --maxWorkers=1: 122 passing cases across all eight execution test files, restart lifecycle, Gateway reclamation and reply admission; then all 26 collector cases passed. One pre-existing Linux-only killed-owner case is skipped on macOS and remains for CI. The native group took 205.30 seconds including preparation; the collector file took 62.71 seconds including preparation.
  • Both targeted state-logging and Gateway-root test type graphs passed, as did type-aware core lint, formatting and git diff --check.
  • Independent P0–P2 autoreview is scoped-clean. It confirmed that generic failed-report retirement remains intact and that the collector's substantive assertions are preserved.

The collector's publication contract predates the hourly window; no single new scheduling commit is claimed as its trigger. No retries, longer timeouts, schema changes or permission expansion. No workflow was dispatched or rerun. Ready for the lead to land after CI.

Fix forward from #175307. The native admission helper recognized a committed
registration notice, but its outer callback still checked the retired caller.
Refusing that bookkeeping notice left an opened worker without its installed
identity and replaced the expected lifecycle refusal with unknown settlement.

End authorization for this already-observed COMMIT at the outer callback.
Receipt observation still validates and records the exact registration owner;
subsequent validation, preparation and command admission keep live authority.
Generic failed-report retirement and first-use creation checks are unchanged.

Also align the queued-collector fixture with #174111's documented contract:
uncaptured lifecycle events publish current updated facts. Select create or
updated session publications while retaining every payload, runtime, Stop and
authority assertion. A forced initial capture miss reproduced the exact hourly
failure with a correctly published Collector B row, and passes after this fix.

Current main with #175307 reverted passed both full files (48 tests). Restoring
it reproduced both cold-registration failures. The repair passes 148 tests
across the execution, restart, reclamation, reply and collector files; one
existing Linux-only killed-owner test remains skipped on macOS. Targeted state
and Gateway test type graphs, type-aware lint, formatting and P0-P2 review pass.
No timeouts, retries, schemas or permission contracts changed.
@clawsweeper

clawsweeper Bot commented Oct 17, 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 17, 2026 11:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-17T11:20:12.209991Z a590d69 Draft marked ready
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR acknowledges completed database registration after caller retirement and aligns the queued-collector test with current event publication behavior.

Example: A reply lifecycle retires while cold database registration reports its completed COMMIT.

  • Before: The acknowledgment is refused, producing an unsettled-native-connection error with an unknown outcome.
  • After: The completed registration is acknowledged, while subsequent preparation and commands still require current authority.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-consistent repair with existing integration coverage and no introduced findings; proof remains at the integration-test boundary.
Proof confidence 🦐 gold shrimp (3/6) The ordinary proof gate is exempt for this maintainer-authored PR; supplied evidence reports cold-registration before/after integration results and preserved revoked-caller controls, with no new authority-bearing grant introduced.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A reply interrupted by restart can receive an unknown database outcome instead of the expected restart handling.
Reason: The narrow repair restores intended settlement behavior, and the maintainer-authored direction preserves the existing authority boundary.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a source-confirmed restart-readiness failure, with no actionable introduced defects found.

Priority: P2
Reviewed head: a590d6910fe9f5f82b1183718f0da7a5e8789379

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence covers existing integration cases rather than a shipped Gateway restart scenario.
Agent review details

How this fits together

The native agent database executor connects Gateway callers to SQLite workers, admitting operations and reconciling registration receipts, identity, and settlement.

flowchart LR
Caller[Gateway caller] --> Executor[Agent database executor]
Executor --> Admission[Worker admission]
Admission --> Worker[SQLite worker]
Worker --> Receipt[Registration receipt]
Receipt --> Registry[Registration settlement]
Registry --> Executor
Loading

Technical review

Best possible solution:

Acknowledge completed registration once, then enforce current caller authority before subsequent preparation and commands.

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

The existing cold-registration lifecycle test supplies a concrete trigger, and independently inspected main-hourly annotations match the source-visible unknown-settlement path; no target code was executed during this review.

Is this the best way to solve the issue?

The repair restores the existing distinction between recording completed work and authorizing future effects, while the fixture change follows the broadcaster's established contract.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Completed-registration observation and acknowledgment keeps the original intent (8fc9129: Separate observation of witnessed COMMIT facts from caller admission and join native settlement before registration publication.)
  • Shared preparation caller authority keeps the original intent (03e18cf: Require a current follower for preparation effects without allowing cancelled callers to poison healthy borrowers.)
  • Collector lifecycle event selection keeps the original intent (14c1305: Uncaptured lifecycle events publish current updated facts rather than replaying predecessor fields; captured identities and recipient authorization remain enforced.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8fc9129 adds src/state/openclaw-agent-execution-native.ts:236 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8fc9129184fd; files: src/state/openclaw-agent-execution-native.ts)

PR surface

Source +1, Tests +4. Total +5 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 7 +1
Tests 1 8 4 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 16 11 +5

Labels

Label changes:

  • add P2: The demonstrated failure affects cold-registration restart handling; the evidence does not establish a broader outage or currently affected user population.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The demonstrated failure affects cold-registration restart handling; the evidence does not establish a broader outage or currently affected user population.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 17, 2026, 7:33 AM ET / 11:33 UTC.

@steipete
steipete merged commit 353c2ec into main Oct 17, 2026
203 of 206 checks passed
@steipete
steipete deleted the fix/restart-cold-open-regressions branch October 17, 2026 11:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
openclaw#175461)

Fix forward from openclaw#175307. The native admission helper recognized a committed
registration notice, but its outer callback still checked the retired caller.
Refusing that bookkeeping notice left an opened worker without its installed
identity and replaced the expected lifecycle refusal with unknown settlement.

End authorization for this already-observed COMMIT at the outer callback.
Receipt observation still validates and records the exact registration owner;
subsequent validation, preparation and command admission keep live authority.
Generic failed-report retirement and first-use creation checks are unchanged.

Also align the queued-collector fixture with openclaw#174111's documented contract:
uncaptured lifecycle events publish current updated facts. Select create or
updated session publications while retaining every payload, runtime, Stop and
authority assertion. A forced initial capture miss reproduced the exact hourly
failure with a correctly published Collector B row, and passes after this fix.

Current main with openclaw#175307 reverted passed both full files (48 tests). Restoring
it reproduced both cold-registration failures. The repair passes 148 tests
across the execution, restart, reclamation, reply and collector files; one
existing Linux-only killed-owner test remains skipped on macOS. Targeted state
and Gateway test type graphs, type-aware lint, formatting and P0-P2 review pass.
No timeouts, retries, schemas or permission contracts changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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