Skip to content

fix: Do not mark a tool lost when a call with no tools follows it - #2051

Merged
huang195 merged 1 commit into
rossoctl:mainfrom
huang195:fix/bob-tool-lost-side-calls
Nov 21, 2026
Merged

huang195 merged 1 commit into
rossoctl:mainfrom
huang195:fix/bob-tool-lost-side-calls

Conversation

@huang195

@huang195 huang195 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Problem

In a Bob session, agentop showed a tool call as lost. After some seconds, the same row changed to ok.

Bob sends a call to its security classifier right after each tool call. It also sends router calls when it starts a subtask. These calls are turns of the main agent, but they have no tool list. toolpair read each of them as "the agent asked again without the result", so it gave the tool ReasonAbandoned. When the next real request brought the result, the reason changed to ReasonResult.

Fix

In core/session/toolpair/toolpair.go, a request updates lastAsk only when it offers tools (Tools or ToolCount). An imported call still counts, because a transcript holds only real turns and never a tool list.

Claude Code's own tool-less side calls are already removed by isSideCall, so this rule does not affect them.

Tests

  • New TestToolLessCallDoesNotAbandon. It failed before the fix (abandoned) and passes now.
  • go test ./session/... ./model/... in core passes. go vet and gofmt are clean.
  • Backtest: I replayed 2,004 archived laptop sessions with the old rule and with the new rule (temporary test, not in this PR):
Agent Sessions Change
Claude Code 1,527 (83,653 tools) none
OpenCode 2 none
Bob 22 (231 tools) 94 tools no longer show lost before their result. 1 tool changed from lost to open.

That one Bob tool is in a session that stopped while its command ran. It now stays open, the same as an open tool for every other agent. There were no Codex or Pi sessions in the archive, so I did not check them.

I also installed this build on my laptop. The live Bob session that showed the problem now has 0 lost tools.

Assisted-By: Claude (Anthropic AI) noreply@anthropic.com

Summary by CodeRabbit

  • Bug Fixes
    • Requests without tool information no longer update an agent’s last-ask time or prematurely close a pending tool call.

Bob sends a call to its security classifier right after each tool
call, and router calls when it starts a subtask. These calls are turns
of the main agent, but they have no tool list. The pairing code read
each of them as "the agent asked again without the result", so the
tool showed "lost". When the next real request brought the result,
the row changed to "ok".

Now only a request that offers tools can make a tool "abandoned".
Imported transcript calls still count, because a transcript holds only
real turns and never a tool list.

Backtest on 2,004 archived sessions: no change for Claude Code or
OpenCode. For Bob, 94 tools no longer show "lost" before their result
arrives. One Bob tool, in a session that stopped while its command
ran, now stays "running", as an open tool does for every agent.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Hai Huang <huang195@gmail.com>
@huang195
huang195 requested a review from a team as a code owner November 21, 2026 22:13
@github-actions github-actions Bot added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Calls now advances an agent’s lastAsk timestamp only for qualifying requests with a later timestamp. A test verifies that a request without tools leaves a pending call open until a matching result arrives.

Changes: Tool-pair tracking

Layer / File(s) Summary
Timestamp updates and pending-call validation
core/session/toolpair/toolpair.go, core/session/toolpair/toolpair_test.go
lastAsk updates only for requests with tools, a positive ToolCount, or imported requests, and only when the timestamp is later. The test checks that a tool-less request leaves a pending call open and that a later matching result closes it with ReasonResult.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

  • rossoctl/cortex#2046 — The issue concerns stranded tool calls classified as abandoned through the lastAsk path. This change alters when lastAsk is set, but does not implement the issue’s stranded reason.

Suggested reviewers: mrsabath, clawgenti

Merge Risk: Minimal · up to 47d91

Tool-less side calls no longer make a pending tool look abandoned. The change is small and covered by a regression test, and no concrete merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: a tool-less call that follows a tool call no longer marks that tool as lost. The raw summary describes the same change to lastAsk handling in core/session/toolpair/to…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: a tool-less call that follows a tool call no longer marks that tool as lost. The raw summary describes the same change to lastAsk handling in core/session/toolpair/toolpair.go, and the objectives describe the same fix for tool-less side calls. The title is specific and matches the changeset, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7400c7b7-f0d5-4f7a-acb5-110168018816
Commits

Reviewing files that changed from the base of the PR and between e3b9b8b and 47d9121.

Files selected for processing: 2

  • core/session/toolpair/toolpair.go
  • core/session/toolpair/toolpair_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The fix is correct and narrow. A request with no tool manifest no longer advances lastAsk, so Bob's security-classifier and router calls stop marking an open tool abandoned. Result pairing is unchanged: the ToolResults loop still runs for every request. I checked the stated fix: TestToolLessCallDoesNotAbandon fails on base e3b9b8b (EndReason = "abandoned", want empty) and passes on this head. go test ./session/toolpair/ ./session/timeline/ passes, and go vet and gofmt are clean. The ToolCount branch makes the rule work on view=summary events too. The rule also matches isSideCall: Claude Code's tool-less calls are already dropped there, and other clients' calls stay as turns but no longer count as "asked again". There is one nit about comment wording, and it does not block.

Author: huang195 (MEMBER — maintainer)
Areas reviewed: Go (core/session/toolpair), tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (only Go CI (core peerproc, macOS) still running, and this change does not touch it; no annotations on Go CI (core) or Go CI (authbridge agentop))

if lastAsk[c.agent].Before(c.req.At) {
// Only a call that offers tools can carry a tool's result. Bob's security classifier and
// router calls offer none, and they follow every tool call. An imported call has no
// manifest, but a transcript holds only real turns.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Only a call that offers tools can carry a tool's result" is not quite what this gate does. The ToolResults loop above still records a result from any request, tool-less ones included, and that is right. What this decides is whether the request counts as the agent asking again, which is the input to ReasonAbandoned. Something like "Only a call that offers tools counts as the agent moving on…" would say that. Two other comments still describe the old rule and could be updated in the same pass: the lastAsk declaration ("agent → its latest request's At", line 319) and the ReasonAbandoned doc ("asked again without ever carrying its result").

@huang195
huang195 merged commit 9a22a48 into rossoctl:main Nov 21, 2026
41 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 21, 2026
@huang195
huang195 deleted the fix/bob-tool-lost-side-calls branch November 21, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants