fix(gemini): stabilize ask reply state handling#735
fix(gemini): stabilize ask reply state handling#735jackwener merged 3 commits intojackwener:mainfrom
Conversation
2790136 to
16bf392
Compare
|
A quick follow-up on what this revision improves. This version does not keep layering more heuristics onto the old path. Instead, it tightens
This revision also adds state-driven tests and command-level verification for the main edge cases, especially:
In one sentence: this revision makes |
…matting - Replace raw Error with CommandExecutionError for Node-side composer failures (prepareComposer, insertText) to match adapter error conventions - Remove extra blank lines after __test__ export
jackwener
left a comment
There was a problem hiding this comment.
Review
Well-designed reply-state model that properly separates submission confirmation from response detection. The two-phase approach (waitForGeminiSubmission → waitForGeminiResponse) with user anchor turn ownership is a significant reliability improvement over the old transcript-diff approach.
Fixed: Node-side throw new Error(...) → throw new CommandExecutionError(...) for composer failures (2 instances), matching the PR's stated goal of normalizing to CliError subclasses. Also cleaned up extra blank lines.
Minor note (non-blocking): createPageMock() is duplicated across 3 test files — could be extracted to a shared helper later.
35 tests pass, typecheck clean. LGTM.
- Remove unused areGeminiTurnsEqual and areGeminiLinesEqual functions - Add Chinese sign-in label (登录) to sign-in detection for consistency with other Chinese labels already added in this PR
Description
Stabilize
gemini askby replacing the old reply detection path with a conservative reply-state model.This change tightens three parts of the Gemini adapter:
Related issue:
#390
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)README.md/README.zh-CN.mdwhen command discoverability changedCliErrorsubclasses instead of rawErrorScreenshots / Output
Checks:
npm testnpm run typechecknpm run test:adapter -- src/clis/gemini/utils.test.ts src/clis/gemini/reply-state.test.ts src/clis/gemini/ask.test.tsManual verification:
npm run dev -- gemini ask "请只回复:RV1" --timeout 20 -f plain->💬 RV1npm run dev -- gemini ask "请只回复:RV1" --timeout 20 -f plain->💬 RV1npm run dev -- gemini ask "请只回复:RV3" --timeout 20 --new true -f plain->💬 RV3