Skip to content

fix(frontend): request_input renders its form again after the transcript replay - #5859

Merged
mmabrouk merged 2 commits into
release/v0.112.0from
fix/request-input-ui
Aug 10, 2026
Merged

fix(frontend): request_input renders its form again after the transcript replay#5859
mmabrouk merged 2 commits into
release/v0.112.0from
fix/request-input-ui

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Aug 9, 2026

Copy link
Copy Markdown
Member

Mahmoud's regression: an agent calls request_input with a schema, and instead of the question form the chat shows "Not handled by this client."

Root cause — not a broken renderer, a missing replay branch

The live render worked. The durable-record replay adapter (transcriptToMessages) had never implemented the client-tool branch (// v1 scope: HITL approvals only), so when the record watermark reset at turn end and hydration adopted the server transcript, the parked request_input came back as a bare tool part without its data-render hint. The dispatcher matched neither axis and fell through to the auto-settling "not handled" fallback. That is why the form appeared to work, then flipped seconds after the turn parked.

The fix

  1. Replay a parked client-tool interaction as its tool part PLUS the render-hint sibling (both parity copies of the adapter).
  2. request_input resolves by tool name as the second dispatch axis (the same axis request_connection already uses) — covers transcripts persisted before hints existed.
  3. request_input joins CLIENT_TOOL_NAMES in the approval-resume path.

No parser change needed — parseElicitationPayload already handles the oneOf options and x-ag-stepper; pinned with the verbatim payload from the failing session.

Verification

Replayed the REAL 17 records of the failing session through the actual code: before → renderKind: undefined (unhandled), after → elicitation + ElicitationWidget. Each fix half independently restores dispatch. 158 + 244 + 215 + 338 tests pass across the four touched packages; new tests pin the replay, both dispatch axes, and the verbatim stepper payload.

Live repro

New chat on a build-kit agent → ask it to build a PR reviewer → the stepper form must appear AND still be a form 5-10s after the turn parks (the adoption tick that used to break it).

…ipt replay

The client-tool branch of the durable-record replay adapter was never
written ('v1 scope: HITL approvals only'), so a parked request_input
replayed as a bare tool part with no data-render sibling; the dispatcher
matched neither axis and fell through to UnhandledClientTool, which
auto-settled {status: not_handled}. The LIVE render was fine - the
watermark reset at turn end made hydration adopt the server transcript
seconds later, which is why the form flipped to 'Not handled' after
parking.

- transcriptToMessages (oss + agenta-chat parity copies): replay a parked
  client_tool interaction as the tool part plus its render hint.
- registry: request_input resolves by tool NAME as the second dispatch
  axis (same as request_connection), covering transcripts persisted
  before the hint existed.
- agentApprovalResume: request_input joins CLIENT_TOOL_NAMES.

Proven against the real 17 records of the failing session: renderKind
undefined -> elicitation, and each half of the fix independently restores
dispatch. 158/244/215/338 tests pass across the four packages; tsc,
eslint, prettier clean.
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error Aug 10, 2026 10:14am

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug report Something isn't working frontend labels Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cfe7c64-9920-4d50-9049-17950d93de67

📥 Commits

Reviewing files that changed from the base of the PR and between 613368b and 67de6c8.

📒 Files selected for processing (10)
  • docs/design/agent-chat-interaction-kinds/pr-5859-architecture-review.md
  • web/oss/src/components/AgentChatSlice/assets/transcriptToMessages.test.ts
  • web/oss/src/components/AgentChatSlice/assets/transcriptToMessages.ts
  • web/oss/src/components/AgentChatSlice/components/clientTools/meta.test.ts
  • web/oss/src/components/AgentChatSlice/components/clientTools/registry.tsx
  • web/packages/agenta-chat/src/assets/transcriptToMessages.ts
  • web/packages/agenta-chat/tests/unit/assets/transcriptToMessages.test.ts
  • web/packages/agenta-playground/src/state/execution/agentApprovalResume.ts
  • web/packages/agenta-playground/tests/unit/renderMap.test.ts
  • web/packages/agenta-shared/tests/unit/elicitation.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved replay of paused client-tool interactions, including input requests and connection requests.
    • Preserved tool-rendered content and metadata when restoring conversation history.
    • Improved handling of older transcripts and interactions without rendering hints.
    • Fixed resume behavior so completed requests continue correctly while pending requests remain paused.
    • Improved elicitation form handling, including choices, defaults, descriptions, and stepper details.
  • Documentation

    • Added an architecture review covering interaction replay, streaming, approvals, rendering, and resume behavior.

Walkthrough

Parked request_input client-tool interactions now replay with reconstructed tool parts and render data. Registry and resume logic recognize the tool by render kind or name, while tests cover pending, settled, legacy, and elicitation cases.

Changes

Client-tool replay and resume

Layer / File(s) Summary
Client-tool transcript replay
web/oss/src/components/AgentChatSlice/assets/transcriptToMessages.ts, web/packages/agenta-chat/src/assets/transcriptToMessages.ts, web/oss/src/components/AgentChatSlice/assets/transcriptToMessages.test.ts, web/packages/agenta-chat/tests/unit/assets/transcriptToMessages.test.ts
client_tool interaction requests now update or synthesize tool parts, refresh metadata, preserve settled results, and append data-render parts when hints exist.
Render resolution and resume gating
web/oss/src/components/AgentChatSlice/components/clientTools/registry.tsx, web/oss/src/components/AgentChatSlice/components/clientTools/meta.test.ts, web/packages/agenta-playground/src/state/execution/agentApprovalResume.ts, web/packages/agenta-playground/tests/unit/renderMap.test.ts, web/packages/agenta-shared/tests/unit/elicitation.test.ts
The registry recognizes request_input, treats defined render kinds as authoritative, and falls back to tool names only when hints are absent. Resume and elicitation tests cover settled, pending, and stepper payloads.
Architecture review and follow-ups
docs/design/agent-chat-interaction-kinds/pr-5859-architecture-review.md
The review documents interaction flows, replay parity, render selection, resume behavior, implementation findings, existing debt, and related design references.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DurableTranscript
  participant transcriptToMessages
  participant replayClientTool
  participant MessageParts
  DurableTranscript->>transcriptToMessages: client_tool interaction_request
  transcriptToMessages->>replayClientTool: client-tool payload
  replayClientTool->>MessageParts: update or synthesize tool part
  replayClientTool->>MessageParts: append data-render when hinted
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the request_input replay regression, root cause, fix, and verification steps.
Title check ✅ Passed The title clearly identifies the frontend fix for request_input rendering after transcript replay.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/request-input-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-08-10T10:52:50.373Z

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

Labels

bug report Something isn't working frontend lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant