fix: preserve user workspace files and prefs across upgrades#11
Closed
helix-nine wants to merge 1 commit into
Closed
fix: preserve user workspace files and prefs across upgrades#11helix-nine wants to merge 1 commit into
helix-nine wants to merge 1 commit into
Conversation
initializeService ran on every install AND upgrade, so it: - overwrote SOUL.md, IDENTITY.md, HEARTBEAT.md from the image on every update (only MEMORY.md was guarded), wiping the user's agent personality - re-forced agents.defaults.heartbeat.every to 24h every update - replaced skills.load.extraDirs wholesale, dropping user-added skill dirs Now all four workspace files are seeded only when missing; the bundled /opt/skills dir is unioned into extraDirs without dropping user entries; heartbeat default is seeded on first install only. Required gateway/proxy settings are still enforced every init (deep-merge keeps the password). Updates README.md and instructions.md to match.
Contributor
Author
|
Closing — the reported bug is the wiped API key, fixed in #12. The workspace-file overwrite this PR changed is intentional (SOUL/IDENTITY/HEARTBEAT are kept in sync with package defaults per instructions.md; only MEMORY is user data), and the heartbeat/skills merge tweak isn't needed. #12 alone is the fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reports of OpenClaw settings being wiped on update. Root cause is in
startos/init/initializeService.ts, whichsetupOnInitruns on every install and upgrade. Three things there clobber user data on each update:cp SOUL.md IDENTITY.md HEARTBEAT.mdcopied the image's defaults over the user's files every update — onlyMEMORY.mdwas guarded with atest -f. These are exactly the files the Instructions tell users to edit to shape their agent's personality/identity.agents.defaults.heartbeat.everywas re-forced to24hon every update, discarding a user's chosen interval.skills.load.extraDirswas replaced with['/opt/skills']every update (arrays aren't deep-merged), so any user-added skill directories were lost.This regressed in the gateway-auth redesign (21310b8), which moved the config seeding out of its original
if (kind === 'install')guard so it now runs on every init.Note: the openclaw.json zod schema itself is not the culprit — start-sdk ≥ this version patches
z.objectto be loose by default, so unknown keys already survive the read→merge→write round-trip (verified empirically).Fix
SOUL,IDENTITY,HEARTBEAT,MEMORY) only when missing, so user edits persist across upgrades.auth.passwordand other keys intact./opt/skillsintoextraDirsinstead of replacing, preserving user-added dirs while keeping bundled skills loadable.heartbeat.everydefault on first install only.README.mdandinstructions.mdto describe the seed-when-missing behavior.Testing
npm run check(tsc) passes.makebuildsopenclaw_x86_64.s9pkcleanly.Already-lost data can't be recovered; this prevents future overwrites.