openclaw - ✅(Solved) Fix [Bug] Session flush blocks write tool completely during compaction [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63664Fetched 2026-04-10 03:42:16
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

Error Message

During session compaction (flush), the write tool is completely blocked with error:

Fix Action

Fixed

PR fix notes

PR #63792: fix: allow non-memory writes during memory flush compaction

Description (problem / solution / changelog)

Summary

During a memory flush run, wrapToolMemoryFlushAppendOnlyWrite was blocking ALL writes that weren't to the exact flush target file. This prevented users from editing unrelated workspace files (template.html, scripts, etc.) while compaction was running.

  • Restrict the guard to files within the memory directory only (e.g. other dated memory files)
  • Writes to any file outside that directory are now delegated to the underlying write tool, which already enforces its own workspace / sandbox guards
  • Update the workspace-only-false test to use a same-directory memory file as the "deny" case, and add a pass-through assertion for a non-memory workspace file

Closes #63664


This PR was developed with AI assistance (Claude). All code has been reviewed and tested. Built with islo.dev

Changed files

  • src/agents/pi-tools.read.ts (modified, +19/-4)
  • src/agents/pi-tools.workspace-only-false.test.ts (modified, +10/-1)
RAW_BUFFERClick to expand / collapse

Bug Description

During session compaction (flush), the write tool is completely blocked with error: Memory flush writes are restricted to memory/YYYY-MM-DD.md; use that path only.

This makes it impossible to edit any file (including template.html, scripts, etc.) during flush, even when the file is unrelated to memory management.

Expected Behavior

  • Flush should only restrict writes to memory files as a preference/priority
  • The write tool should still be able to write to non-memory files when needed
  • OR: There should be a way to bypass this restriction when user explicitly allows it (e.g., typing '写' should allow writes to continue)

Actual Behavior

  1. Session context grows large → triggers compaction
  2. Write tool is locked to memory file only
  3. Even when user explicitly types '写' to unlock, the restriction is re-applied after just one or two messages
  4. This makes any file editing during active conversation nearly impossible

Impact

  • Cannot fix bugs or update files during normal conversation
  • Forces waiting for lengthy flush cycles
  • Severely impacts productivity when working on code/files

Suggested Fixes

  1. Option A: Make flush restriction a soft-limit (writes to non-memory files allowed but discouraged during flush)
  2. Option B: Add a config option to disable flush write restriction
  3. Option C: Allow user to send a magic word that grants write permission for N minutes
  4. Option D: When user sends '写', actually unlock writes for the remainder of the session

Version

OpenClaw latest (2026.04)

extent analysis

TL;DR

Implementing a soft-limit for flush restrictions or adding a config option to disable flush write restrictions may resolve the issue.

Guidance

  • Review the suggested fixes (Option A to Option D) and evaluate which approach best aligns with the project's requirements and constraints.
  • Consider the trade-offs between restricting writes to memory files during flush and allowing writes to non-memory files, weighing the impact on productivity and potential data consistency issues.
  • If implementing Option C, determine a suitable duration (N minutes) for the magic word to grant write permission, balancing convenience and potential risks.
  • Assess the feasibility of modifying the write tool to respect the user's explicit unlock command ('写') for the remainder of the session (Option D).

Example

No explicit code example is provided due to the lack of specific implementation details in the issue.

Notes

The chosen solution may depend on the specific use case and priorities of the project. It is essential to consider the potential consequences of each suggested fix on the overall system behavior and performance.

Recommendation

Apply workaround: Implement Option A (soft-limit for flush restrictions) as it seems to balance the need to restrict writes to memory files during flush with the requirement to allow writes to non-memory files when necessary, thus mitigating the productivity impact.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING