Skip to content

[Bug]: #18049 introduces session bloat #45488

Description

@HenryLoenwind

Bug type

Behavior bug (incorrect output/state without crash)

Summary

#18049 introduced a functionality that copies parts of the system prompt into the context after compaction. This, however, is completely useless as the system prompt is not compacted away.

This leads to (a) session bloat, and (b) "magic" behaviour that treats "magic" strings inside the user- and agent-editable AGENT.md in a special way.

Especially the latter can lead to unexpected behaviour as the file is changed over time and doesn't conform to the code's expectations anymore.

This already has happened, as the code's expectations don't match any AGENT.md that was created before March 4th, so "old" workspaces behave differently from "new" workspaces.

Steps to reproduce

visible from code

Expected behavior

no magic string parsing happening

Actual behavior

see above

OpenClaw version

anything after #18049 was merged

Operating system

n/a

Install method

n/a

Model

n/a

Provider / routing chain

n/a

Config file / key location

n/a

Additional provider/model setup details

n/a

Logs, screenshots, and evidence

Impact and severity

Affected users
Severity data risk
Frequency always
Consequence unexpected agent behaviour

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions