Skip to content

[finding] maxToolRoundtrips is an authorable, documented chatbot key that reaches nothing — useObjectChat destructures it and never reads it #5605

Description

@os-sales

Observation-class, filed from the side while implementing #4187 (PR #5603) — recorded rather than fixed there, and out of that PR's scope.

maxToolRoundtrips is a declared-but-unenforced authorable key. It is spelled out at every layer that would make an author believe it works, and consumed at none.

Declared as authorable metadata:

  • packages/types/src/complex.ts:586maxToolRoundtrips?: number;
  • packages/types/src/zod/complex.zod.ts:264z.number().optional().describe('Max tool-calling round-trips')

Threaded through the renderer at three call sites, so it really does travel from the authored document into the hook:

  • packages/plugin-chatbot/src/renderer.tsx:88, :306, :439maxToolRoundtrips: schema.maxToolRoundtrips,

Accepted by the hook, given a default, and then dropped:

  • packages/plugin-chatbot/src/useObjectChat.ts:242 — declared on UseObjectChatOptions
  • packages/plugin-chatbot/src/useObjectChat.ts:363maxToolRoundtrips = 5, destructured out of options and never referenced again in the file. ESLint says so out loud today: 'maxToolRoundtrips' is assigned a value but never used (@typescript-eslint/no-unused-vars, warning).

Nothing passes it to useChat, to the transport, or to the request body — grep -rn "maxToolRoundtrips" over packages/ and apps/ returns only the sites above.

Documented as working, with a stated default:

  • content/docs/plugins/plugin-chatbot.mdx:111 and :155| maxToolRoundtrips | number | 5 | Max tool-calling round-trips per message |

So an author who sets it gets no error, no warning, and no effect — and the docs give them a number to reason about. This is the shape ADR-0049's enforce-or-remove exists for: either the hook must cap round-trips with it, or the key comes out of the type, the zod schema, the renderer and the docs together.

Not assigned; not urgent as far as anything measured here — no runtime fault was observed, and the round-trip behaviour a user gets today is simply whatever the AI SDK defaults to. Filed so the discrepancy is on the record rather than rediscovered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:queue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions