Mirrored from upstream 1jehuang/jcode — Issue #104 by @leighstillard
Original state: open
Created: 2026-05-03T00:49:56Z · Updated: 2026-05-03T03:48:35Z
This issue is an auto-mirrored copy. Comments and edits here are local to quangdang46/jcode — do not expect them to propagate upstream.
Bug Description
The ambient agent consistently fails to complete cycles. Every cycle ends with:
Cycle ended without calling end_ambient_cycle (forced end after 2 attempts)
After 9 consecutive cycles, memories_modified: 0, compactions: 0 - ambient has accomplished nothing.
Root Cause
The ambient system prompt instructs the agent to:
- "Start by using the todos tool to plan what you'll do this cycle"
- "you MUST call end_ambient_cycle with a summary"
- "You have a
send_message tool"
However, the agent cannot discover these tools. On the first turn it tries ToolSearch (which is not available in ambient sessions), fails, then spirals trying other discovery methods (skill_manage, etc.). It eventually falls back to bash but never successfully calls end_ambient_cycle.
The tools (end_ambient_cycle, send_message, etc.) appear to be registered in the binary (confirmed via strings), but the agent never successfully invokes them by name.
Transcript Evidence
From the ambient transcript, the agent's first actions every cycle:
Tool: ToolSearch -> Error: Unknown tool: ToolSearch
Tool: ToolSearch -> Error: Unknown tool: ToolSearch
Tool: ToolSearch -> Error: Unknown tool: ToolSearch
Tool: skill_manage -> Error: 'name' is required for load action
After these failures it uses bash to run jcode --help, explore the filesystem, etc. but never recovers to call the ambient-specific tools.
Environment
- jcode v0.11.6 (534ac37)
- Provider: Claude (claude-opus-4-6)
- OS: Linux x86_64
- Config:
visible = false, pause_on_active_session = false, min_interval_minutes = 1, max_interval_minutes = 10
Possible Causes
- Tool name mismatch - the tool might be registered under a different name than what the prompt references
- The ambient session's tool list (35 tools per logs) may not include the ambient-specific tools
- The model (Opus 4) may need the tool names explicitly listed in the system prompt rather than just mentioned in prose
Additional Context
- The ambient runner correctly detects the missing
end_ambient_cycle call and sends a continuation message asking the agent to call it, but the agent fails again on the retry
- Setting
visible = true previously caused a separate failure (tried to spawn kitty terminal, failed with ENOENT, treated as fatal instead of falling back to headless)
Bug Description
The ambient agent consistently fails to complete cycles. Every cycle ends with:
Cycle ended without calling end_ambient_cycle (forced end after 2 attempts)After 9 consecutive cycles,
memories_modified: 0,compactions: 0- ambient has accomplished nothing.Root Cause
The ambient system prompt instructs the agent to:
send_messagetool"However, the agent cannot discover these tools. On the first turn it tries
ToolSearch(which is not available in ambient sessions), fails, then spirals trying other discovery methods (skill_manage, etc.). It eventually falls back tobashbut never successfully callsend_ambient_cycle.The tools (
end_ambient_cycle,send_message, etc.) appear to be registered in the binary (confirmed viastrings), but the agent never successfully invokes them by name.Transcript Evidence
From the ambient transcript, the agent's first actions every cycle:
After these failures it uses
bashto runjcode --help, explore the filesystem, etc. but never recovers to call the ambient-specific tools.Environment
visible = false,pause_on_active_session = false,min_interval_minutes = 1,max_interval_minutes = 10Possible Causes
Additional Context
end_ambient_cyclecall and sends a continuation message asking the agent to call it, but the agent fails again on the retryvisible = truepreviously caused a separate failure (tried to spawn kitty terminal, failed with ENOENT, treated as fatal instead of falling back to headless)