Skip to content

fix(client): latch configure() on direct handler calls and vercelEvaluate #191

Closed as not planned

Description

@jeffdupont

Follow-up from #190 (review nit, non-blocking for that PR).

Problem

Spec §3.9a says configure() may replace the options until the first AI invocation, "a ProviderHandler call or the start of its stream". After that, a different value must be rejected.

In #190 the lock (noteAiInvocation() in packages/client/src/sdk-options.ts) is set only on SDK-owned paths:

  • executeAndTrack / executeAndStream (packages/client/src/tracking.ts)
  • stream start (createHandlerInternal, packages/client/src/utils.ts)
  • the offline evaluation runner and scoring

Two call paths make a real AI call without setting it:

  1. A caller invoking a handler directly: await handler(config, input).
  2. vercelEvaluate (packages/vercel-messages/src/evaluate.ts).

After either one, configure({ options: { captureContent: false } }) is accepted instead of throwing. No content leaks either way. The process default just changes quietly when it should fail loudly.

Suggested fix

In createHandlerInternal, wrap the blocking call the same way #190 wraps stream: call noteAiInvocation(), then the real handler. Each provider handler already captures const handler = createHandlerInternal(...), so its handler.captureContent reads keep working. Call noteAiInvocation() at the start of vercelEvaluate as well.

Tests

  • A directly called createHandler handler latches: a later configure with a different value throws.
  • vercelEvaluate latches the same way.

Graph nodes don't need a change: graph.ts goes through executeAndStream, which already latches.

Activity

  1. jeffdupont commented on Oct 29, 2026

    @jeffdupont
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions