Skip to content

RunInline task execution uses provider.chat() without tool definitions #1494

@bug-ops

Description

@bug-ops

Description

When DagScheduler routes a task to the main agent inline (via SchedulerAction::RunInline), the execution at crates/zeph-core/src/agent/mod.rs:820 uses self.provider.chat(&[msg]) — plain chat without tool definitions. The LLM cannot call any tools (bash, write_file, etc.) during inline task execution.

Root Cause

// crates/zeph-core/src/agent/mod.rs:818-828
let msg = Message::from_legacy(Role::User, prompt);
let event_tx = scheduler.event_sender();
let outcome = match self.provider.chat(&[msg]).await {
    Ok(output) => crate::orchestration::TaskOutcome::Completed {
        output,
        artifacts: vec![],
    },
    Err(e) => crate::orchestration::TaskOutcome::Failed {
        error: e.to_string(),
    },
};

provider.chat() returns Result<String> — a single text response with no tool use capability. The LLM generates text describing what it would do (e.g., "The file has been successfully created") without actually executing any tools.

Reproduction

  1. Configure orchestration enabled, no sub-agents
  2. Run /plan goal Create a file /tmp/hello.txt with text "test"
  3. Run /plan confirm
  4. Observe: DagScheduler correctly falls back to RunInline (log: "no agent available, routing task to main agent inline")
  5. Observe: LLM claims success but file is never created
  6. Verify: ls /tmp/hello.txt → not found

Expected Behavior

Inline task execution should include tool definitions and implement the tool_use/tool_result loop, similar to the main agent loop, so the LLM can actually execute tools.

Fix

Replace provider.chat(&[msg]) with provider.chat_with_tools() or equivalent that:

  1. Includes tool definitions from ToolExecutor in the API request
  2. Implements the tool_use → execute → tool_result loop
  3. Respects tool filters/permissions

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingorchestrationTask orchestration / DAG scheduling

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions