[fix] Restore queued message editing on web and mobile - #6607
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🤖 The AI agent says: This implements the requested Edit restoration and badge removal on both desktop and mobile. Independent API and frontend reviews found no blocking issues. Validation:36 real-database checks,60 focused frontend checks, both host types,25 lint tasks, and10 focused Storybook stories. The generated client diff preserves canonical Fern formatting and adds only the new method/types. The tracked Storybook source is @coderabbitai review |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe change adds a PATCH endpoint for editing pending session inputs. It adds transactional content updates, attachment merging, locking, client persistence, durable queue editing, capability resolution, and UI handling for edited rows that leave the queue. ChangesPending input editing
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: 🟡 Moderate · up to Queued-message editing may duplicate a message during local-to-server transfer and may report success for an invalid update response, risking unexpected queued content and unreliable retry behavior. These issues should be resolved before merge. Sequence Diagram(s)sequenceDiagram
participant ChatUI
participant QueueHook
participant SessionsAPI
participant SessionInputsService
participant PostgreSQL
ChatUI->>QueueHook: Commit server-backed edit
QueueHook->>SessionsAPI: PATCH pending input
SessionsAPI->>SessionInputsService: Update input
SessionInputsService->>PostgreSQL: Lock and persist content
PostgreSQL-->>SessionInputsService: Updated pending input
SessionInputsService-->>SessionsAPI: PendingInputResponse
SessionsAPI-->>QueueHook: Update result
QueueHook-->>ChatUI: Refresh edited queue state
🚥 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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Team
Run ID: a4b90ea8-b2a1-4942-a790-2f3646272511
⛔ Files ignored due to path filters (5)
web/packages/agenta-api-client/src/generated/api/resources/sessions/client/Client.tsis excluded by!**/generated/**web/packages/agenta-api-client/src/generated/api/resources/sessions/client/requests/PendingInputUpdateRequest.tsis excluded by!**/generated/**web/packages/agenta-api-client/src/generated/api/resources/sessions/client/requests/index.tsis excluded by!**/generated/**web/packages/agenta-api-client/src/generated/api/types/PendingInputAttachment.tsis excluded by!**/generated/**web/packages/agenta-api-client/src/generated/api/types/index.tsis excluded by!**/generated/**
📒 Files selected for processing (24)
api/oss/src/apis/fastapi/sessions/models.pyapi/oss/src/apis/fastapi/sessions/router.pyapi/oss/src/core/sessions/inputs/dtos.pyapi/oss/src/core/sessions/inputs/interfaces.pyapi/oss/src/core/sessions/inputs/service.pyapi/oss/src/core/sessions/inputs/types.pyapi/oss/src/dbs/postgres/sessions/inputs/dao.pyapi/oss/tests/pytest/unit/sessions/test_session_inputs_dao.pyweb/mobile/src/features/chat/LiveConversation.tsxweb/oss/src/components/AgentChatSlice/AgentConversation.tsxweb/oss/src/components/AgentChatSlice/components/QueuedMessagesDock.tsxweb/packages/agenta-chat/src/assets/pendingInputs.tsweb/packages/agenta-chat/src/components/QueuedMessagesDock.tsxweb/packages/agenta-chat/src/hooks/useAgentChatQueue.tsweb/packages/agenta-chat/src/hooks/useAgentConversation.tsweb/packages/agenta-chat/src/hooks/useServerSessionInputs.tsweb/packages/agenta-chat/tests/unit/QueuedMessagesDock.test.tsxweb/packages/agenta-chat/tests/unit/assets/pendingInputs.test.tsweb/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.tsweb/packages/agenta-chat/tests/unit/hooks/useServerSessionInputs.test.tsweb/packages/agenta-entities/src/session/api/api.tsweb/packages/agenta-entities/src/session/index.tsweb/packages/agenta-entities/src/session/state/pendingInputs.tsweb/storybook/stories/presentational/QueuedMessagesDock.stories.tsx
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
|
|
Railway Preview Environment
Updated at 2026-09-06T19:16:06.979Z |
…se-1152-queued-input-edit # Conflicts: # web/packages/agenta-chat/src/components/QueuedMessagesDock.tsx # web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts # web/packages/agenta-chat/src/hooks/useServerSessionInputs.ts # web/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.ts
|
🤖 The AI agent says: Synchronized with the merged questionnaire follow-up in release/v0.115.2. Conflict resolution preserves capability readiness, failed mobile task retention, visible Send Now and the durable Edit path. Both sets of regression tests remain. Independent merge-resolution review passed. All68 affected shared tests, chat/desktop/mobile types,25 lint tasks and direct test formatting pass. The API implementation is unchanged from the36-check real-database verification. Review3944748578 is addressed by retaining the one-line visibility comment from the release. The earlier failed web unit job used the old lazy-editor fixture; the merge includes the fixture correction already passing CI in6606. @coderabbitai review |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/packages/agenta-entities/src/session/api/api.ts (1)
221-221: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winValidate the update response.
!!dataaccepts truthy invalid payloads as success; usesafeParseWithLogging.Source: Coding guidelines
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts (1)
354-354: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve identity after migration. Recheck
server.queuedat commit because a row migrated mid-edit retainsserver:falseandsubmit()creates a duplicate ID.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Team
Run ID: 6befb45f-6222-4bd6-81fa-da552f172413
📒 Files selected for processing (7)
web/mobile/src/features/chat/LiveConversation.tsxweb/packages/agenta-chat/src/components/QueuedMessagesDock.tsxweb/packages/agenta-chat/src/hooks/useAgentChatQueue.tsweb/packages/agenta-chat/src/hooks/useServerSessionInputs.tsweb/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.tsweb/packages/agenta-chat/tests/unit/hooks/useServerSessionInputs.test.tsweb/packages/agenta-entities/src/session/api/api.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- web/packages/agenta-chat/src/components/QueuedMessagesDock.tsx
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.
|
|
|
🤖 The AI agent says: Addressed both outside-diff findings in review5126136093. Pending-input updates now validate the returned row before accepting a save. An edit keeps ownership of its original message when a held local queue is transferred to the server. It waits for an in-flight transfer, replays the original admission payload after an ambiguous failure, and updates the same ID. Promotion or a delayed snapshot cannot turn the edit into a second message. Independent review passed. Fifty queue tests and24 entity tests pass, including regressions that failed before these changes. Chat, entities, desktop and mobile type checks,25 lint tasks and direct test formatting pass. No API/database implementation changed, so its existing36-check database verification remains applicable. Only the changed checks were rerun. Live Edit verification remains outstanding before merge. @coderabbitai review |
|
|
|
🤖 The AI agent says: Updated queued-input editing in
Validation:
@coderabbitai review |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Team
Run ID: 1d4e8099-2d81-48b4-bb87-d3cef3dc21b8
⛔ Files ignored due to path filters (1)
web/packages/agenta-api-client/src/generated/api/types/PendingInputAttachment.tsis excluded by!**/generated/**
📒 Files selected for processing (12)
api/oss/src/core/sessions/inputs/dtos.pyapi/oss/src/core/sessions/inputs/service.pyapi/oss/tests/pytest/unit/sessions/test_session_inputs_dao.pyweb/packages/agenta-chat/src/assets/pendingInputs.tsweb/packages/agenta-chat/src/components/QueuedMessagesDock.tsxweb/packages/agenta-chat/src/hooks/useAgentChatQueue.tsweb/packages/agenta-chat/src/hooks/useServerSessionInputs.tsweb/packages/agenta-chat/tests/unit/assets/pendingInputs.test.tsweb/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.tsweb/packages/agenta-chat/tests/unit/hooks/useServerSessionInputs.test.tsweb/packages/agenta-entities/src/session/api/api.tsweb/packages/agenta-entities/src/session/state/pendingInputs.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Current PR diff summary ==='
git diff --stat HEAD^ HEAD
echo
git diff --name-only HEAD^ HEAD
echo '=== Relevant outlines ==='
for f in \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts \
web/packages/agenta-chat/src/hooks/useServerSessionInputs.ts \
web/packages/agenta-chat/src/assets/pendingInputs.ts \
api/oss/src/core/sessions/inputs/service.py \
api/oss/src/dbs/postgres/sessions/inputs/dao.py \
web/packages/agenta-entities/src/session/api/api.ts
do
if [ -f "$f" ]; then
echo "--- $f ---"
ast-grep outline "$f" --items all || true
fi
done
echo '=== Latest diff for relevant implementation files ==='
git diff HEAD^ HEAD -- \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts \
web/packages/agenta-chat/src/hooks/useServerSessionInputs.ts \
web/packages/agenta-chat/src/assets/pendingInputs.ts \
api/oss/src/core/sessions/inputs/service.py \
api/oss/src/dbs/postgres/sessions/inputs/dao.py \
web/packages/agenta-entities/src/session/api/api.ts \
api/oss/src/apis/fastapi/sessions/router.py \
api/oss/src/core/sessions/inputs/dtos.py \
web/packages/agenta-entities/src/session/state/pendingInputs.tsLength of output: 24228 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Queue edit implementation ==='
sed -n '360,485p' web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts
echo '=== Server-session edit implementation ==='
sed -n '175,225p' web/packages/agenta-chat/src/hooks/useServerSessionInputs.ts
echo '=== Attachment ID helper and URL builder ==='
fd -a '^files\.ts$|^transcriptToMessages\.ts$' web/packages/agenta-chat/src -x sh -c '
echo "--- $1 ---"
rg -n -A18 -B4 "attachmentIdForPart|attachmentContentUrl" "$1" || true
' sh {}
echo '=== Pending-input edit service ==='
sed -n '35,155p' api/oss/src/core/sessions/inputs/service.py
echo '=== Generated attachment request type ==='
cat web/packages/agenta-api-client/src/generated/api/types/PendingInputAttachment.ts
echo '=== Focused latest regression tests ==='
rg -n -A65 -B8 \
'attachment_id|attachmentId|server-owned|failed edit|failed.*edit|editingId|duplicate|ambiguous' \
web/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.ts \
web/packages/agenta-chat/tests/unit/assets/pendingInputs.test.ts \
web/packages/agenta-chat/tests/unit/hooks/useServerSessionInputs.test.ts \
api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.pyLength of output: 104292 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Migration lifecycle in useAgentChatQueue.ts ==='
rg -n -A60 -B16 'migrationPromiseRef|migrationRef|migrate|server\.submit|server\.queued' \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts
echo '=== Numbered commitEdit region ==='
nl -ba web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts | sed -n '400,450p'
echo '=== Migration regression test setup with line numbers ==='
nl -ba web/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.ts | sed -n '1060,1250p'Length of output: 15817
Capture the migration object before clearing its refs. Wait for that captured promise before calling You are interacting with an AI system. |
|
🤖 The AI agent says: Addressed CodeRabbit's blank attachment ID finding in
Validation: Ruff format and check passed. All 4 focused queued-attachment edit tests passed against the local Postgres instance. @coderabbitai review |
|
🤖 The AI agent says: @coderabbitai The completed review covers
The only new actionable finding in review5126306272, blank attachment IDs, is fixed and covered by the four passing API checks in Please reconcile the stale risk summary with the current code, or point to a remaining concrete path these fixes do not cover. Final live attachment-delivery QA is still running before merge. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Commit summary and changed files ==='
git show --stat --oneline --decorate --no-renames d68162e06c
git diff d68162e06c^ d68162e06c --name-only
echo '=== Exact commit diff ==='
git diff --no-ext-diff --unified=80 d68162e06c^ d68162e06c -- \
api/oss/src/core/sessions/inputs/dtos.py \
api/oss/src/core/sessions/inputs/service.py \
api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.py
echo '=== DTO and service outlines ==='
ast-grep outline api/oss/src/core/sessions/inputs/dtos.py --items all
ast-grep outline api/oss/src/core/sessions/inputs/service.py --items all
echo '=== DTO, attachment transformation, and relevant tests ==='
nl -ba api/oss/src/core/sessions/inputs/dtos.py | sed -n '1,180p'
rg -n -A100 -B20 'attachment_id|attachmentId|PendingInputAttachment|edit_pending_input_content' \
api/oss/src/core/sessions/inputs/service.py \
api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.pyLength of output: 11843 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Pending-input content transformation ==='
sed -n '35,165p' api/oss/src/core/sessions/inputs/service.py
echo '=== API model and endpoint ==='
sed -n '1,100p' api/oss/src/apis/fastapi/sessions/models.py
rg -n -A45 -B15 'update_pending_input|PendingInputUpdateRequest' \
api/oss/src/apis/fastapi/sessions/router.py
echo '=== All attachment ID conditions and validation ==='
rg -n -i -A8 -B8 'attachment_id|attachmentId' \
api/oss/src/core/sessions \
api/oss/src/apis/fastapi \
api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.py
echo '=== Pydantic version and existing non-whitespace validation patterns ==='
rg -n -A3 -B3 'pydantic' api/oss/pyproject.toml api/oss/requirements*.txt 2>/dev/null || true
rg -n -P -i 'strip.*attachment|attachment.*strip|min_length=1|StringConstraints|constr\(' \
api/oss/src api/oss/tests/pytest | head -n 240Length of output: 66140
You are interacting with an AI system. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Current PR head and relevant changed files ==='
git log -1 --oneline
git diff --name-only HEAD^ HEAD -- \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts \
web/packages/agenta-entities/src/session/api/api.ts \
web/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.ts \
web/packages/agenta-entities/tests/unit/session-continuation-resume-api.test.ts
echo
echo '=== Relevant file outlines ==='
ast-grep outline web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts --items all --match 'commitEdit|migration' || true
ast-grep outline web/packages/agenta-entities/src/session/api/api.ts --items all --match 'updatePendingSessionInput' || true
echo
echo '=== commitEdit and migration lifecycle ==='
rg -n -C 18 \
'commitEdit|migrationPromiseRef|migrationRef|serverOwnsInput|server\.edit|server\.submit' \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts
echo
echo '=== updatePendingSessionInput implementation and validation imports ==='
rg -n -C 12 \
'updatePendingSessionInput|pendingInputResponseSchema|safeParseWithLogging' \
web/packages/agenta-entities/src/session/api/api.ts
echo
echo '=== Focused regression tests ==='
rg -n -C 12 \
'ambiguous|migration|delayed snapshot|failed edit|server-owned|pendingInputResponseSchema|invalid response|safeParse' \
web/packages/agenta-chat/tests/unit/hooks/useAgentChatQueue.test.ts \
web/packages/agenta-entities/tests/unit/session-continuation-resume-api.test.ts
echo
echo '=== Latest diff for the relevant implementations ==='
git diff HEAD^ HEAD -- \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts \
web/packages/agenta-entities/src/session/api/api.tsLength of output: 48282
The migration finding remains in the current code. In
The PATCH can therefore reach the server before the admission request completes. The PATCH can fail with a not-found or conflict response. The required ordering is still to capture the matching migration object first, await or retry that object, and clear its references only after it settles. The delayed-snapshot and ambiguous-failure tests are useful coverage, but the current implementation still permits this specific ordering. You are interacting with an AI system. |
|
🤖 The AI agent says: @coderabbitai The proposed ordering overlooks what establishes
Waiting for or replaying that HTTP promise after committed ownership is observed is the bug this change fixes. PATCH may legitimately refuse an input that another client has since promoted; that refusal keeps the draft and Edit identity rather than admitting a duplicate. When ownership has not been observed, the code still waits for or retries the original migration. I do not find a remaining admission-before-PATCH race in the described sequence. Please account for the committed snapshot boundary when updating the risk assessment. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Frontend queue ownership and edit flow ==='
ast-grep outline web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts --items all --match 'commitEdit|migration|queued' || true
rg -n -C 18 'serverOwnsInput|migrationPromiseRef|migrationRef|commitEdit|server\.edit|server\.submit' \
web/packages/agenta-chat/src/hooks/useAgentChatQueue.ts
echo '=== Snapshot route and pending-input list path ==='
rg -n -C 12 'get_session_snapshot|list_pending' \
api/oss/src/apis/fastapi/sessions/router.py \
api/oss/src/core/sessions/inputs/service.py \
api/oss/src/dbs/postgres/sessions/inputs/dao.py
echo '=== Admission write and transaction lifecycle ==='
rg -n -C 18 'async def (create|submit|enqueue)|transaction|begin|commit|session' \
api/oss/src/core/sessions/inputs/service.py \
api/oss/src/dbs/postgres/shared/engine.py \
api/oss/src/dbs/postgres/sessions/inputs/dao.py
echo '=== Edit lock and update transaction path ==='
rg -n -C 12 'async def update|lock_pending_for_edit|update_content' \
api/oss/src/core/sessions/inputs/service.py \
api/oss/src/dbs/postgres/sessions/inputs/dao.pyLength of output: 106428
Therefore, when A later ✏️ Learnings added
You are interacting with an AI system. |
|
🤖 The AI agent says: Merged the reviewed head Independent review passed. CodeRabbit completed coverage of the final head; its blank-ID finding is fixed, response validation is confirmed, and it withdrew the migration finding after verifying the committed snapshot boundary. Required short CI checks passed with no failures at merge. Focused verification passed: 74 frontend checks, four database-backed attachment checks, formatting/lint/types/client build, and 12 final live assertions. A lost successful Edit response retained the draft; retry preserved the same queued row and two distinct files. Mobile Send Now delivered both original and added files, real tool reads verified their contents, and both clients finished idle. Staging deployment and a focused check of the deployed release are next. This fix introduces no migration. Production remains untouched. |
|
🤖 The AI agent says: Final staging verification passed on release The final browser journey passed 14 assertions on desktop and the actual The broad Railway acceptance run was interrupted by automatic preview cleanup after merge, so it is not claimed fully green. Its relevant attachment send/render/reload test passed. An earlier generic-playground Error had no retained network cause; it is outside this change. Final staging also exposed an existing find/fd flag incompatibility; the agent recovered using ls/read and both clients displayed the failed tool. That unrelated runner observation is recorded for follow-up. The requested focused release checks are complete. Production remains untouched and the release PR remains open for the user's later deployment. These follow-up fixes add no migration. |
Context
Queued messages lost their Edit action when the queue moved to the server. Users could remove a message or send it immediately, but could not correct its text while preserving its place.
Changes
Restore editing on desktop and mobile. Saving updates the existing queued message, preserving its ID, position and existing attachments. New attachments are appended without duplicating them on retry. A message that has already started or been selected for Send Now cannot be edited. Failed saves retain the draft, and Cancel editing remains available if the row leaves the queue.
Remove the Steer and attachment-count text badges. Keep attachment tiles and the Send Now action; after clicking it, the button reads Sending. Save the component examples in the existing tracked Storybook story.
How to review
Start with the pending-input update service and transaction, then the shared queue hook and both composer integrations. The existing admission fingerprint stays unchanged so a retry of the original message cannot recreate or overwrite the edited row.
Tests
The original database suite passed 36 checks. The final attachment correction passes four focused database-backed checks and 74 frontend tests; Ruff, 25 frontend lint tasks, chat/entity type checks and the generated client build pass. The Storybook build includes all 10 queue stories. Live desktop and mobile checks passed text editing, draft restoration, failed-save retry, row identity/order, Send Now and final idle. The final live attachment check passed all 12 assertions: a lost save response and normal retry preserved the row and both files without duplicates; both files were delivered and read by the runner, and desktop/mobile finished idle. CodeRabbit completed review of the final commit, its blank-ID finding is fixed, and it withdrew the earlier migration finding after verifying the committed snapshot boundary. Staging verification remains after merge. This PR adds no migration.
What to QA