Skip to content

refactor(site): prepare the composer for queued message edits - #29553

Merged
mafredri merged 5 commits into
mainfrom
mathias/codagt-971-fe-1-refactors
Oct 30, 2026
Merged

mafredri merged 5 commits into
mainfrom
mathias/codagt-971-fe-1-refactors

Conversation

@mafredri

@mafredri mafredri commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Prepares the composer for editing queued messages. No behavior changes.

The edit state is an EditingTarget with a kind and an id. History rows and queued rows have separate ID spaces, so kind says which one id belongs to; #29555 adds the queued kind. getEditableContentPayload is extracted so the queued save path can reuse it, submitChatTurn takes an EditingTarget in place of a history message ID, and the queued row actions share one QueuedMessageActionButton and one runAction helper.

For review: unit tests in messageParsing.test.ts pin the cases the inline code of getEditableContentPayload handled. QueuedMessagesList.test.ts becomes .test.tsx and gains render tests of the shared action runner and of each row action forwarding its row ID. useConversationEditingState.test.ts gains a test that an edit does not overwrite the persisted draft. ChatPageContent.test.ts is merged into ChatPageContent.test.tsx, because while both basenames existed, tsc -p . checked only the .ts file and the .tsx file had stale props without a type error.

Part of the CODAGT-971 frontend stack: 1 of 3.

🤖 This PR was created with the help of Coder Agents on behalf of @mafredri, and will be reviewed by a human. 🏂🏻

@linear-code

linear-code Bot commented Sep 18, 2026

Copy link
Copy Markdown

CODAGT-971

@mafredri

This comment has been minimized.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T12:05:15.549846Z b6d63ca Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

This comment has been minimized.

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems mostly fine. readability of the code isn't the best though. classic LLMs

@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 2 times, most recently from 4964ae5 to 553ea3a Compare September 18, 2026 14:05
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 4 times, most recently from e692db1 to 29a4bc9 Compare September 21, 2026 23:07
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 29a4bc9 to 2b463bf Compare September 22, 2026 14:01
@mafredri
mafredri marked this pull request as ready for review September 23, 2026 11:28
@coder coder deleted a comment from coder-agents-review Bot Sep 23, 2026
@mafredri

This comment has been minimized.

@coder-agents-review

coder-agents-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review in progress (1/1 reviewers complete) | View chat
Requested: 2026-09-23 13:11 UTC by @mafredri

deep-review v0.9.0 | Round 1 | b1c103e..2b463bf

Last posted: Round 1, 6 findings (1 P2, 2 P3, 3 Note), COMMENT. Review

Finding inventory

Finding inventory: PR #29553

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P2 Open ChatPageContent.test.tsx:38 Test still passes removed isEditing/onCancelHistoryEdit props, renders edit mode; tsc skips the file (basename collision with .test.ts) R1 Netero Yes
CRF-2 P3 Open AgentChatPageView.tsx:95 editingMessageId duplicates editingTarget across hook, view type, and story builder R1 Netero Yes
CRF-3 P3 Open QueuedMessagesList.tsx:79 Span-hosted tooltip on disabled action button is untested; #29555 relies on it R1 Netero Yes
CRF-4 Note Open QueuedMessagesList.tsx:81 Non-focusable span keeps disabled-action tooltip pointer-only and moves aria-describedby off the button R1 Netero Yes
CRF-5 Note Open AgentChatInput.tsx:427 editingKind only compared to undefined; history-specific header text and label gate on a kind-agnostic flag R1 Netero Yes
CRF-6 Note Open QueuedMessagesList.tsx:79-99 "No behavior changes" claim is inaccurate: disabled queued actions now show tooltips on hover R1 Netero Yes

Contested and acknowledged

None.

Round log

Round 1

Netero-only (P2 gate). 1 P2, 2 P3, 3 Note. Law not run (effective additions 358). Orchestrator reproduced CRF-1: tsc -p . --listFilesOnly omits ChatPageContent.test.tsx, and checking it alone fails with TS2322 on isEditing. Reviewed against b1c103e..2b463bf.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First-pass review only. These are mechanical findings from Netero. The full review panel has not reviewed this PR yet; it will review once these findings are addressed.

The EditingTarget rename is otherwise complete: Netero's grep for every old name (handleEditUserMessage, handleCancelHistoryEdit, isEditingHistoryMessage, busyItem, and the rest) found one stale caller. Netero's mutation runs show the new tests pin real behavior: the draft-guard test fails when the editingTarget !== null guard is removed, and the pending/restore test fails when restoreHiddenItem is removed.

1 P2, 2 P3, 3 Notes. The P2 is that one stale caller. ChatPageContent.test.tsx still passes the removed props, and tsc -p . never checks the file because it shares a basename with ChatPageContent.test.ts, so CI stays green while the fixture silently switches to edit mode.

"Until the pair is split, any future prop change breaks this test just as silently." (Netero)


site/src/pages/AgentsPage/components/ChatPageContent.test.tsx:38

P2 [CRF-1] This test still passes the removed isEditing={false} and onCancelHistoryEdit props, so it now renders ChatPageInput in edit mode, and no type check reports it. (Netero)

At runtime editingTarget is undefined, so const isEditing = editingTarget !== null (+ChatPageContent.tsx:439) is true. The fixture that used to render compose mode now picks editAttachments and the edit-mode reset paths, and the test name says nothing about editing.

ChatPageContent.test.ts and ChatPageContent.test.tsx share a basename, and TypeScript's include expansion keeps only the higher-priority .ts file.

I reproduced both halves. tsc -p . --listFilesOnly in site/ lists ChatPageContent.test.ts and omits the .tsx. Type-checking the .tsx on its own (plus src/@types/*.d.ts) fails with TS2322 ... Property 'isEditing' does not exist on type 'IntrinsicAttributes & ChatPageInputProps'. Edit mode also drops slashCommands (ChatPageContent.tsx:631), so the Stop test now runs against the edit-mode composer rather than compose mode.

Fix lines 38-39 with editingTarget={null} and onCancelEdit={vi.fn()}. Merging ChatPageContent.test.ts into the .tsx file (or renaming one of them) lets pnpm lint:types check both, so the next prop rename cannot repeat this.

🤖

🤖 This review was automatically generated with Coder Agents.

aiGatewayDisabled,
slashCommands,
}) => {
const isEditingMessage = editingKind !== undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note [CRF-5] editingKind is only compared against undefined, so kind-specific UI now depends on a kind-agnostic flag. (Netero)

isEditingMessage gates the header text "Editing will delete all subsequent messages and restart the conversation here." (AgentChatInput.tsx:1148-1153) and the "Save Edit" label. Both describe history edits. With EditingTarget limited to { kind: "history" } this is correct today. Once #29555 adds queued, that text would show for queued edits unless the header branches on editingKind.

🤖

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change here. This PR has only the history kind, so the header text is correct for every edit it can show. #29555 adds queued and branches the banner on it in AgentChatInput.tsx (editingKind === "queued" ? "Editing a queued message. It is not sent until you save or cancel." : ...). "Save Edit" applies to both kinds.

🤖 Posted using /amend-review skill via Coder Agents.

@mafredri

Copy link
Copy Markdown
Member Author

In reply to CRF-1 (P2, site/src/pages/AgentsPage/components/ChatPageContent.test.tsx:38): #29553 (review)

Fixed in 909a43f. The test passes editingTarget={null} and onCancelEdit={vi.fn()}, and ChatPageContent.test.ts is merged into ChatPageContent.test.tsx. tsc -p . --listFilesOnly now lists the .tsx, and restoring isEditing={false} fails with TS2322. No other .test.ts/.test.tsx basename pair exists under site/src.

🤖 Posted using /amend-review skill via Coder Agents.

@mafredri
mafredri requested a review from a team as a code owner September 28, 2026 19:36
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 909a43f to 6f130fc Compare September 28, 2026 20:52
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 6f130fc to cf64adf Compare October 2, 2026 13:43
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 4eb6d33 to 0113e76 Compare October 21, 2026 12:33
@github-actions github-actions Bot removed the stale This issue is like stale bread. label Oct 22, 2026
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 2 times, most recently from 8262555 to 3dde166 Compare October 22, 2026 10:40
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 2 times, most recently from f331080 to a2c60b0 Compare October 27, 2026 13:53
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 2 times, most recently from 4c2d66f to ad210c5 Compare October 29, 2026 10:07
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch 2 times, most recently from 81e09bd to d17a0ff Compare October 29, 2026 11:27
@mafredri
mafredri removed this pull request from stack #29557 October 30, 2026 11:39
@mafredri
mafredri added this pull request to stack #31570 October 30, 2026 11:41
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from d17a0ff to 790d6db Compare October 30, 2026 12:23
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 790d6db to 408b7f6 Compare October 30, 2026 13:10
Base automatically changed from mathias/codagt-971-queue-hold-backend to main October 30, 2026 13:52
Edit state is an EditingTarget, { kind: "history"; id }, so a second
kind can be added without touching every consumer. submitChatTurn takes
the target and handles the history kind. Extracted helper:
getEditableContentPayload (text and editable attachments from message
parts). The queued row actions share one QueuedMessageActionButton and
one runAction that hides the row optimistically and restores it on
failure.

No behavior changes.
ChatPageContent.test.tsx still passed the removed isEditing and
onCancelHistoryEdit props, which left editingTarget undefined and put
the composer in edit mode. tsc never saw the file because it shares a
basename with ChatPageContent.test.ts and include expansion keeps the
.ts. Merging the two files puts the tests under the type check.

editingMessageId was derived from editingTarget and carried next to
it through the hook, the view props, and the story builder. The
timeline is its only reader, so the view derives it there.

The action buttons no longer sit inside a span, so a disabled button
shows no tooltip, as on main.
…r popovers

React bubbles keydown from the portaled MCP and model popovers through
the composer, so the Escape that closed a popover also cancelled the
edit or interrupted the streaming turn.
@mafredri
mafredri force-pushed the mathias/codagt-971-fe-1-refactors branch from 408b7f6 to 2573f7a Compare October 30, 2026 13:52
@mafredri
mafredri merged commit 190ab6e into main Oct 30, 2026
25 checks passed
@mafredri
mafredri deleted the mathias/codagt-971-fe-1-refactors branch October 30, 2026 14:05
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants