Repository navigation
refactor(state): move skill upload staging to SQLite - #108346
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d907b86e6b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d907b86 to
e76ff70
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e76ff701b6
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c85dde0cfe
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dec4b23fef
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const heartbeat = setInterval(() => { | ||
| const heartbeatAt = now(); | ||
| try { | ||
| renewSkillUploadInstallLease({ |
There was a problem hiding this comment.
Stop using an upload after its lease is lost
When a host sleep or event-loop stall delays this heartbeat past installLeaseMs, renewSkillUploadInstallLease now returns false for the expired lease, but that result is ignored and the installer keeps using the materialized archive. If the install then succeeds, installUploadedSkillArchive catches the later upload.remove() ownership failure (src/skills/lifecycle/upload-install.ts:125), so the caller can see a successful install while the upload remains retryable, and another gateway may install the same archive after claiming the expired lease. Treat a false renewal as lost ownership and fail/abort the callback instead of reporting success.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* refactor(state): move skill upload staging to sqlite * test(skills): make archive mode assertion portable * fix(skills): fence upload finalization by lease owner * fix(skills): handle nullable lease expiry * fix(skills): bound upload install leases
* refactor(state): move skill upload staging to sqlite * test(skills): make archive mode assertion portable * fix(skills): fence upload finalization by lease owner * fix(skills): handle nullable lease expiry * fix(skills): bound upload install leases
Closes #108318
What Problem This Solves
Resolves a problem where remote skill uploads stored transient metadata, idempotency pointers, and archive bytes as JSON and ZIP files under the OpenClaw state directory. That split steady-state ownership required directory scans and process-local file coordination instead of the database-first state contract.
Why This Change Was Made
Skill-upload metadata and ordered archive chunks now live in the shared SQLite state database. Begin, chunk, commit, expiry, idempotency, capacity, and removal use short Kysely-backed transactions with authoritative row revalidation; commit assembles and hashes outside the write transaction, then stores one canonical archive BLOB and removes chunk rows atomically.
Installation claims a renewable SQLite lease, materializes a private temporary archive only for the existing installer callback, and removes it afterward. Upload consumption requires the exact live lease owner. Lease expiry advances from each successful claim or heartbeat, expired owners cannot renew or delete state, and begin-time checksum metadata stays immutable for idempotent retries.
openclaw doctor --fixdiscards the legacy transient staging tree. Runtime fallback, dual-write, lazy import, and unscoped removal paths are intentionally absent.User Impact
The Gateway upload protocol and configured limits are unchanged. Remote skill uploads gain cross-process transactional idempotency, capacity, expiry, commit, crash recovery, and install ownership without leaving JSON metadata, idempotency sidecars, or ZIP staging trees in the state directory. Unfinished pre-upgrade transient uploads must be retried.
Evidence
dec4b23fef20a9f0f300d9a07072f93d019c417a.tbx_01kxk23abwb8kzw1x0n5y591qq:pnpm check:changedpassed all selected guards, core/core-test/root-test typechecks, and lint lanes;pnpm buildpassed bundled assets, runtime, SDK declarations, and Control UI production build.git diff --checkpass.