fix(agents): resume queued turns after questionnaire answers - #6603
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🤖 The AI agent says: @coderabbitai review Please review the client-tool answer ownership and dispatcher reconstruction, including rejection retries and the legacy capability fallback. Independent source review and focused regressions passed. Exact-image local two-client and mobile validation will follow the CI builds; this PR is not ready to merge until that proof and your completed review are available. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughClient-tool outputs now use durable interaction answers when supported, with legacy fallback handling. The backend replays completed and error outcomes as ChangesClient-tool answer flow
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Connection-answer submission failures now clearly present a Retry action, avoiding the prior misleading Connect label. No active merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant ClientToolUI
participant AgentConversation
participant InteractionAnswerAtom
participant SessionAPI
participant InteractionDispatcher
ClientToolUI->>AgentConversation: submit output or error
AgentConversation->>InteractionAnswerAtom: send structured resolution
InteractionAnswerAtom->>SessionAPI: respond with idempotency key
SessionAPI-->>AgentConversation: return execution outcome
SessionAPI->>InteractionDispatcher: provide completed or error answer
InteractionDispatcher-->>ClientToolUI: replay tool_result message
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/agenta-chat/src/components/ConnectionDock.tsx (1)
576-576: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winLabel the retry state correctly. When
useConnectFlowsetserrorTextafter submission failure, Line 576 renders “Connect” instead of “Retry”.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Team
Run ID: c47900b2-96c7-41fe-8cad-322659a430d3
📒 Files selected for processing (16)
api/oss/src/tasks/asyncio/sessions/interactions_dispatcher.pyapi/oss/tests/pytest/unit/sessions/test_interactions_dispatcher.pyweb/oss/src/components/AgentChatSlice/AgentConversation.tsxweb/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.test.tsweb/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.tsweb/packages/agenta-chat/src/clientTools/ClientToolPart.tsxweb/packages/agenta-chat/src/components/ConnectionDock.tsxweb/packages/agenta-chat/src/components/ElicitationDock.tsxweb/packages/agenta-chat/src/hooks/useAgentConversation.tsweb/packages/agenta-chat/tests/unit/components/elicitationDockSettle.test.tsxweb/packages/agenta-chat/tests/unit/hooks/useAgentConversation.test.tsweb/packages/agenta-entities/src/session/state/interactionAnswer.tsweb/packages/agenta-entities/tests/unit/session-interaction-answer.test.tsweb/packages/agenta-entity-ui/src/clientTools/useConnectFlow.tsweb/packages/agenta-entity-ui/tests/unit/useConnectFlow.test.tsweb/packages/agenta-shared/src/clientTools/index.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
| it("preserves questionnaire content and stable retry identity without legacy transition", async () => { | ||
| const store = createStore() | ||
| store.set(projectIdAtom, "project-id") | ||
| store.set(queryClientAtom, new QueryClient()) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the shared test QueryClient setup. Line 47 constructs new QueryClient() despite the project rule that forbids local QueryClient construction. As per coding guidelines, “Never construct your own new QueryClient().”
Source: Coding guidelines
|
|
Railway Preview Environment
Updated at 2026-09-06T13:31:45.692Z |
|
🤖 The AI agent says: Addressed review findings in a2e2d81:
Also corrected the two CI formatting findings. Focused connection tests, chat/entity-ui types and full frontend lint pass. Independent review of this follow-up passed. The original questionnaire images are now running locally; the connection retry delta has separate regression coverage and new CI builds. @coderabbitai review |
|
|
Context
Submitting a questionnaire from a queued agent turn saved the answer but left the run stuck. The browser then tried to resume the runner directly; the server correctly refused because the queued continuation still owned the session. The UI showed “A saved approval is resuming,” and later messages remained queued. This was reproduced with two local browser tabs.
Changes
Desktop and mobile now submit client-tool answers through the existing server-owned response path when durable approvals are enabled. The answer keeps its structured values and a stable retry identity, and the returned execution ID holds the queue until continuation finishes. Servers without that capability keep the existing ordered local resume.
The dispatcher reconstructs client-tool history and the answered tool result before invoking the continuation, preserving successful output and error results. Native approvals and generic user-input pass-through keep their existing behavior. A failed questionnaire submission appears in the form’s existing error line and can be retried without starting a competing local resume. Connection answers likewise preserve rejected submission promises and retry the saved answer without creating another connection.
Tests
The real two-tab failure and a focused shared-hook regression failed before the fix. Afterward, 30 dispatcher tests, 64 shared hook/form/ownership tests, 14 desktop hook tests five entity/API tests and 12 connection tests pass. Shared chat, entity and entity-UI TypeScript checks and full frontend lint-fix pass (25 tasks).
Demo
The corrected dispatcher also resumed the previously stuck local questionnaire through the canonical response endpoint: one continuation finished with the selected answer and the queue cleared. The baked questionnaire frontend passed local two-tab and mobile checks: the second tab submitted Visual polish with the untouched Daily default, one continuation completed, both tabs settled, and the next message completed. Mobile submitted Yes through one durable response and returned to idle. Saved records confirm one exact answer and one terminal for each run; screenshots were visually inspected. These images match the questionnaire implementation; the later connection-retry-only correction has focused regression, type and lint coverage. The exact final source also passed staging: a questionnaire queued behind a running turn was answered on mobile through one durable response, its exact answer and terminal were saved, and a normal follow-up completed with an empty queue. A separate first-send capability initialization finding is retained for follow-up, outside this fix. The original reproduction and final captures are retained in private QA evidence.
What to QA
While one turn runs, queue a questionnaire request. Answer it from a second tab, keeping one default value unchanged. Confirm one continuation receives the exact answers, both tabs settle, and the next queued message completes. Repeat one questionnaire submission on mobile.