Skip to content

fix(setup): non-destructive sync + context window reduction#34

Merged
madtank merged 2 commits into
mainfrom
fix/safe-setup-sync
Feb 22, 2026
Merged

fix(setup): non-destructive sync + context window reduction#34
madtank merged 2 commits into
mainfrom
fix/safe-setup-sync

Conversation

@madtank

@madtank madtank commented Feb 22, 2026

Copy link
Copy Markdown
Member

Summary

  • setup.sh rewritten to be non-destructive — sync was overwriting backendUrl, wiping workspace paths, deleting heartbeat/model config, clearing the install manifest, and removing staging agents. This caused a production incident when run on the server.
  • Context injection window reduced (5+15 to 3+7 messages, 2000 to 1500 / 500 to 400 char limits) to prevent context overflow in active group threads.

What changed

setup.sh (major rewrite)

  • sync now only updates plugins.entries.ax-platform.config.agents
  • Agent entries and bindings are merged (adds missing, never overwrites existing)
  • Extension files copied over existing (no delete-first)
  • Config backed up before every sync to ~/.openclaw/backups/
  • Gateway restart uses openclaw gateway CLI with proper Linux process detection

extension/lib/context.ts

  • fullLengthMessages: 5 to 3
  • additionalMessages: 15 to 7
  • fullMaxChars: 2000 to 1500
  • truncatedMaxChars: 500 to 400
  • Total messages injected per dispatch: 20 to 10

CLAUDE.md

  • Updated to document safe deployment flow and sync safety guarantees

Test plan

  • Ran setup.sh sync twice — config preserved correctly both times
  • Verified all critical fields survive sync
  • Gateway restarted and plugin loaded with all 10 agents
  • Config backup created at ~/.openclaw/backups/

🤖 Generated with Claude Code

Cipher and others added 2 commits February 22, 2026 20:38
- fullLengthMessages: 5 → 3
- additionalMessages: 15 → 7
- fullMaxChars: 2000 → 1500
- truncatedMaxChars: 500 → 400

Total messages injected per message: 20 → 10.

Root cause: in active group threads with many long agent responses, the
per-message context injection was pushing even fresh sessions over the
model's context limit. /new and /reset don't help because the history
is re-injected from the platform on every incoming message, not from
session history.

Also applied to installed extension at .openclaw/extensions/ax-platform/
and switched compaction.mode to 'summarize' in openclaw.json.
setup.sh sync was overwriting critical config during agent credential
updates — hardcoding backendUrl, wiping workspace paths, deleting
heartbeat/model config, clearing the plugin install manifest, and
removing staging agents not in ax-agents.env.

Changes:
- sync now only updates plugins.entries.ax-platform.config.agents
- agent entries and bindings are merged (add missing, never overwrite)
- extension files are copied over (no delete-first)
- config is backed up before every sync (~/.openclaw/backups/)
- gateway restart uses openclaw CLI with proper process detection
- CLAUDE.md updated to document the safe deployment flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@madtank madtank merged commit 6c1a330 into main Feb 22, 2026
1 check passed
@madtank madtank deleted the fix/safe-setup-sync branch February 22, 2026 21:07
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.

1 participant