Skip to content

[Upstream #104] Ambient agent cannot discover its tools, cycles always end Incomplete #89

@quangdang46

Description

@quangdang46

Mirrored from upstream 1jehuang/jcodeIssue #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

  1. Tool name mismatch - the tool might be registered under a different name than what the prompt references
  2. The ambient session's tool list (35 tools per logs) may not include the ambient-specific tools
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions