Skip to content

Fixed the edit-mode selector with Claude Code 2.1.x - #195

Merged
oleg68 merged 4 commits into
nbplugins:mainfrom
oleg68:bugfix/edit-mode-selector-cycling
Oct 18, 2026
Merged

oleg68 merged 4 commits into
nbplugins:mainfrom
oleg68:bugfix/edit-mode-selector-cycling

Conversation

@oleg68

@oleg68 oleg68 commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #193 (rebased onto current main, review comments addressed). Original work by @Rizky92 — their commit is kept with authorship.

Problem

  • Claude Code 2.1.x renders ● high · /effort below the mode footer line, so the mode was never detected when idle and the combo jumped to "Ask on Edit".
  • A second mode request during a running switch started a second Shift+Tab worker, and the two cycled endlessly.

Fix

  • ScreenContentDetector.detectEditMode: after the bottom-most line, falls back to the 2 lines above, only if they start with ⏸/⏵. Old layouts are checked first, with unchanged rules.
  • ClaudeSessionController: single worker with a retargetable editModeSwitchTarget.

Review fixes (on top of the original commit)

  • Worker also catches RuntimeException, so the in-progress flag is never stuck (new test).
  • Retarget test made deterministic with a CountDownLatch.
  • sendShiftTab() no longer clears modeSwitchInProgress while a worker owns it.
  • Capture script exits with a clear message if claude is not on PATH.

mvn package: 1140 tests, 0 failures.

🤖 Generated with Claude Code

Rizky92 and others added 2 commits October 17, 2026 21:04
Signed-off-by: Muhammad Rizky Rizaldi <myquinn489@gmail.com>
The mode-switch worker now also catches RuntimeException, so an unchecked
exception (e.g. connector nulled on session stop) no longer leaves
modeSwitchInProgress stuck and blocks later switches. sendShiftTab() no
longer clears the flag while a worker owns it. The racy retarget test is
now deterministic (CountDownLatch). The capture script exits with a clear
message when claude is not on PATH.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 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-10-18T10:53:41.000423Z 3e72112 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 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: 3828e9ae7f

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

… fails

The Shift+Tab worker used to clear the shared target on any failure and
exit, so a newer mode requested during the failed switch was never served.
It now logs the failure and continues with the queued target; only an
interrupt stops the worker and clears the state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@oleg68

oleg68 commented Oct 18, 2026

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: 610b00f992

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

The worker decided that its request was done by comparing the queued target
with its own by value, so an A -> B -> A sequence during a failing switch to
A looked like the original request and was cleared. Requests now carry a
generation number and the worker compares generations instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@oleg68

oleg68 commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 3e721123cb

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

@oleg68
oleg68 merged commit edf222a into nbplugins:main Oct 18, 2026
3 checks passed
@oleg68
oleg68 deleted the bugfix/edit-mode-selector-cycling branch October 18, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants