Skip to content

fix(kiloclaw): preserve user-edited IDENTITY.md across redeploys#2389

Open
kvnkho wants to merge 2 commits intoKilo-Org:mainfrom
kvnkho:fix/preserve-identity-md-on-redeploy
Open

fix(kiloclaw): preserve user-edited IDENTITY.md across redeploys#2389
kvnkho wants to merge 2 commits intoKilo-Org:mainfrom
kvnkho:fix/preserve-identity-md-on-redeploy

Conversation

@kvnkho
Copy link
Copy Markdown

@kvnkho kvnkho commented Apr 14, 2026

Summary

Fixes #2387.

writeBotIdentityFile runs on every controller boot (via runOnboardOrDoctor), and previously always overwrote /root/.openclaw/workspace/IDENTITY.md with content regenerated from KILOCLAW_BOT_* env vars. Any edits a user made to IDENTITY.md were lost on the next redeploy.

This PR mirrors the TOOLS.md behavior: seed on first boot, but skip the write when the file already exists. Legacy-identity-file cleanup still runs unconditionally.

Verification

  • pnpm exec vitest run controller/src/bootstrap.test.ts in services/kiloclaw — 63 passed (including a new test asserting IDENTITY.md is not rewritten when it already exists).
  • pnpm run typecheck in services/kiloclaw — clean.
  • scripts/lint-all.sh — clean.
  • pnpm format:check — clean.

Visual Changes

N/A

Reviewer Notes

Considered an alternative (guarding the call site inside runOnboardOrDoctor to only run on fresh installs), but guarding inside writeBotIdentityFile itself keeps the seeding path working even if a config already exists for other reasons, and keeps the rule in one place. Open to flipping if reviewers prefer the other shape.

kvnkho added 2 commits April 13, 2026 16:30
writeBotIdentityFile runs on every controller boot (via
runOnboardOrDoctor), and previously always overwrote
/root/.openclaw/workspace/IDENTITY.md with content regenerated from
KILOCLAW_BOT_* env vars. Any edits a user made to IDENTITY.md were lost
on the next redeploy.

Mirror the TOOLS.md behavior: seed on first boot, but skip the write if
the file already exists. Legacy file cleanup still runs unconditionally.

Fixes Kilo-Org#2387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDENTITY.md is overwritten on every redeploy, clobbering user edits

1 participant