openclaw - ✅(Solved) Fix [Bug]: [2026.4.1] boot-md injects DAILY.md multiple times per message [1 pull requests, 1 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#59319Fetched 2026-04-08 02:26:04
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1

After upgrading to OpenClaw 2026.4.1 (da64a97), the boot-md plugin injects the same workspace file (e.g. memory/YYYY-MM-DD.md mapped as DAILY.md) 3–5× per message instead of once. Each injection appears as a separate truncation warning in the session bootstrap output. Consuming ~2% extra context budget per occurrence

Root Cause

After upgrading to OpenClaw 2026.4.1 (da64a97), the boot-md plugin injects the same workspace file (e.g. memory/YYYY-MM-DD.md mapped as DAILY.md) 3–5× per message instead of once. Each injection appears as a separate truncation warning in the session bootstrap output. Consuming ~2% extra context budget per occurrence

Fix Action

Fixed

PR fix notes

PR #59344: fix(agents): dedupe bootstrap context files by path

Description (problem / solution / changelog)

PR Draft: Fix #59319

Summary

Describe the problem and fix in 2–5 bullets:

If this PR fixes a plugin beta-release blocker, title it fix(<plugin-id>): beta blocker - <summary> and link the matching Beta blocker: <plugin-name> - <summary> issue labeled beta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.

  • Problem: bootstrap context assembly could inject the same file multiple times when hook-adjusted entries repeated an existing file path.
  • Why it matters: duplicate bootstrap content wastes prompt budget/tokens and can dilute important context.
  • What changed: added path-based deduplication in bootstrap-file sanitization and added a targeted unit test for duplicate-path behavior.
  • What did NOT change (scope boundary): no change to bootstrap file discovery order, session filtering policy, or hook execution semantics.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

  • Closes #59319
  • Related #N/A
  • This PR fixes a bug or regression

Root Cause / Regression History (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: resolveBootstrapFilesForRun sanitized invalid paths but did not deduplicate normalized file paths after hook overrides, so duplicates could survive into context injection.
  • Missing detection / guardrail: no unit assertion guaranteed uniqueness of bootstrap entries by resolved path.
  • Prior context (git blame, prior PR, issue, or refactor if known): Unknown from this change set; behavior existed before this fix and was reported in #59319.
  • Why this regressed now: not necessarily a new regression; likely surfaced by real-world hook/config combinations that add overlapping bootstrap entries.
  • If unknown, what was ruled out: ruled out malformed-path-only failure mode (that path already had tests and filtering).

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should have caught this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/agents/bootstrap-files.test.ts
  • Scenario the test should lock in: when a hook appends a bootstrap file with a path that already exists in base bootstrap files, the final list contains exactly one entry for that resolved path.
  • Why this is the smallest reliable guardrail: deduplication happens inside bootstrap-file sanitization, so unit-level coverage at that seam is direct and stable.
  • Existing test that already covers this (if any): none before this PR.
  • If no new test is added, why not: N/A (new test added).

User-visible / Behavior Changes

  • Bootstrap context no longer includes duplicate copies of the same file path when duplicates are introduced by hook-adjusted bootstrap entries.

Diagram (if applicable)

Before:
[base bootstrap files + hook extras] -> [sanitize only invalid paths] -> [duplicate file paths remain] -> [context includes repeated file]

After:
[base bootstrap files + hook extras] -> [sanitize invalid paths + dedupe by resolved path] -> [unique file paths] -> [context includes file once]

Security Impact (required)

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

Repro + Verification

Environment

  • OS: macOS (darwin)
  • Runtime/container: Node 22 + pnpm workspace (local dev environment)
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): default test config (no special secrets)

Steps

  1. Add or simulate a bootstrap hook that appends MEMORY.md with a path already present in bootstrap files.
  2. Run resolveBootstrapFilesForRun with a warning collector.
  3. Inspect returned files and warnings.

Expected

  • Only one entry remains for the duplicated resolved path.
  • A duplicate-skip warning is emitted.

Actual

  • Matches expected after the fix.

Evidence

Attach at least one:

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

Notes:

  • Added/ran src/agents/bootstrap-files.test.ts case: deduplicates bootstrap files by resolved path.
  • Verification commands:
    • pnpm test -- src/agents/bootstrap-files.test.ts
    • pnpm check

Human Verification (required)

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

  • Verified scenarios: duplicate path from hook override is dropped; warning message emitted; malformed path filtering still works.
  • Edge cases checked: duplicate exact absolute path; preserved behavior for valid non-duplicate files.
  • What you did not verify: full end-to-end prompt token accounting in a live gateway run.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

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

Risks and Mitigations

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

  • Risk: path normalization (path.resolve) might collapse distinct textual paths that intentionally referred to the same file via different relative forms.
    • Mitigation: this is intended; dedupe key is file path identity at injection boundary, and behavior is covered by unit test.

Changed files

  • src/agents/bootstrap-files.test.ts (modified, +31/-0)
  • src/agents/bootstrap-files.ts (modified, +8/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

After upgrading to OpenClaw 2026.4.1 (da64a97), the boot-md plugin injects the same workspace file (e.g. memory/YYYY-MM-DD.md mapped as DAILY.md) 3–5× per message instead of once. Each injection appears as a separate truncation warning in the session bootstrap output. Consuming ~2% extra context budget per occurrence

Steps to reproduce

To reproduce:

Run any session with a memory/YYYY-MM-DD.md daily notes file in workspace Observe the bootstrap truncation warnings — same file appears multiple times: Copy

  • DAILY.md: 5102 raw -> 5016 injected (~2% removed)
  • DAILY.md: 5102 raw -> 5016 injected (~2% removed)
  • DAILY.md: 5102 raw -> 5016 injected (~2% removed)

Expected behavior

File injected once per message

Actual behavior

Same file injected 3–5× per message, consuming ~2% extra context budget per occurrence

OpenClaw version

2026.4.1

Operating system

Linux 6.8.0-85-generic (x64), Node v22.22.2

Install method

No response

Model

anthropic/sonnet 4.6

Provider / routing chain

Oauth

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Low (no functional breakage) but wastes context budget in long sessions.

Additional information

I suspect it is boot-md registers its injection and check if it's being called from both the bootstrap pass and the inject-context hook on every message. The fix is likely a deduplication guard.

extent analysis

TL;DR

Implement a deduplication guard to prevent the boot-md plugin from injecting the same workspace file multiple times per message.

Guidance

  • Review the boot-md plugin's registration and injection logic to identify where the duplication is occurring.
  • Check if the plugin is being called from both the bootstrap pass and the inject-context hook on every message, as suspected.
  • Consider adding a unique identifier or flag to track injected files and skip duplicates.
  • Verify the fix by running a session with a memory/YYYY-MM-DD.md daily notes file in the workspace and checking for truncation warnings.

Example

// Pseudo-code example of a deduplication guard
const injectedFiles = new Set();

// ...

if (injectedFiles.has(fileName)) {
  // Skip injection if file is already injected
  return;
}

injectedFiles.add(fileName);
// Proceed with injection

Notes

The exact implementation of the deduplication guard will depend on the specific code and requirements of the boot-md plugin.

Recommendation

Apply a workaround by implementing a deduplication guard, as the root cause is likely related to the plugin's registration and injection logic.

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…

FAQ

Expected behavior

File injected once per message

Still need to ship something?

×6

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

Back to top recommendations

TRENDING