fix: suppress SUBAGENT_SPAWN_ACCEPTED_NOTE for cron isolated sessions#27330
fix: suppress SUBAGENT_SPAWN_ACCEPTED_NOTE for cron isolated sessions#27330kevinWangSheng wants to merge 2 commits intoopenclaw:mainfrom
Conversation
- Modified assertSystemdAvailable to check both user and system scope - Added detectSystemdScope function for explicit scope detection - Updated execSystemctl to support optional --user flag - Fixes openclaw#27267: openclaw status incorrectly reports 'systemd not installed' when gateway is running via systemd
Cron isolated sessions end immediately after the agent produces a response. When the agent sees the 'do not poll/sleep' note, it immediately responds with 'Waiting for sub-agents...' and the turn completes prematurely, before subagent results are collected. This fix detects cron sessions (by checking if agentSessionKey starts with 'cron:') and suppresses the note in that case, allowing the agent to wait naturally for subagent results. Fixes openclaw#27308
Greptile SummaryThis PR includes two separate fixes: (1) suppresses the "do not poll/sleep" note for cron isolated sessions to prevent premature turn completion, and (2) improves systemd detection to check both user and system scopes. The cron session fix correctly detects cron sessions by checking if
Confidence Score: 2/5
Last reviewed commit: 0acf294 |
|
|
||
| export async function isSystemdUserServiceAvailable(): Promise<boolean> { | ||
| const res = await execSystemctl(["--user", "status"]); | ||
| const res = await execSystemctl(["--status"], true); |
There was a problem hiding this comment.
--status is invalid - systemctl doesn't have a --status flag. Should be status without the double dash since execSystemctl will prepend --user when useUser is true.
| const res = await execSystemctl(["--status"], true); | |
| const res = await execSystemctl(["status"], true); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/daemon/systemd.ts
Line: 148
Comment:
`--status` is invalid - systemctl doesn't have a `--status` flag. Should be `status` without the double dash since `execSystemctl` will prepend `--user` when `useUser` is true.
```suggestion
const res = await execSystemctl(["status"], true);
```
How can I resolve this? If you propose a fix, please make it concise.|
@kevinWangSheng thanks for the fix! |
Bug in
|
| Check | Duration | Result |
|---|---|---|
startsWith("cron:") (this PR) |
43s | ❌ "Sub-agents launched. Waiting for results..." |
includes(":cron:") (fixed) |
257s | ✅ Full news digest with 30+ items, delivered |
The includes version correctly suppresses the SUBAGENT_SPAWN_ACCEPTED_NOTE, allowing the cron agent to poll/wait for subagent results instead of immediately ending the turn.
Minor note
After the cron run completes, subagents still attempt to announce back to the (now dead) cron session, producing "Subagent announce direct announce agent call transient failure" warnings in the console. This is cosmetic and does not affect delivery, but could be a follow-up cleanup.
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
|
Alternative fix with corrected session key check and tests: PR #27470 |
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR #27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes #27308
Fixes #25069
|
Fixed by 69590de. |
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
(cherry picked from commit 69590de)
# Conflicts:
# src/agents/subagent-spawn.ts
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
(cherry picked from commit 69590de)
# Conflicts:
# src/agents/subagent-spawn.ts
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR openclaw#27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes openclaw#27308
Fixes openclaw#25069
Summary
Fixes issue #27308 - Cron isolated sessions break with sessions_spawn because the 'do not poll/sleep' note causes premature turn completion.
Root Cause
When the agent sees the SUBAGENT_SPAWN_ACCEPTED_NOTE ("auto-announces on completion, do not poll/sleep"), it immediately responds with "Waiting for sub-agents..." and the turn completes. In cron isolated sessions, the turn ending means the cron job finalizes, so subagent results are never collected.
Fix
Detect cron sessions by checking if starts with "cron:" and suppress the note in that case. This allows the agent to wait naturally for subagent results, keeping the turn alive until subagents complete.
Testing
Related