tinyhumansai/openhuman · error

no parent context

Error message

no parent context

What it means

spawn_worker_thread requires an ambient agent-turn context (current thread/parent info it reads from the run context) and found none — the tool was invoked outside an orchestration session (no parent thread context available). It is a precondition sentinel: the tool only makes sense as a spawn from a parent agent turn, not from a bare/standalone invocation.

Source

Thrown at src/openhuman/agent/orchestration/tools/spawn_worker_thread.rs:152

            .get("toolkit")
            .and_then(|v| v.as_str())
            .map(|s| s.to_string());
        let model_override = args
            .get("model")
            .and_then(|v| v.as_str())
            .map(|s| s.trim().to_string())
            .filter(|s| !s.is_empty());

        if agent_id.is_empty() || prompt.is_empty() {
            tracing::warn!(
                agent_id = %agent_id,
                prompt_empty = prompt.is_empty(),
                "[spawn_worker_thread] rejected: agent_id and prompt are required"
            );
            return Ok(ToolResult::error("agent_id and prompt are required"));
        }

        let parent = current_parent().ok_or_else(|| anyhow::anyhow!("no parent context"))?;

        // ── Depth Guard ────────────────────────────────────────────────
        // Check if the current thread is already a worker thread.
        let current_thread_id =
            crate::openhuman::agent::tinyagents::thread_context::current_thread_id()
                .unwrap_or_else(|| "unknown".to_string());

        tracing::info!(
            agent_id = %agent_id,
            task_title = %task_title,
            current_thread_id = %current_thread_id,
            toolkit_override = ?toolkit_override,
            has_context = context.is_some(),
            "[spawn_worker_thread] invoked"
        );

        let threads = conversations::list_threads(parent.workspace_dir.clone())
            .map_err(|e| anyhow::anyhow!(e))?;

View on GitHub (pinned to 7491200858)

Solutions

  1. Invoke spawn_worker_thread only within an agent turn that has an active thread context
  2. If surfacing via RPC/tests, provide the required parent context or use the session-based spawn API instead
  3. Check for harness regressions where the context task-local is not propagated to tool execution
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/agent/orchestration/tools/spawn_worker_thread.rs:152 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/b66e9ad93d722e06. Report an issue: GitHub.