Skip to content

docs: correct hasToolResult turn-scoping on the docs site#321

Merged
jpr5 merged 2 commits into
mainfrom
docs/hastoolresult-turn-scoping
Jul 20, 2026
Merged

docs: correct hasToolResult turn-scoping on the docs site#321
jpr5 merged 2 commits into
mainfrom
docs/hastoolresult-turn-scoping

Conversation

@jpr5

@jpr5 jpr5 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

The in-repo docs site (deploys to aimock.copilotkit.dev via GitHub Pages from docs/) still described hasToolResult with its old whole-conversation semantics in several places. Those pages are now wrong on the live site.

As of v1.37.3 the matcher made hasToolResult turn-scoped, and v1.37.4 made the record side symmetric. It now means:

hasToolResult is true when the current turn — the messages after the last user message — contains a tool result; with a no-user-message fallback to scanning the whole conversation.

This is exactly what src/router.ts currentTurnHasToolResult does, and what the recorder stamps via the same shared predicate. Turn-scoping is what keeps leg-1 (tool call, false) vs leg-2 (post-tool narration, true) fixtures working across multiple user turns — a whole-conversation check would force true forever once any earlier turn carried a tool result.

Changes (docs only)

  • docs/multi-turn/index.html — field-overview bullet, the "hasToolResult — match by tool execution state" prose, and the comparison-table row now describe current-turn scoping and the leg-1/leg-2 multi-turn discrimination it enables.
  • docs/fixtures/index.html — match-fields table row now states current-turn scoping.
  • docs/record-replay/index.html — both recorder-derivation prose spots corrected, and the buildFixtureMatch code snippet now uses the shared currentTurnHasToolResult(...) predicate instead of the stale whole-conversation request.messages.some((m) => m.role === "tool") scan.

Left untouched: pages that only mention hasToolResult in passing or in already-correct code examples (examples, sequential-responses, integrate-*, agui-mock, gemini-interactions).

Edits are minimal and match each page's existing tone/structure — no restyling.

🤖 Generated with Claude Code

hasToolResult became TURN-SCOPED in v1.37.3 (matcher) with the record side
made symmetric in v1.37.4: it means "does the current turn — the messages
after the last user message — contain a tool result", not the old
"does the whole conversation contain a tool result". Several docs pages still
described the old whole-conversation semantics and were misleading on the
live site (aimock.copilotkit.dev).

- docs/multi-turn/index.html: fix the field overview bullet, the
  "hasToolResult — match by tool execution state" prose, and the comparison
  table row to describe current-turn scoping; explain that this is what keeps
  leg-1 (tool call, false) vs leg-2 (narration, true) fixtures working on
  every turn of a multi-turn session.
- docs/fixtures/index.html: fix the match-fields table row.
- docs/record-replay/index.html: fix both recorder-derivation prose spots and
  update the buildFixtureMatch snippet to use the shared currentTurnHasToolResult
  predicate instead of a whole-conversation messages.some() scan.

Matches src/router.ts currentTurnHasToolResult (with its no-user-message
fallback to whole-conversation).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@321

commit: 331f668

Line-rewrap only (pinned prettier 3.8.1); no semantic wording changed.
Fixes the Static Quality / prettier CI check on this branch.
@jpr5
jpr5 merged commit 434578a into main Jul 20, 2026
11 checks passed
@jpr5
jpr5 deleted the docs/hastoolresult-turn-scoping branch July 20, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant