Skip to content

fix(claude-managed-agents): validate newest first-contact message - #3160

Merged
ranst91 merged 3 commits into
ag-ui-protocol:mainfrom
Aschenbath:fix/managed-agents-first-contact-preflight-3116
Oct 26, 2026
Merged

ranst91 merged 3 commits into
ag-ui-protocol:mainfrom
Aschenbath:fix/managed-agents-first-contact-preflight-3116

Conversation

@Aschenbath

@Aschenbath Aschenbath commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3116.

Fresh Managed Agents sessions send only the newest user message, but their preflight scanned history. An older malformed attachment could block a valid correction, while older valid text could allow session creation before the selected malformed attachment failed.

TypeScript, Python and .NET now select and validate the newest first-contact user message before creating a session. A blank newest message also cannot fall back to older text. Existing-session delivery cursors and pending tool-result handling retain their current paths, and strict UTF-8 decoding and the original RUN_STARTED.input are preserved. The three package READMEs describe the behavior and its scope.

Validation:

  • Five new regressions per SDK fail against the original implementation. They cover both message orderings for malformed base64 and invalid UTF-8, plus a blank newest message, through real adapters with fake clients.
  • TypeScript: 230 tests passed across all 16 package test files on Linux; Nx build, typecheck and package export checks passed.
  • Python: 253 package tests passed; wheel and source distribution built.
  • .NET: 250 package tests passed on net10.0; the Release solution build covered the library's net8.0/net9.0/net10.0 targets, the example and tests; NuGet and symbol packages built. Existing SDK dependency NU1902 warnings remain.

The existing TypeScript native-state subprocess test rejects a Windows drive path as an ESM URL. Linux on DrvFS also reached its subprocess deadline; the complete suite passed with the same code and dependencies on a private tmpfs worktree. No test assertion or deadline was changed. All validation used fake clients or a loopback provider, with no hosted model calls.

Hosted CI is waiting for maintainer approval to run on this fork PR. Draft for maintainer scope/assignment confirmation under the contribution workflow. Implementation and local verification were performed with Codex.

Aschenbath and others added 3 commits October 23, 2026 14:39
…sessions

An existing session only converts its undelivered user messages, but the
.NET preflight still decoded the whole history. A thread created from
[malformed, corrected] therefore failed its next turn with
invalid_attachment on the old, never-sent attachment, and the follow-up
was never delivered.

Drop the existing-session scan so .NET matches TypeScript and Python:
delivered history is not revalidated, and a malformed newest message
still fails the run before anything is sent.

Add two-turn and malformed-newest regressions to all three SDKs.
@ranst91
ranst91 marked this pull request as ready for review October 26, 2026 12:31
@ranst91
ranst91 requested a review from a team as a code owner October 26, 2026 12:31
@ranst91

ranst91 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution @Aschenbath. I took the liberty to carry it to completion, addressing a small .NET issue I'd otherwise ask to fix. With this, I will make sure it passes CI, approved and merge

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ag-ui/a2a-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a-middleware@3160

@ag-ui/a2ui-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-middleware@3160

@ag-ui/event-throttle-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/event-throttle-middleware@3160

@ag-ui/mcp-apps-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-apps-middleware@3160

@ag-ui/mcp-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-middleware@3160

@ag-ui/a2a

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a@3160

@ag-ui/adk-js

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk-js@3160

@ag-ui/adk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk@3160

@ag-ui/ag2

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/ag2@3160

@ag-ui/agno

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/agno@3160

@ag-ui/antigravity

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/antigravity@3160

@ag-ui/aws-strands

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/aws-strands@3160

@ag-ui/claude-agent-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-agent-sdk@3160

@ag-ui/claude-managed-agents

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-managed-agents@3160

@ag-ui/crewai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/crewai@3160

@ag-ui/langchain

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langchain@3160

@ag-ui/langgraph

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langgraph@3160

@ag-ui/llamaindex

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/llamaindex@3160

@ag-ui/mastra

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mastra@3160

@ag-ui/pydantic-ai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/pydantic-ai@3160

@ag-ui/vercel-ai-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/vercel-ai-sdk@3160

@ag-ui/watsonx

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/watsonx@3160

@ag-ui/a2ui-toolkit

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-toolkit@3160

create-ag-ui-app

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/create-ag-ui-app@3160

@ag-ui/client

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/client@3160

@ag-ui/core

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/core@3160

@ag-ui/encoder

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/encoder@3160

@ag-ui/proto

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/proto@3160

commit: 426b563

@ranst91
ranst91 merged commit 0145f0c into ag-ui-protocol:main Oct 26, 2026
81 checks passed
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.

claude-managed-agents: align attachment preflight with first-contact message selection

2 participants