Repository navigation
fix: read tool state from the composer the prompt is typed into - #86
Merged
Merged
Conversation
What this touches
3 file(s), 177 line(s) changed. Tests changed. This is an automated first pass, not a review. CI is the gate; a person decides. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
youdie006
added a commit
that referenced
this pull request
Nov 3, 2026
Port of main PR #86. activeComposerToolsExpression read the first editor in the document. After a new chat that is the home page's composer, mounted in a hidden workspace ahead of the conversation's, so a follow-up with --tool turned the tool on in the visible composer, read the hidden one, and was refused with "Selected "Web search" but the composer never showed it as active." It now reads findChatGptComposerCandidate. Measured 2026-11-03 in the WSL container on a test conversation: the deployed code refused a Web search follow-up as above with the tool showing in the visible composer; this branch built with the change, run from a temp path inside the container, sent the same follow-up (status done). The tools button case in tests/composer-tool-state.test.ts already passes here through 8ce48b9's exclusion of message search units. Verified: the two tool-state cases failed before the change and pass after; npx tsc --noEmit clean; npm test 2175 passed, 3 skipped. Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
activeComposerToolsExpression read document.querySelector of the first
editor on the page. A new chat leaves the home page's composer mounted in a
workspace with display: none, ahead of the conversation's composer, so a
follow-up with --tool turned the tool on in the visible composer, read the
hidden one ("Thinking effortPro"), and was refused with "Selected "Web
search" but the composer never showed it as active." The tool stayed on in
the composer afterwards. It now reads findChatGptComposerCandidate, the
composer typing uses (visible, outside messages).
composerToolsButtonRectExpression took the first visible editor, the same
way the model lookup did before PR #85, so an open "Edit message" editor
made a --tool send fail to find the tools button. It now skips editors
inside a message.
Measured 2026-11-03 in the WSL browser container on a test conversation
(prompt "Reply with only the word OK", no project): after a new chat the
first editor in the document was the hidden workspace's (0x0), and a
follow-up with tools ["Web search"] was refused as above by the deployed
check while the visible composer showed the tool. The container branch
built with the same change sent that follow-up (status done).
Verified: tests/composer-tool-state.test.ts (three cases) failed before the
change and passes after; npx tsc --noEmit clean; npm test 1858 passed and
3 skipped, plus the 2 package-bin tests that need dist/, which pass after
npm run build.
Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
youdie006
force-pushed
the
fix/tool-state-visible-composer
branch
from
November 3, 2026 02:02
a39e12e to
d959e44
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
activeComposerToolsExpressiondecides whether a--toolselection took effect. It read the first editor in the document. A new chat leaves the home page's composer mounted in a workspace withdisplay: none, ahead of the conversation's composer. So a follow-up with--toolin the same tab turned the tool on in the visible composer but read the hidden one. The send was then refused withSelected "Web search" but the composer never showed it as active., and the tool was left on in the composer.composerToolsButtonRectExpressiontook the first visible editor, as the model lookup did before #85. With "Edit message" open, a--toolsend could not find the tools button.Evidence (2026-11-03, WSL browser container, test conversation, no project)
HS(hidden, shown), anddocument.querySelector('#prompt-textarea,[contenteditable="true"]')returned the hidden workspace's editor (0x0).#prompt-textareano longer exists on the page.tools: ["Web search"]through the deployed container code was refused as above. Read afterwards, the visible composer showedWeb searchand the hidden formThinking effortPro.status: done.Change
activeComposerToolsExpressionreadsfindChatGptComposerCandidate(), the composer that typing uses: visible, and outside messages.composerToolsButtonRectExpressionskips editors under[data-message-author-role]or[data-chatgpt-search-unit-key], matching fix: skip an open message editor when looking for the model trigger #85's model lookup.Verification
tests/composer-tool-state.test.ts, three cases: a hidden workspace's composer ahead of the visible one, a tool shown only by the hidden one, and an open message editor ahead of the composer. All three failed before the change and pass after.npx tsc --noEmitclean.npm test: 1858 passed, 3 skipped. Twopackage-bintests failed only because the new worktree had nodist/; they pass afternpm run build.The container branch gets the same
activeComposerToolsExpressionchange. Its tools button lookup is already covered by its composer exclusion fix (8ce48b9).Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV