Skip to content

Tool result attaches to wrong branch after tree navigation #6558

Description

@Minh-Ng

What happened?

If /tree changes the active branch while a tool is running, the returned toolResult can be appended to the new branch instead of the branch containing its assistant toolCall.

This leaves an orphan result in provider history. Model provider then rejects subsequent requests on that branch:

Codex error: No tool call found for function call output with call_id call_orphan_repro.

This makes the session branch unusable. It differs from #2796: there the selected branch is missing a tool result; here it contains a result whose tool call exists only on a sibling branch.

Steps to reproduce

A minimal JSONL session fixture and the command used to run it are included in a separate comment below.

The fixture represents this sequence:

  1. A tool call starts on a side branch.
  2. Tree navigation changes the active branch before the tool returns.
  3. The result is attached to the new branch instead of the branch containing its tool call.
  4. The next Codex request fails with the error above.

I reproduced this with extensions disabled.

Expected behavior

A pending tool result should remain on the branch containing its originating tool call, regardless of later changes to the active leaf. Tree navigation should not make a session branch unusable.

Version

0.80.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguntriagedThis issue has been auto closed and has not been triaged

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions