Skip to content

fix(cosh-ng): [shell] review marked on enter - #2274

Open
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/cosh-ng/session-marked-enter-clear
Open

fix(cosh-ng): [shell] review marked on enter#2274
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/cosh-ng/session-marked-enter-clear

Conversation

@kongche-jbw

Copy link
Copy Markdown
Collaborator

Why

Marking sessions for clear and pressing Enter resumed the focused session
instead of entering the clear-confirmation flow. This contradicted the picker
state and could select a session when the user intended to clear marked items.

What changed

  • Normalize Enter to the existing delete action when the picker has clear marks.
  • Keep unmarked Enter resume behavior and show state-aware picker hints.
  • Replace the old resume contract with marked-clear and unmarked-resume coverage.

Related issue

closes #1709

User / Agent impact

With marked sessions, Enter now opens clear confirmation and a second Enter or
y performs the clear. Without marks, Enter continues to resume the focused
session.

Risk and compatibility

  • Public CLI, API, configuration, or documented behavior changed

The interactive Enter behavior changes only while clear marks exist. Existing
protection filtering, multi-select clearing, confirmation, and d behavior are
reused unchanged.

Validation

  • cargo fmt --all -- --check
  • cargo test --package cosh-shell --lib (1278 passed)
  • cargo test --package cosh-shell --test logic (9 passed)
  • cargo test --package cosh-shell --test raw_cli session::raw_cli_session_picker_space_then_enter_confirms_and_deletes_without_resuming -- --exact
  • crates/cosh-shell/scripts/check-layout.sh

Documentation and rollback

No standalone documentation changes are required because the picker footer is
updated with the behavior. Revert commit cb1e6fef to restore the previous
Enter behavior.

@kongche-jbw
kongche-jbw requested a review from SunnyQjm as a code owner August 6, 2026 10:38
@github-actions github-actions Bot added the component:cosh-ng src/cosh-ng label Aug 6, 2026

@qoderai qoderai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] 标记状态下 Enter 归一化逻辑过于依赖 pending_panel 匹配,部分场景仍可能误触发 resume,建议基于 selected_for_clear 显式覆盖 Enter 的行为路径。


🤖 Generated by QoderView workflow run

Comment thread src/cosh-ng/crates/cosh-shell/src/slash/session/panel.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb1e6fef55

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cosh-ng/crates/cosh-shell/src/slash/session/panel.rs Outdated
@kongche-jbw
kongche-jbw force-pushed the fix/cosh-ng/session-marked-enter-clear branch from cb1e6fe to f579a19 Compare August 6, 2026 10:53
- Emit marked Enter as non-releasing delete at the raw capture source.
- Keep unmarked resume behavior and make picker hints state-aware.
- Cover capture ownership and width-agnostic picker rendering.

Fixes: 0e8ca63 ("feat(cosh-ng): add interactive session recovery")
Signed-off-by: kongche-jbw <kongche.jbw@alibaba-inc.com>
@kongche-jbw
kongche-jbw force-pushed the fix/cosh-ng/session-marked-enter-clear branch from f579a19 to e09c401 Compare August 6, 2026 11:37
@kongche-jbw

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e09c4017c3

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +630 to +631
if *has_clear_marks {
return Some(RawInputEvent::SessionDelete(id.clone()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Re-evaluate Enter after queued mark toggles

When Space and Enter arrive in one raw-input read, as can happen with fast typing or pasted input, consume_split first queues SessionToggle but submit still consults this immutable pre-toggle has_clear_marks value. Starting unmarked therefore queues a toggle followed by SessionResume, so the main loop marks the row and then closes the picker by resuming it—the exact unintended action this change is meant to prevent; unmarking the final row and pressing Enter in the same read has the inverse stale-state problem. Defer Enter until the toggle has updated the capture, or track the effective mark state while consuming the chunk.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cosh-ng] bug: /session 中 Space 标记会话后按 Enter 实际 resume 而非 clear,违反 footer 'Space mark for clear' 语义

1 participant