Skip to content

feat(ag-ui): regenerate a response from the React AG-UI session - #1645

Open
blove wants to merge 1 commit into
mainfrom
blove/ag-ui-runtime-regenerate
Open

blove wants to merge 1 commit into
mainfrom
blove/ag-ui-runtime-regenerate

Conversation

@blove

@blove blove commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Core AgentSession has an optional regenerate(messageId), and React Chat shows a Regenerate action whenever a session supplies it. The LangGraph runtime supplies it. The AG-UI React runtime did not, so AG-UI chats had no Regenerate action, even though the Angular AG-UI adapter has regenerate (libs/ag-ui/src/lib/to-agent.ts).

  • createSession (plain native owner) gains regenerate(messageId, options?) with the Angular adapter's semantics: it finds the root assistant record (or the reasoning record that a reasoning-only answer is shown under, which is the id the core view uses), keeps history through the user message before it, drops everything after, and sends a run with that history and the current state. The prompt is not added again. Regenerating an earlier answer drops every later turn, as in Angular.
  • It rejects without sending after disposal, while a run is active, while a decision is waiting, for an id that is not an assistant record, and when no prompt precedes it. That matches Angular (which throws) and the core contract and LangGraph runtime (which reject). A failed regenerate can be retried from the same trimmed history (Angular treats regenerate as replayable too).
  • createAgentSession forwards it as the core regenerate, so React Chat offers Regenerate for AG-UI sessions.
  • The client-tool owner does not get regenerate: its ledger owns the history of the calls it ran, and trimming that history is not supported. retry is absent there for a similar reason.
  • No new export or source file, so the candidate package lists and pins are unchanged. installed-types.ts gains type probes for the new method.
  • The runtime README documents it.

Verification

  • nx run-many -t runtime-quality runtime-type-tests type-tests lint test -p ag-ui: 44 files / 745 tests pass (new regenerate.spec.ts, 9 tests, written first and seen failing), lint has 0 errors.
  • nx run-many -t test lint type-tests -p react: 100 files pass, lint has 0 errors.
  • node --test scripts/react-parity/verify-packages.spec.mjs: 103 pass. ag-ui-candidate-package.spec.mjs: 28 pass.
  • node scripts/react-parity/verify-ag-ui-candidate.mjs: verified-ag-ui-candidate after building core/content/angular/react, npm ci in deployments/ag-ui-mastra, and a uv env. The first attempt used the shared /tmp Python env and failed with No module named 'langchain_core', probably because another agent re-synced that env at the same time. It passed with a private env.
  • inventory.mjs --check --drift warn: valid.

🤖 Generated with Claude Code

Core AgentSession has an optional regenerate(messageId), and React Chat
offers Regenerate whenever a session supplies it. The LangGraph runtime
does; the AG-UI runtime did not, so AG-UI chats had no Regenerate action
even though the Angular AG-UI adapter supports it.

The plain native owner now has regenerate(messageId, options?) with the
Angular adapter's semantics: it finds the root assistant record (or the
reasoning record a reasoning-only answer is shown under), keeps history
through the user message before it, drops everything after, and sends a
run with that history and the current state without adding the prompt
again. It rejects without sending after disposal, during a run, while a
decision waits, for an id that is not an assistant record, and when no
prompt precedes it, matching the core contract. A failed regenerate can
be retried from the same trimmed history. createAgentSession forwards it
as the core regenerate. The client-tool owner is left without it because
its ledger owns the call history, as it is for retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blove
blove enabled auto-merge November 18, 2026 01:01

This branch has not been deployed

No deployments
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