Skip to content

Compaction Runner: wire post-compaction memory sync#25561

Draft
rodrigouroz wants to merge 10 commits intoopenclaw:mainfrom
rodrigouroz:codex/pr20038-09
Draft

Compaction Runner: wire post-compaction memory sync#25561
rodrigouroz wants to merge 10 commits intoopenclaw:mainfrom
rodrigouroz:codex/pr20038-09

Conversation

@rodrigouroz
Copy link
Contributor

@rodrigouroz rodrigouroz commented Feb 24, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: post-compaction session-memory index sync was not executed from the compact runner, leaving session memory potentially stale.
  • Why it matters: memory search freshness after compaction directly affects follow-up retrieval quality.
  • What changed: implemented post-compaction sync with mode handling (off|async|await), session-agent resolution, memory config checks, and warning-only fallbacks.
  • What did NOT change (scope boundary): no broader memory backend redesign.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • After successful compaction, session-memory index sync can run immediately based on agents.defaults.compaction.postIndexSync and agents.defaults.memorySearch.sync.sessions.postCompactionForce.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 + pnpm
  • Model/provider: n/a (unit/integration tests)
  • Integration/channel (if any): n/a
  • Relevant config (redacted): compaction + memorySearch defaults

Steps

  1. pnpm vitest run src/agents/pi-embedded-runner/run.overflow-compaction.test.ts src/auto-reply/reply/post-compaction-context.test.ts src/agents/memory-search.test.ts
  2. pnpm vitest run src/agents/compaction.retry.test.ts src/agents/compaction.identifier-preservation.test.ts src/memory/index.test.ts src/memory/manager.atomic-reindex.test.ts src/memory/manager.async-search.test.ts src/memory/manager.watcher-config.test.ts src/auto-reply/reply/followup-runner.test.ts src/auto-reply/reply/agent-runner.runreplyagent.test.ts src/auto-reply/reply/commands.test.ts src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts
  3. pnpm tsgo

Expected

  • Targeted compaction/memory/reply suites pass and typecheck remains clean.

Actual

  • Local targeted suites passed (13 files / 155 tests) and pnpm tsgo passed.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: transcript updates are emitted post-compaction; memory sync path executes with mode-aware behavior and safe fallbacks.
  • Edge cases checked: off mode bypass, missing manager/sync method, async-mode warning handling.
  • What you did not verify: full pnpm test matrix and long-lived production deployments.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
    • Set agents.defaults.compaction.postIndexSync: "off"
    • Or revert this PR
  • Files/config to restore: src/agents/pi-embedded-runner/compact.ts
  • Known bad symptoms reviewers should watch for: compaction latency increase in await mode.

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: await mode can add latency immediately after compaction.
    • Mitigation: default mode is async; off and async remain available.
  • Risk: sync failures could surface as noisy warnings.
    • Mitigation: failures are warning-only and compaction success path remains intact.

Stack: 9/9, depends on #25560.

@openclaw-barnacle openclaw-barnacle bot removed the app: web-ui App: web-ui label Feb 26, 2026
@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: L stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Compaction summarization does not preserve exact identifiers

2 participants