Skip to main content

resolve_opencode_parent_tool_use_ids

Function resolve_opencode_parent_tool_use_ids 

Source
pub fn resolve_opencode_parent_tool_use_ids(sessions: &mut [Session])
Expand description

Resolve each opencode subagent (task) child session’s meta.parent_tool_use_id from its parent’s own task tool part callID (docs/interop/opencode-pi-spec.md §2.1 — the analogue of Claude Code’s agentId/parent_tool_use_id linkage, opencode-fields.md task.ts:145,171-176).

Nesting itself needs no opencode-specific pass: capture_opencode_session_info already mirrors SessionInfo.parentID into lineage["parent_thread_id"] (the same key Codex subagents use), so the existing generic Session::reconstruct_tree nests these sessions correctly on its own. Call this FIRST — it only reads session_id/messages/metadata, never reorders sessions — then feed the same Vec to reconstruct_tree.