Skip to content

Memory flush write sandbox blocks SESSION_HANDOFF.md despite prompt instruction #66612

Description

@rosesandhello

Bug

The pre-compaction memory flush prompt explicitly instructs the agent to update SESSION_HANDOFF.md:

ALSO: Update SESSION_HANDOFF.md with current session state (what was being worked on, background processes, pending tasks, key decisions, file paths). This is critical for session continuity — the next session reads this first. Overwrite the entire file with fresh content.

However, the runtime tool sandbox during flush turns restricts writes to only memory/YYYY-MM-DD.md, blocking the SESSION_HANDOFF.md write with an error like:

Memory flush writes are restricted to memory/YYYY-MM-DD.md; use that path only.

Expected Behavior

The flush write sandbox should allow writes to both:

  • memory/YYYY-MM-DD.md (daily notes)
  • SESSION_HANDOFF.md (session continuity file)

...or any path explicitly mentioned in the user-configured memoryFlush.prompt.

Reproduction

  1. Configure agents.defaults.compaction.memoryFlush.prompt to include SESSION_HANDOFF.md instruction (this is the default/recommended setup)
  2. Let a session reach the soft compaction threshold
  3. Observe that the flush turn writes to memory/YYYY-MM-DD.md successfully but fails to write SESSION_HANDOFF.md

Workaround

SESSION_HANDOFF.md gets written in the next normal turn after the flush, but this is fragile — if the session resets immediately after flush, the handoff is lost.

Environment

  • OpenClaw: latest (as of 2026-04-14)
  • Config: memoryFlush.enabled: true, softThresholdTokens: 8000

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions