Skip to content

fix(storage): allow first session after missing-store reads - #200306

Merged
vincentkoc merged 1 commit into
mainfrom
fix/first-session-after-missing-store-20261117
Nov 17, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/first-session-after-missing-store-20261117

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes first-session creation failing after an earlier read found no agent database.

User Impact

A fresh agent can create its first session after an empty state read. Existing admitted databases keep their normal warm-worker behavior; no configuration or migration is required.

Why This Change Was Made

Releasing the last reader could retain a generation that had never admitted a database file. That left a pending opener which later blocked creation. Only generations with an admitted file are now eligible for idle retention; the existing close path releases empty readers.

Evidence

  • The real storage-worker regression fails before the fix with Agent creation cannot capture another pending native opener, then passes after the fix: read an absent store, release the reader, create the first session, and read it back.
  • Exact PR head 15bb782f6ce61969f9804c7764a6c0cde4e341b3: all 36 creation-witness and idle tests pass with Node 24.22.1 and the pinned fs-safe 0.27.1 dependency. Targeted format and type-aware lint pass for all three changed files.
  • The same patch passed 134 owner/lifecycle tests on the integrated RSS candidate. That candidate completed a real model request under a 1 GiB service limit; its separate 768 MiB run still OOMs. These integrated results are not exact-PR-head runtime or RSS qualification.
  • Independent source review found no correctness issues. Local ClawSweeper reviewed the complete committed range 726a8dd4985723c6b1050a65e05502dd010f2ae8..15bb782f6ce61969f9804c7764a6c0cde4e341b3: no findings, security cleared. Broader CI runs on this PR.

@vincentkoc vincentkoc self-assigned this Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 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.

@vincentkoc
vincentkoc marked this pull request as ready for review November 16, 2026 23:41
@vincentkoc
vincentkoc enabled auto-merge (squash) November 16, 2026 23:47
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. labels Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR closes released database generations without an admitted file so later first-session creation can proceed.

Example: Read the absent store for agent main, release the reader, then create agent:main:after-missing-read.

  • Before: Creation rejects with “Agent creation cannot capture another pending native opener”.
  • After: Creation succeeds and the first-session entry can be read back.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) A focused, source-supported repair with useful regression coverage; supplied product-level evidence does not demonstrate the specific changed sequence.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
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 fresh agent can fail to create its first session after an earlier state read found no database.
Reason: The maintainer-authored change restores first-write behavior without adding configuration, storage formats, or a competing owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a concrete first-session failure still present on current main, and its maintainer authorship also prevents automatic closure. No introduced correctness defect was found.

Priority: P2
Reviewed head: 15bb782f6ce61969f9804c7764a6c0cde4e341b3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted Gateway or shipped-CLI output showing an absent-store read completes and releases, then first-session creation and readback succeed on the fix; the reported storage regression already supplies the base/head comparison.
Agent review details

How this fits together

The agent database execution owner shares native storage generations among session readers and writers, then either retains an admitted generation for reuse or closes it after the last borrower releases.

flowchart TD
  A[Session read or write] --> B[Agent execution owner]
  B --> C[Native storage worker]
  C --> D[Agent SQLite database]
  B --> E[Last borrower releases]
  E --> F[Retain admitted generation]
  E --> G[Close generation without a file]
Loading

Technical review

Best possible solution:

Retain only generations with an admitted file and let the existing retirement owner release empty generations.

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

The current-main retention predicate and creating-borrower rejection establish the failure sequence, and the supplied regression names the same error; this read-only review did not execute tests.

Is this the best way to solve the issue?

The patch repairs the lifecycle invariant at its existing owner with one predicate change; the idle fixture changes model admitted files so existing retention coverage remains meaningful.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e051130 adds src/state/openclaw-agent-execution-owner.ts:581 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e051130c6ae0; files: src/state/openclaw-agent-execution-owner.ts)
  • Vincent Koc: Raw commit 67ecf6b adds src/state/openclaw-agent-execution.idle.test.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 67ecf6bf352d; files: src/state/openclaw-agent-execution.idle.test.ts)

PR surface

Source +2, Tests +54. Total +56 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 2 71 17 +54
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 74 18 +56

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: A concrete missing-store lifecycle sequence prevents first-session creation, with a focused repair and limited affected scope.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A concrete missing-store lifecycle sequence prevents first-session creation, with a focused repair and limited affected scope.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • 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 November 16, 2026, 6:57 PM ET / 23:57 UTC.

@vincentkoc
vincentkoc merged commit 827a749 into main Nov 17, 2026
207 checks passed
@vincentkoc
vincentkoc deleted the fix/first-session-after-missing-store-20261117 branch November 17, 2026 00:11
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
RomneyDa added a commit that referenced this pull request Nov 17, 2026
RomneyDa pushed a commit that referenced this pull request Nov 19, 2026
(cherry picked from commit 827a749)

Co-authored-by: RomneyDa <[email protected]>

Release adaptation: none; source change applies to the pinned beta baseline.

Follow-up disposition: bounded pinned-main same-path audit recorded in the lane report; cross-lane changes remain parent-owned.

(cherry picked from commit 732bc9a10bffc39b2414d5270f412789786067bf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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