mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-22 15:15:18 +00:00
* feat(cli): show follow-up suggestion in input placeholder
When enableFollowupSuggestions is true, display the generated
follow-up suggestion as the input placeholder text (replacing
the default "Type your message..."). Tab/Enter/Right arrow
accepts the suggestion; typing dismisses it.
Also change the default of enableFollowupSuggestions from false
to true so the feature is on by default.
Key changes:
- AppContainer: dismissPromptSuggestion no longer clears
promptSuggestion state, preserving it for placeholder restore
after user types then deletes
- InputPrompt: Tab/Enter/Right arrow/typing handlers check
promptSuggestion prop as fallback when followup.state is not
visible (e.g. after 300ms delay or user dismissed)
- Composer: placeholder shows suggestion text when available
- hasTabConsumer: include promptSuggestion to prevent Windows
bare Tab from cycling approval mode
* chore: update settings.schema.json (enableFollowupSuggestions default: false → true)
* test(cli): add tests for promptSuggestion prop fallback paths (#5145)
- Add unit tests for Tab/Right arrow/Enter accepting promptSuggestion
when followup.state.suggestion is null (type-then-delete path).
- Add unit test for hasTabConsumer reporting true immediately when
promptSuggestion prop is set (no followup debounce needed).
- Update stale comment on speculation abort useEffect in AppContainer.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* fix(cli): address PR #5145 review feedback for promptSuggestion
- Fix Enter key to fill buffer instead of submitting suggestion (matches
Tab/Right-arrow behavior and Claude Code design)
- Add suggestionDismissed state to hasTabConsumer for Windows Tab cycling
- Fix suggestionDismissed to be set to true on user input (paste/typing)
- Add speculation abort to dismissPromptSuggestion callback
- Remove dead placeholder branch from Composer.tsx
- Update tests to reflect Enter no longer auto-submits suggestion
* fix(cli): address PR #5145 review from wenshao + telemetry gap
wenshao's review (posted after the previous fixes) flagged two issues,
both still valid against the current code; doudouOUC's telemetry gap
is addressed too.
- settings description: replace stale "Enter to accept and submit" with
"Press Tab, Right Arrow, or Enter to accept into the input buffer" in
both settingsSchema.ts and settings.schema.json (Enter now only fills
the buffer, and the feature defaults to enabled).
- hasTabConsumer / handler consistency: drop the redundant
`suggestionDismissed` state and gate hasTabConsumer on
`buffer.text.length === 0` — the exact condition the Tab/Right/Enter
handlers already use. Fixes the type-then-delete desync where Windows
bare Tab would both insert the suggestion and cycle approval mode
(regression of #4171).
- fallback telemetry: add a `fallbackText` option to the followup
controller's accept() so the prop-fallback path (no live suggestion,
e.g. within the show delay or after type-then-delete) routes through
accept() and logs onOutcome instead of silently bypassing telemetry.
Tab/Right/Enter handlers now call accept(method, { fallbackText }).
- tests: add core-level coverage for accept() with/without fallbackText,
and fix the InputPrompt "fallback" tests that advanced 700ms (which
silently exercised the normal visible-suggestion path) to advance only
100ms so followup.state.suggestion truly stays null.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(cli): add accept_source telemetry + tests for promptSuggestion fallback
Follow-up to wenshao's second review pass on #5145.
- accept_source telemetry: fallback accepts report time_to_accept_ms: 0
(the suggestion was never shown via the timer), which is indistinguishable
from an instant accept. Add an `accept_source: 'live' | 'fallback'` field to
the followup controller's onOutcome and PromptSuggestionEvent so analytics
can tell the two apart. The controller derives it from whether a live
`currentState.suggestion` was present before applying `fallbackText`.
- tests: assert accept_source on the fallback accept; add a test that a live
suggestion takes priority over fallbackText (guards the `?? fallbackText`
ordering); add an InputPrompt test pinning the new buffer.text.length === 0
gate — hasTabConsumer reports false when a promptSuggestion is set but the
buffer is non-empty (the old Boolean(promptSuggestion) gate wrongly reported
true). The empty-buffer → true direction stays covered by the existing test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(cli): address doudouOUC review on #5145 (dedupe, rename, telemetry)
Three [Suggestion]-level items from the latest review pass.
- Extract `availableSuggestion`: the compound condition
`(followup.state.isVisible || promptSuggestion) && (followup.state.suggestion ?? promptSuggestion)`
was copy-pasted across the Tab/Right/Enter accept guards, both
typing-dismiss guards, and the placeholder prop. Collapse them into one
derived value so the sites can't drift apart. Behavior is unchanged
(the controller keeps `isVisible` and `suggestion` in lockstep).
- Rename `dismissPromptSuggestion` -> `abortPromptSuggestion` across the
UIState context, AppContainer, Composer, and the MainContent mock. The
function only aborts in-flight generation/speculation and deliberately
does NOT clear `promptSuggestion` (so the placeholder can restore it);
the "dismiss" name implied the suggestion was gone.
- Omit `time_to_first_keystroke_ms` for fallback accepts. With
`accept_source: 'fallback'` the suggestion was never shown via the timer
(shownAt stayed 0), so `prevShownAtRef` still holds a previous
suggestion's timestamp and the delta would be meaningless.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(cli): actually enable followup suggestions by default
PR #5145 changed the schema default to `true`, but `mergeSettings` never
applies SETTINGS_SCHEMA defaults, so the runtime `=== true` gates left the
feature off while the settings panel read it as on (verified by wenshao).
- Flip both runtime gates to treat an unset value as enabled — only an
explicit `false` opts out: `AppContainer.tsx` and the ACP `Session.ts`
(`#maybeEmitFollowupSuggestion`).
- Add a Session test for the unset/default-on path.
- Fix the stale `UIStateContext` JSDoc left over from the dismiss→abort
rename (it no longer clears state).
- Docs: mark the feature on-by-default, correct Enter (fills the input,
does not submit), ghost-text → placeholder text, and add a cost note that
`fastModel` forks to a separate cache and can cost more than the default
main-model + shared-cache path on long conversations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(core): reject control chars and ANSI escapes in prompt suggestions
The follow-up suggestion is influenceable through conversation history
(tool/file/web output) and is rendered verbatim in the input placeholder
now that enableFollowupSuggestions defaults to on. Raw control bytes (CR,
ESC/CSI, C1) reached the terminal because getFilterReason only rejected
newlines and asterisks. Reject them at the source so the displayed and
inserted text always match.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(cli): clear promptSuggestion on submit and accept paths
Addresses doudouOUC review on #5145. Since abortPromptSuggestion was
changed to preserve `promptSuggestion` for type-then-delete restore, the
submit and accept paths leaked stale suggestion text:
- handleSubmitAndClear only called followup.dismiss(); after a synchronous
command (/clear, /help) that never triggers AppContainer's streaming
transition, the placeholder kept showing the old suggestion.
- Tab/Right/Enter accept never cleared the prop, so clearing the buffer
without submitting (Ctrl+U) made the accepted suggestion reappear as a
ghost placeholder.
Both now call onPromptSuggestionDismiss?.() after the followup action. Also
reuse the availableSuggestion single-source-of-truth in hasTabConsumer
instead of an inlined parallel expression, and add useFollowupSuggestions
tests asserting the accept_source guard suppresses time_to_first_keystroke_ms
on fallback accepts.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test(cli): assert promptSuggestion is cleared on accept and submit
Regression coverage for the state-leak fixed in
|
||
|---|---|---|
| .. | ||
| design | ||
| developers | ||
| e2e-tests | ||
| plans | ||
| superpowers | ||
| users | ||
| verification/abort-controller-refactor | ||
| _meta.ts | ||
| declarative-agents-port.md | ||
| index.md | ||
| yaml-parser-replacement.md | ||