Skip to content

fix(sessions): confirm the rename dialog on Enter - #6011

Merged
ashrafchowdury merged 10 commits into
Agenta-AI:release/v0.114.1from
MFA-G:fix/rename-session-enter-key
Aug 25, 2026
Merged

fix(sessions): confirm the rename dialog on Enter#6011
ashrafchowdury merged 10 commits into
Agenta-AI:release/v0.114.1from
MFA-G:fix/rename-session-enter-key

Conversation

@MFA-G

@MFA-G MFA-G commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #5951.

Summary

What changed: the "Rename session" dialog now confirms on Enter.

Why: it is a modal with a single text field, so Enter is the obvious way to confirm it — but nothing happened. The dialog stayed open and the name was unchanged, and the only way out was reaching for the mouse and clicking Rename.

Root cause: the <Input> inside modal.confirm in useSessionActions.rename had no onPressEnter, and antd's Modal.confirm does not submit on Enter by itself — there is no <form> wrapping the field, and the OK button is not the focused element.

The fix (web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx):

  • The rename body is extracted into a submit closure, and onOk now is that closure — so the Enter path and the button path cannot drift.
  • onPressEnter on the Input destroys the dialog and runs submit(), which is exactly what a button click does (antd closes the modal itself on onOk).
  • A blank/whitespace-only name is ignored and the dialog stays open, matching what onOk already did.

No change to the cached-vs-remote branching, the error toast, or the revalidation.

Testing

Verified locally

Mounted the real hook in a browser against a stubbed setSessionHeader and drove it with a genuine Chrome key press (not a synthetic event), on the branch and on main:

dialog closes session name request
main ✗ no Untitled session (unchanged) none
this branch ✓ yes Pricing agent QA PATCH /sessions/session-1 → name: "Pricing agent QA"

Also ran:

pnpm exec vitest run src/components/AgentChatSlice   # 35 files, 374 passed, 1 skipped
pnpm exec eslint <both files>                        # clean
pnpm exec prettier --check <both files>              # unchanged

Added or updated tests

web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx — two cases:

  • Enter with an edited name calls setSessionHeader with the trimmed name and closes the dialog.
  • Enter on a whitespace-only name calls nothing and leaves the dialog open.

Rendered with react-dom/client rather than a testing library (the repo has no @testing-library/react, per the note in ApprovedContentManifest.test.tsx); modal.confirm renders into document.body, so the assertions read the real DOM either way.

Verified the test actually catches the regression: reverting only the hook change makes the first case fail, and it passes with the fix in place.

QA follow-up

Worth a click-through of the rename entry point on both surfaces that use this hook — the sessions list and the playground's session bar — to confirm Enter and the Rename button behave identically, including on a session that is in the local tab cache (the atom path, which the harness above did not exercise; the unit test and the recording both take the remote path). Escape still cancels.

Demo

Same flow, same key press, main vs. this branch.

Before (main) — Enter does nothing, the dialog stays open:

Before: pressing Enter in the rename dialog does nothing

After (this branch) — Enter confirms, the dialog closes and the rename is sent:

After: pressing Enter confirms the rename and closes the dialog

Both clips render the real useSessionActions hook; only setSessionHeader is stubbed, and it prints the request it would send.

Checklist

  • I have included a video or screen recording for UI changes, or marked Demo as N/A
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

The Rename session modal has a single text field, but Enter did nothing:
the only way to confirm was clicking the Rename button.

Wire onPressEnter on the Input to the same submit path as onOk, closing
the dialog first so the flow matches a button click. A blank name is
ignored, exactly as onOk already did.

Fixes Agenta-AI#5951
Copilot AI lite review requested due to automatic review settings August 13, 2026 13:22
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 13, 2026
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@MFA-G is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

✅ Thanks @MFA-G! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon.

@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ bekossy
✅ ashrafchowdury
❌ MFA-G
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the incomplete-pr PR is missing required template sections or a demo recording label Aug 13, 2026
@github-actions github-actions Bot closed this Aug 13, 2026

Copilot AI 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.

Pull request overview

This PR fixes the session rename UX in the Agent Chat slice by making the “Rename session” confirm modal submit via the Enter key (in addition to the Rename button), and adds a focused DOM-level test to prevent regressions.

Changes:

  • Refactors the rename confirm modal to share a single submit handler between the OK button and keyboard submission.
  • Adds onPressEnter to the modal input so Enter triggers rename.
  • Introduces a new Vitest test covering Enter-to-confirm and blank-name behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx Adds an Enter key handler to the rename modal input and refactors the submission logic into a shared closure.
web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx Adds DOM-level tests validating the Enter key contract for the rename modal.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +118 to +126
onPressEnter={() => {
if (!next.trim()) return
dialog.current?.destroy()
void submit()
}}
/>
),
okText: "Rename",
onOk: async () => {
const title = next.trim()
if (!title) return
if (isCached(target) && target.appId) {
await store.set(renameSessionAtomFamily(target.appId), {
id: target.sessionId,
title,
})
} else {
const ok = await setSessionHeader({
sessionId: target.sessionId,
projectId,
name: title,
})
if (!ok) {
message.error("Couldn't rename this session")
return
}
}
revalidate()
},
onOk: submit,
Comment on lines +71 to +79
const host = document.createElement("div")
document.body.appendChild(host)
await act(async () => {
createRoot(host).render(
<App>
<Probe />
</App>,
)
})
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 926e424c-78e0-420b-a9dd-2a954dad80d5

📥 Commits

Reviewing files that changed from the base of the PR and between 0378eaf and f7aec58.

📒 Files selected for processing (2)
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Session names can be submitted by pressing Enter in the rename dialog.
    • Names are trimmed before submission.
    • The dialog closes after a successful rename and preserves entered text when renaming fails.
  • Bug Fixes

    • Blank names cannot be submitted.
    • The Rename button is disabled when the name is blank.
    • Rename actions now show loading and cancellation states.
  • Tests

    • Added coverage for validation, keyboard submission, failure recovery, loading behavior, and button states.

Walkthrough

The session rename dialog now supports Enter-key confirmation. Shared submission logic validates names, manages loading and modal state, preserves failed edits, and updates the session. Tests cover successful, blank, pending, failed, and button-state behavior.

Changes

Session rename behavior

Layer / File(s) Summary
Shared rename submission and Enter handling
web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx
The hook centralizes rename validation, asynchronous state, failure recovery, and modal handling. Enter and the Rename button submit trimmed, nonblank names through the shared handler.
Rename behavior validation
web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx
Tests verify trimmed submission, blank-name rejection, loading behavior, success closure, failed submission recovery, portal cleanup, and Rename-button state changes.

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

Merge Risk: 🔵 Low · up to f7aec

The rename dialog now confirms a trimmed nonblank name when Enter is pressed, while blank names keep the dialog open. The change is mergeable with owner awareness that the repository-required frontend lint-fix command should still be run before merge.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RenameDialog
  participant useSessionActions
  participant RenameAction
  User->>RenameDialog: Press Enter or click Rename
  RenameDialog->>useSessionActions: Submit edited name
  useSessionActions->>RenameAction: Rename with trimmed name
  RenameAction-->>useSessionActions: Resolve or reject
  useSessionActions->>RenameDialog: Close on success or preserve edits on failure
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #5951 by confirming the rename on Enter and closing the dialog after a successful rename.
Out of Scope Changes check ✅ Passed The validation, loading, error, duplicate-submission, and test changes support the rename confirmation objective and are not out of scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely identifies the primary change: pressing Enter confirms the session rename dialog.
Description check ✅ Passed The description directly explains the Enter-key rename fix, its root cause, implementation, tests, and verification results.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 removed the incomplete-pr PR is missing required template sections or a demo recording label Aug 13, 2026
@github-actions github-actions Bot reopened this Aug 13, 2026
@mmabrouk

Copy link
Copy Markdown
Member

@MFA-G thank you for the PR, please sign the CLA for us to be able to merge it. Thanks! Also don't forget to address the comments

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved conditioned by the comment above

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 13, 2026
Address review: the Enter path guarded a blank name but onOk did not, so
the two confirmation paths could drift. The Rename button is now disabled
while the field is blank, which is the same condition Enter checks, and
the test unmounts its React root in afterEach like ProjectWatch.test.tsx.
Copilot AI review requested due to automatic review settings August 14, 2026 01:21
@MFA-G

MFA-G commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mmabrouk and @copilot — both review comments addressed in 1e60d09.

1. Blank-name guard could drift between Enter and the Rename button. The Enter handler checked !next.trim() but onOk: submit did not, so the two confirmation paths were only accidentally consistent (submit bailed internally, but the button still closed the modal). Rather than duplicating the guard, the button is now disabled while the field is blank, driven by the same predicate Enter checks:

const isBlank = () => !next.trim()
...
onChange={(event) => {
    next = event.target.value
    dialog.current?.update({okButtonProps: {disabled: isBlank()}})
}}
onPressEnter={() => {
    if (isBlank()) return
    ...
}}
okButtonProps: {disabled: isBlank()},

That also makes the constraint visible to the user instead of a silent no-op on click.

2. Leaked React root in the test. mountRename now keeps the Root and container in module scope and afterEach unmounts + removes them, matching ProjectWatch.test.tsx.

Also added a third test asserting the button's disabled state tracks the field (enabled → blank disables → typing re-enables), so the two paths can't drift again.

npx vitest run src/components/AgentChatSlice/hooks/useSessionActions.test.tsx → 3 passed.

Re: the CLA — I'll get that signed.

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx (1)

105-109: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten the new implementation comments.

  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx#L105-L109: Remove the explanation or reduce it to one short line. The shared predicate makes the intent clear.
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx#L38-L44: Reduce the mock-path explanation to one short line.

As per coding guidelines: “Keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: cc7baf54-8227-4049-b9d2-09da172d187d

📥 Commits

Reviewing files that changed from the base of the PR and between 728f39f and 1e60d09.

📒 Files selected for processing (2)
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx

The blank-name cases deliberately leave the confirm dialog open, and root.unmount() does not close it: modal.confirm instances live in antd's global destroy registry, not the React root. Call Modal.destroyAll() before unmounting so no dialog leaks into the next test.
Copilot AI review requested due to automatic review settings August 14, 2026 07:45
@MFA-G

MFA-G commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @coderabbitai — good catch, fixed in 4e43bed.

You're right that root?.unmount() doesn't reach the confirm dialogs: modal.confirm instances register their close callback in antd's global destroy registry rather than being owned by the React root, so the two blank-name tests (which deliberately leave the dialog open) were leaving live instances behind. afterEach now calls Modal.destroyAll() inside the same act() before unmounting.

Suite still green: vitest run src/components/AgentChatSlice/hooks/useSessionActions.test.tsx → 3 passed.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@MFA-G Thanks for the fix and the detailed explanation. Calling Modal.destroyAll() inside act() cleans up the global Ant Design confirm dialogs that remain open in the blank-name tests.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx:99

  • The test dispatches a KeyboardEvent using the deprecated keyCode field and an as never cast to satisfy typing. This is brittle and unnecessary here; key/code are sufficient for antd’s Enter handling and keep the test type-safe.
    await act(async () => {
        input.dispatchEvent(
            new KeyboardEvent("keydown", {key: "Enter", keyCode: 13, bubbles: true} as never),
        )
    })

web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx:130

  • onPressEnter destroys the confirm immediately and then runs submit(). This bypasses Modal.confirm’s normal onOk promise lifecycle (e.g., keeping the modal open + showing the OK button loading state while the async rename runs), so Enter won’t behave the same as clicking Rename.
                        onPressEnter={() => {
                            if (isBlank()) return
                            dialog.current?.destroy()
                            void submit()
                        }}

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx:152

  • The onChange handler updates okButtonProps without preserving the loading flag set by the Enter path (confirm()), so typing while a rename is pending will clear the loading state and can re-enable the OK button even though the request is still in-flight.
                        onChange={(event) => {
                            next = event.target.value
                            dialog.current?.update({okButtonProps: {disabled: isBlank()}})

web/oss/src/components/AgentChatSlice/hooks/useSessionActions.test.tsx:98

  • pressEnter() dispatches the key event inside act(), but it doesn't wait for the async rename started by onPressEnter={() => void confirm()} to settle. Assertions immediately after await pressEnter(...) can race with the modal updates / destroy, making the tests flaky.
const pressEnter = async (input: HTMLInputElement) => {
    await act(async () => {
        input.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true}))
    })
}

Comment on lines +79 to +99
const submit = async () => {
const title = next.trim()
if (!title) return
if (isCached(target) && target.appId) {
await store.set(renameSessionAtomFamily(target.appId), {
id: target.sessionId,
title,
})
} else {
const ok = await setSessionHeader({
sessionId: target.sessionId,
projectId,
name: title,
})
if (!ok) {
message.error("Couldn't rename this session")
return
}
}
revalidate()
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — fixed in f7aec58.

You were right on both counts, and the second one was the worse bug: onOk: submit meant the button path had the same problem, not just Enter. A failed rename closed the dialog and threw the typed name away behind an error toast.

submit() now rejects instead of returning on failure. While wiring that up, returning the rejection from onOk turned out to be the wrong lever: antd's ActionButton re-raises a rejected onOk as an unhandled rejection (_util/ActionButton.js, the Promise.reject(e) branch), which vitest flags as an unhandled error even though the dialog behaves correctly. So the OK button now confirms through the same confirm() helper as Enter, via okButtonProps.onClick — antd spreads okButtonProps over its own handler, so this replaces it. One lifecycle, one in-flight guard, one failure path for both.

Two tests were added, both of which fail on the previous commit:

 ✓ confirms on the Rename button with the edited name
 × keeps the dialog open when the rename fails, confirmed with Enter
 × keeps the dialog open when the rename fails, confirmed with the Rename button

and pass now:

 Test Files  1 passed (1)
      Tests  7 passed (7)

eslint clean on both files; tsgo --noEmit reports nothing for them.

submit() returned normally when setSessionHeader() reported failure, so
both confirmation paths treated a failed rename as a success: the button's
onOk closed the dialog, and Enter's catch block never ran, discarding the
typed name behind an error toast.

submit() now rejects on failure. The OK button confirms through the same
confirm() helper as Enter rather than through onOk, because onOk's only
way to hold the dialog open is a rejected promise, which antd re-raises
as an unhandled rejection.
Copilot AI review requested due to automatic review settings August 15, 2026 13:16
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 15, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Hi @MFA-G, thanks for the thorough work here — the bug is real, your root-cause write-up is spot on, and the tests are great. 🙌

My main ask is to simplify. The issue is just "Enter should confirm the rename," but this rebuilds the whole dialog submit flow by hand: a pending guard, manual loading-button state, replacing antd's onOk with a custom okButtonProps.onClick, and the failure-retention logic. That's a lot of antd-internal surface to maintain, and it can break on antd upgrades.

Could you trim it to the minimal fix — keep antd's built-in onOk for submit/loading/failure, and just have onPressEnter run that same path? The extra states (in-flight guard, keep-open-on-error, etc.) feel out of scope for this issue. Happy to help think through the smallest version if useful.

Confirming through antd's own OK button keeps submit, the loading state
and close-on-success on the existing onOk path instead of reimplementing
them for the keyboard.
Copilot AI review requested due to automatic review settings August 17, 2026 13:17
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 17, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MFA-G

MFA-G commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @ashrafchowdury — you're right, and it's trimmed in aff223d.

I'd been chasing "Enter must behave exactly like the button" by rebuilding the button's behaviour, when the simpler answer is to just press the button. onOk, okButtonProps, and the whole submit extraction are gone; onOk is byte-for-byte what it was on main again. The entire production diff is now:

const okClass = "rename-session-ok"
...
onPressEnter={(event) =>
    event.currentTarget
        .closest('[role="dialog"]')
        ?.querySelector<HTMLButtonElement>(`.${okClass}`)
        ?.click()
}
...
okButtonProps: {className: okClass},

16 added lines, no antd internals touched — the loading state, close-on-success, and the double-submit guard all come from antd's own ActionButton (it keeps a clickedRef that already ignores repeat clicks while a submit is in flight, which is the in-flight guard I'd hand-rolled). The blank-name case also goes back to onOk's original if (!title) return.

One note on why it's a marker class rather than a ref: ActionButton spreads buttonProps and then sets ref: buttonRef after it, so an okButtonProps.ref is overwritten and never populated. The class is the only handle antd leaves open, and the lookup is scoped to the dialog the input is inside.

Tests are down from 6 to 4 — the two that only existed to pin the hand-rolled state machine (keep-open-on-error, blank-name disabled button) are dropped. What's left covers the actual contract: Enter submits the edited name, Enter ignores a blank name, Enter goes through onOk (button shows ant-btn-loading while in flight, dialog closes on resolve), and the button path still works. All 4 fail against main and pass here.

vitest run useSessionActions.test.tsx → 4 passed. ESLint and prettier clean.

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for the pr. i found one thing that needs a change before qa.

const input = renameInput()
await type(input!, " ")
await pressEnter(input!)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This only proves that a blank Enter does not send a rename request. Enter now clicks the OK button, and onOk is async, so the blank return resolves and Ant Design closes the modal. That breaks the stated contract that a blank name leaves the dialog open. Please assert renameInput() is still present here and make the blank OK path keep the modal open.

Disable the Rename button while the field is blank, so both Enter (which
clicks it) and the button itself are no-ops and leave the dialog up.
Copilot AI review requested due to automatic review settings August 18, 2026 07:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MFA-G

MFA-G commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mmabrouk — you are right, fixed in 409f1be.

Enter clicks the Rename button, and onOk is async, so the blank return resolved and antd closed the modal — the blank path only looked correct because the old test asserted no request was sent, not that the dialog survived.

Rather than special-casing the blank return, the button that performs the rename is now disabled while the name is blank. Enter clicks that button, so both paths become no-ops from the same condition and the dialog stays open:

const okButtonProps = () => ({className: okClass, disabled: !next.trim()})
...
onChange={(event) => {
    next = event.target.value
    dialog.update({okButtonProps: okButtonProps()})
}}

Tests now assert the contract you asked for, on both paths:

  • blank + Enter → no request, renameInput() still present, Rename disabled; then typing a name re-enables it and Enter submits and closes.
  • blank + Rename click → no request, dialog still open.

One test-harness fix was needed for the recovery assertion: rc-input locks Enter between keydown and keyup, so the keydown-only helper silently no-opped on a second press. pressEnter now dispatches keyup too.

vitest run src/components/AgentChatSlice/hooks/useSessionActions.test.tsx → 5 passed. prettier --check and eslint clean on both files.

@bekossy
bekossy changed the base branch from main to release/v0.112.2 August 19, 2026 10:09
@ashrafchowdury
ashrafchowdury changed the base branch from release/v0.112.2 to main August 25, 2026 11:41
Main moved the session verbs into @agenta/sessions-ui, so the Enter fix moves
with them and the app hook goes back to main's thin adapter.

Two things the rename would have silently lost in the new renderer:

- The confirm is now a Radix AlertDialog (`role="alertdialog"`), so the
  `[role="dialog"]` lookup that reaches the OK button found nothing.
- `Input` from @agenta/ui/ui is a native control and does not take antd's
  `onPressEnter`, so the handler was dropped on the floor. It is `onKeyDown`
  now.

The suite moves to the package with it, retargeted at the marker class and
`data-loading` instead of antd's button classes, and dismisses leftover
confirms in teardown (the store is module-global and there is no
`Modal.destroyAll` any more). Needs the JSX transform the other .tsx suites
use.
Copilot AI review requested due to automatic review settings August 25, 2026 11:53

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@ashrafchowdury
ashrafchowdury changed the base branch from main to release/v0.114.1 August 25, 2026 11:54
@ashrafchowdury
ashrafchowdury merged commit 2a939bc into Agenta-AI:release/v0.114.1 Aug 25, 2026
3 of 5 checks passed
@ashrafchowdury

Copy link
Copy Markdown
Contributor

Thank you for the PR @MFA-G

@all-contributors please add @MFA-G for code

@allcontributors

Copy link
Copy Markdown
Contributor

@ashrafchowdury

I've put up a pull request to add @MFA-G! 🎉

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

Labels

bug frontend lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(bug) The rename session dialog ignores Enter and only confirms on the button

6 participants