Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
A parent session parked with sessions_yield was compacted during subagent completion/direct-announce handling despite being around 65k/1.05M context, with the compaction parented to hidden openclaw.sessions_yield entries rather than the visible branch.
This triggers excessive compactions, loss of relevant information on the main session (spawning subagents), and excessive API costs.
Steps to reproduce
Observed reproduction path:
- Run OpenClaw 2026.5.22 with
agents.defaults.compaction.mode: "safeguard".
- Use a parent/main session on
openai-codex/gpt-5.4 with effective context window 1050000.
- In the parent session, spawn subagents with
sessions_spawn.
- Have the parent call
sessions_yield while waiting for subagent completion.
- Let a subagent complete and have OpenClaw attempt completion direct-announce / parent wake-up.
- Observe that the parent transcript receives a compaction entry parented to the hidden
openclaw.sessions_yield custom message even though visible context usage is far below the configured window.
Expected behavior
A subagent completion/direct-announce wake-up should resume, notify, or append to the parent session without compacting the parent branch unless the parent is genuinely near context overflow or the user
explicitly requested compaction.
This regression started happening some time between .5.10 and .5.22
Actual behavior
The parent session compacted while far below the configured context window. The compaction entry 9386dd5e was created at 2026-05-25T02:59:25.241Z, parented to hidden custom_message 2355e2ea of type
openclaw.sessions_yield, with tokensBefore: 65320 and fromHook: true.
A visible /status reply on a sibling branch shortly before this showed Context: 63k/1.1m (6%). The compaction was therefore not caused by visible branch context exhaustion.
OpenClaw version
2026.5.22, gitSha ef17290
Operating system
Linux 6.8.0-107-generic x64 inside Docker; host is Ubuntu 24.04
Install method
Docker / docker compose
Model
openai-codex/gpt-5.4
Provider / routing chain
OpenClaw embedded Pi runtime -> openai-codex provider -> openai-codex-responses API via OAuth profile
Additional provider/model setup details
Relevant live config/effective model details:
agents.defaults.compaction: { "mode": "safeguard" }
- No global
agents.defaults.contextTokens override was set.
openai-codex/gpt-5.4 resolves to:
contextWindow: 1050000
contextTokens: 1050000
maxTokens: 128000
- The selected session model at the time was
openai-codex/gpt-5.4.
Logs, screenshots, and evidence
Session key:
agent:cassian-vale:discord:channel:1505134791992017047
Session id/file:
22a471aa-ada5-424a-aeed-2ed3774edeaf
/home/node/.openclaw/agents/cassian-vale/sessions/22a471aa-ada5-424a-aeed-2ed3774edeaf.jsonl
Relevant transcript entries:
2026-05-25T02:50:38.542Z
id=2355e2ea
type=custom_message
customType=openclaw.sessions_yield
parent=26daf018
2026-05-25T02:54:36.433Z
id=12d95196-c43f-4844-8e5d-066fb384d79e
type=message
role=assistant
parent=2355e2ea
provider=openclaw
model=gateway-injected
visible status included:
Context: 63k/1.1m (6%)
2026-05-25T02:59:25.241Z
id=9386dd5e
type=compaction
parent=2355e2ea
firstKeptEntryId=bd581ef0
tokensBefore=65320
fromHook=true
details={"readFiles":[],"modifiedFiles":[]}
Earlier same yielded-session pattern:
2026-05-25T02:41:03.689Z
id=307e723f
type=custom_message
customType=openclaw.sessions_yield
2026-05-25T02:46:34.716Z
id=18f9eadb
type=compaction
parent=307e723f
firstKeptEntryId=12e34dba
tokensBefore=115283
fromHook=true
Gateway log correlation:
2026-05-25T12:49:31.309+10:00 [ws] ⇄ res ✓ agent.wait 525686ms ...
2026-05-25T12:49:32.878+10:00 Done. Artifacts created: ...
2026-05-25T12:50:49.450+10:00 [compaction-safeguard] Compaction safeguard: using session branch messages after compaction preparation omitted real conversation content.
2026-05-25T12:51:33.124+10:00 [warn] Subagent completion direct announce failed for run cde2b626-62d2-4f92-a391-5cda394af32f: gateway request timeout for agent
Related lock evidence from same session window:
2026-05-25T12:42:51.044+10:00 [agent/embedded] embedded run agent end: runId=announce:v1:agent:cassian-vale:subagent:6219020e-e36a-414f-bd0a-0dc273514e61:7fa82631-db86-42f3-8b55-a53165cc3a66 isError=true
model=gpt-5.4 provider=openai-codex error=LLM request timed out. rawError=session file locked (timeout 60000ms): pid=8
/home/node/.openclaw/agents/cassian-vale/sessions/22a471aa-ada5-424a-aeed-2ed3774edeaf.jsonl.lock
Checkpoint evidence:
A retained pre-compaction checkpoint exists for the second compaction:
22a471aa-ada5-424a-aeed-2ed3774edeaf.checkpoint.aa66c107-fd92-4108-a024-4e2cbc0b4315.jsonl
Its last pre-compaction leaf was:
2355e2ea custom_message openclaw.sessions_yield
This confirms the compaction boundary was the hidden yielded-session branch, not the visible `/status` branch.
Impact and severity
Affected: At least one observed long-running Discord parent session using subagents and sessions_yield.
Severity: High for subagent-heavy workflows. The parent/main branch can lose exact history unexpectedly even when visible context usage is low.
Frequency: Observed twice in the same session window: compaction 18f9eadb and compaction 9386dd5e, both parented to hidden openclaw.sessions_yield custom messages. Not yet minimized into a
deterministic standalone repro.
Consequence: Parent session history is compacted earlier than expected, making it harder to audit exact orchestration decisions and confusing users because /status reports low context usage while
background wake-up handling still compacts the parent branch.
Additional information
fromHook: true appears to indicate that the compaction safeguard hook supplied the summary. It does not identify the caller/trigger that decided compaction should happen.
No exact duplicate found. Related issues/PRs found during issue search:
Requested behavior/policy:
- Subagent completion/direct-announce wake-up should not compact the requester/parent branch unless there is a real context-overflow condition or explicit user/manual compaction.
- If compaction is unavoidable, persist trigger metadata on the compaction entry, e.g.
trigger=direct_announce, trigger=sessions_yield_wake, trigger=overflow, trigger=manual, so future triage can
distinguish summary source (fromHook) from compaction cause.
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
A parent session parked with
sessions_yieldwas compacted during subagent completion/direct-announce handling despite being around 65k/1.05M context, with the compaction parented to hiddenopenclaw.sessions_yieldentries rather than the visible branch.This triggers excessive compactions, loss of relevant information on the main session (spawning subagents), and excessive API costs.
Steps to reproduce
Observed reproduction path:
agents.defaults.compaction.mode: "safeguard".openai-codex/gpt-5.4with effective context window1050000.sessions_spawn.sessions_yieldwhile waiting for subagent completion.openclaw.sessions_yieldcustom message even though visible context usage is far below the configured window.Expected behavior
A subagent completion/direct-announce wake-up should resume, notify, or append to the parent session without compacting the parent branch unless the parent is genuinely near context overflow or the user
explicitly requested compaction.
This regression started happening some time between .5.10 and .5.22
Actual behavior
The parent session compacted while far below the configured context window. The compaction entry
9386dd5ewas created at2026-05-25T02:59:25.241Z, parented to hiddencustom_message2355e2eaof typeopenclaw.sessions_yield, withtokensBefore: 65320andfromHook: true.A visible
/statusreply on a sibling branch shortly before this showedContext: 63k/1.1m (6%). The compaction was therefore not caused by visible branch context exhaustion.OpenClaw version
2026.5.22, gitSha ef17290
Operating system
Linux 6.8.0-107-generic x64 inside Docker; host is Ubuntu 24.04
Install method
Docker / docker compose
Model
openai-codex/gpt-5.4
Provider / routing chain
OpenClaw embedded Pi runtime -> openai-codex provider -> openai-codex-responses API via OAuth profile
Additional provider/model setup details
Relevant live config/effective model details:
agents.defaults.compaction:{ "mode": "safeguard" }agents.defaults.contextTokensoverride was set.openai-codex/gpt-5.4resolves to:contextWindow: 1050000contextTokens: 1050000maxTokens: 128000openai-codex/gpt-5.4.Logs, screenshots, and evidence
Session key: agent:cassian-vale:discord:channel:1505134791992017047 Session id/file: 22a471aa-ada5-424a-aeed-2ed3774edeaf /home/node/.openclaw/agents/cassian-vale/sessions/22a471aa-ada5-424a-aeed-2ed3774edeaf.jsonl Relevant transcript entries: 2026-05-25T02:50:38.542Z id=2355e2ea type=custom_message customType=openclaw.sessions_yield parent=26daf018 2026-05-25T02:54:36.433Z id=12d95196-c43f-4844-8e5d-066fb384d79e type=message role=assistant parent=2355e2ea provider=openclaw model=gateway-injected visible status included: Context: 63k/1.1m (6%) 2026-05-25T02:59:25.241Z id=9386dd5e type=compaction parent=2355e2ea firstKeptEntryId=bd581ef0 tokensBefore=65320 fromHook=true details={"readFiles":[],"modifiedFiles":[]} Earlier same yielded-session pattern: 2026-05-25T02:41:03.689Z id=307e723f type=custom_message customType=openclaw.sessions_yield 2026-05-25T02:46:34.716Z id=18f9eadb type=compaction parent=307e723f firstKeptEntryId=12e34dba tokensBefore=115283 fromHook=true Gateway log correlation: 2026-05-25T12:49:31.309+10:00 [ws] ⇄ res ✓ agent.wait 525686ms ... 2026-05-25T12:49:32.878+10:00 Done. Artifacts created: ... 2026-05-25T12:50:49.450+10:00 [compaction-safeguard] Compaction safeguard: using session branch messages after compaction preparation omitted real conversation content. 2026-05-25T12:51:33.124+10:00 [warn] Subagent completion direct announce failed for run cde2b626-62d2-4f92-a391-5cda394af32f: gateway request timeout for agent Related lock evidence from same session window: 2026-05-25T12:42:51.044+10:00 [agent/embedded] embedded run agent end: runId=announce:v1:agent:cassian-vale:subagent:6219020e-e36a-414f-bd0a-0dc273514e61:7fa82631-db86-42f3-8b55-a53165cc3a66 isError=true model=gpt-5.4 provider=openai-codex error=LLM request timed out. rawError=session file locked (timeout 60000ms): pid=8 /home/node/.openclaw/agents/cassian-vale/sessions/22a471aa-ada5-424a-aeed-2ed3774edeaf.jsonl.lock Checkpoint evidence: A retained pre-compaction checkpoint exists for the second compaction: 22a471aa-ada5-424a-aeed-2ed3774edeaf.checkpoint.aa66c107-fd92-4108-a024-4e2cbc0b4315.jsonl Its last pre-compaction leaf was: 2355e2ea custom_message openclaw.sessions_yield This confirms the compaction boundary was the hidden yielded-session branch, not the visible `/status` branch.Impact and severity
Affected: At least one observed long-running Discord parent session using subagents and
sessions_yield.Severity: High for subagent-heavy workflows. The parent/main branch can lose exact history unexpectedly even when visible context usage is low.
Frequency: Observed twice in the same session window: compaction
18f9eadband compaction9386dd5e, both parented to hiddenopenclaw.sessions_yieldcustom messages. Not yet minimized into adeterministic standalone repro.
Consequence: Parent session history is compacted earlier than expected, making it harder to audit exact orchestration decisions and confusing users because
/statusreports low context usage whilebackground wake-up handling still compacts the parent branch.
Additional information
fromHook: trueappears to indicate that the compaction safeguard hook supplied the summary. It does not identify the caller/trigger that decided compaction should happen.No exact duplicate found. Related issues/PRs found during issue search:
sessions_yieldcan leave parent transcript lock held, causing subagent completion callback timeoutsessions_yieldlock/settle behaviorRequested behavior/policy:
trigger=direct_announce,trigger=sessions_yield_wake,trigger=overflow,trigger=manual, so future triage candistinguish summary source (
fromHook) from compaction cause.