Skip to content

fix(promptinput): focus seeded prompts - #661

Open
Farhan (fkb032) wants to merge 1 commit into
mainfrom
agent/eng-612-focus-seeded-prompt
Open

fix(promptinput): focus seeded prompts#661
Farhan (fkb032) wants to merge 1 commit into
mainfrom
agent/eng-612-focus-seeded-prompt

Conversation

@fkb032

@fkb032 Farhan (fkb032) commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Route suggestion chips, Spotlight, trending prompts, Mac recommendations, and prompt history through one prompt-seeding path.
  • Reveal and focus the composer after seeding, place the caret at the end, and never auto-submit.
  • Preserve history-trigger focus restoration when the popover is dismissed without a selection.

Why

ENG-612 / #638: under the active evolve-prompt-suggestions multivariate feature flag, the trending variant can leave the composer off-screen while suggestion rows remain clickable. Previously those clicks only updated Zustand state, so they could look inert. Mac recommendations and prompt history also bypassed the shared helper.

This supersedes closed draft #641. The filesystem “edit with prompt” action navigates from another screen and is intentionally outside this in-place suggestion flow.

Fixes #638

Test Plan

  • bun -F native test:unit — 347 tests passed across 51 files
  • bunx tsc --noEmit -p apps/native/tsconfig.json
  • bunx oxlint on all four changed files — 0 warnings/errors
  • bunx oxfmt --check on all four changed files
  • bun -F native build
  • Real WKWebView smoke: an off-screen Mac recommendation revealed and focused the composer with the caret at the end and no submit; history selection retained composer focus; Escape restored trigger focus
  • git diff --check

Known repository baselines

Docs

  • No docs update needed

@linear-code

linear-code Bot commented Aug 15, 2026

Copy link
Copy Markdown

ENG-612

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

📋 PR Overview

Lines changed 217 (+179 / -38)
Files 0 added, 4 modified, 0 deleted
Draft / WIP no
Has Test Plan yes
Linear issue yes
No Test Plan Needed no
New UI components no
New Storybook stories no
New Rust modules no
New TS source files no
New tests no
package.json touched no
Cargo.toml touched no
Infra / CI touched no

🔬 Coverage

Report Lines Statements Functions Branches
apps/native/coverage/coverage-summary.json 35.0% 34.4% 29.8% 29.5%

Generated by 🚫 dangerJS against 80f5a2e

@darkmatter

darkmatter Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🎨 Storybook preview

Open Storybook preview

Updated for 80f5a2e


⚠️ Detected UI changes (5)

These stories' HTML snapshots changed. I've added screenshots + links to the changed stories below. Review them carefully then accept the changes to regenerate baselines and include them in this PR:

Flows/Evolve › Playground

Flows/Evolve › Playground

Flows/Evolve › 1. Begin (idle)

Flows/Evolve › 1. Begin (idle)

Flows/Evolve › 2. Evolving (progress)

Flows/Evolve › 2. Evolving (progress)

Flows/Evolve › Evolving With Error Event

Flows/Evolve › Evolving With Error Event

Flows/Evolve › 3. Review (changes generated)

Flows/Evolve › 3. Review (changes generated)


Accept UI changes

  • Click here to accept these changes

Alternatively, you can run bun run test:update-snapshots locally to re-generate the baselines and then push the changes to this PR.

What does this do?

The screenshots above show UI changes detected by the Storybook
snapshot tests run on this PR. Each image is the rendered output of
a Storybook story from the code in this PR branch; the snapshot
test compared it against the committed baseline in
__snapshots__/ and flagged the difference.

Checking the box tells the darkmatter[bot] to regenerate the
baselines from this PR's current code and commit them directly to
this branch. The new baselines become the source of truth for
future runs — only accept after confirming the visual changes are
intentional.

Comparison baseline: the committed __snapshots__/ files on this
PR branch (carried forward from develop). Accept updates them in
place on this branch.

@prelint

prelint Bot commented Aug 15, 2026

Copy link
Copy Markdown

Ship it Prompt seeding unified across in-place suggestion surfaces

Product decisions in this change

Agree 1. All in-place suggestion surfaces share one seeding path. Starter chips, Spotlight, trending rows, Mac recommendations, and prompt history all call the same `seedPrompt` function instead of writing directly to global state.

Before this PR, some surfaces updated state but never told the composer to reveal or focus. That meant a click on an off-screen chip looked inert. Centralizing reveals, focus, and caret placement in one place guarantees consistent behavior as new surfaces are added. The author confirmed in the PR conversation that the filesystem transition is the only non-empty prompt writer outside this path, so coverage is complete for the in-place context.

Agree 2. Seeding a prompt reveals and focuses the composer but never auto-submits. After any suggestion is selected, the composer scrolls into view, receives focus, and the caret moves to the end. The user must press submit explicitly.

Suggestions are starting points, not commands. A user who picks a chip often wants to add context, change a word, or reconsider. Auto-submit would remove that agency. Placing the caret at the end is the correct default: the user can append text immediately without repositioning. Respecting prefers-reduced-motion for the scroll animation is a correct accessibility decision and the test coverage confirms it is enforced.

Agree 3. History popover focus splits by outcome. A selection moves focus to the composer. Dismissal without a selection returns focus to the trigger button.

These are two distinct user intents. A user who selects a history item wants to act on it immediately, so the composer is the right target. A user who opens the popover and presses Escape changed their mind, so the trigger is the right target. This matches ARIA disclosure-widget conventions and avoids a focus trap or an unexpected jump. The focusPromptAfterCloseRef approach correctly separates the two paths without relying on an async race.

Agree 4. A seeded prompt captured during cancellation wind-down is retained and not auto-submitted when processing clears. If a user clicks a suggestion while the composer is briefly disabled during a cancel, their choice survives the wind-down.

Silently discarding the user's intent would be the worse outcome. Retaining the text and surfacing it once the composer re-enables respects the user's action without creating a surprise submission. The window is narrow (brief wind-down only; overlays block all suggestion surfaces during active evolve and rebuild), so this edge case surfaces only for the cancellation path. The author's explanation confirms no auto-submit occurs on clear.

Agree with concerns 5. The "edit with prompt" filesystem action remains outside the unified seeding path. It stores the seed and navigates to the prompt screen but does not reveal, focus, or position the composer.

The scoping rationale is defensible: this is a cross-screen navigation, not an in-place selection, and ENG-612 covers the in-place context only. However, the author confirmed that after navigation the composer is populated but not revealed or focused. From the user's perspective, the intent is identical to picking a chip: "I told the app what I want to do, now I expect to see the composer ready." The experience is noticeably different, and the gap is not speculative.

Option What it gives users What it costs Effort to change later
Current: separate path Unblocks ENG-612 without touching filesystem flow Filesystem seeding looks inert compared to in-place seeding Low: one follow-up PR adds seedPrompt call after navigation
Unified path now Fully consistent seeding experience across all entry points Slightly wider scope; needs cross-screen navigation awareness Lower if done now before more surfaces are added

The concern is worth tracking as a follow-up. The team has acknowledged it and scoped it explicitly, which is the right process decision.

Since the last review

  • Addressed by explanation: The filesystem 'edit with prompt' action is excluded from seeding unification, which may feel inconsistent to users whose mental model is the same as picking a chip. (Farhan (@fkb032) confirmed the filesystem action stores the seed and navigates but does not call seedPrompt, focus the textarea, or scroll it into view; the team has explicitly scoped it outside ENG-612 as a cross-screen path.)
  • Addressed by explanation: Does the filesystem 'edit with prompt' action currently reveal and focus the composer after navigating? If not, does the team plan to align it? (Farhan (@fkb032) confirmed it does not reveal or focus the composer; alignment is deferred outside ENG-612 with no committed timeline.)
  • Addressed by explanation: Are any suggestion surfaces (Spotlight variant, trending variant) still calling the global state action directly and bypassing the shared seeding path? (Farhan (@fkb032) confirmed Spotlight, Trending (row and 'Use'), starter chips, Mac recommendations, and history all call seedPrompt; the filesystem transition is the only remaining out-of-path writer.)
  • Addressed by explanation: Can a user reach a suggestion chip while processing is running, and if so, does seeding behave consistently? (Farhan (@fkb032) confirmed overlays block all surfaces during active evolve and rebuild; during brief cancellation wind-down the selected text is retained and not auto-submitted when processing clears.)

Open questions

  • When the "edit with prompt" filesystem action lands the user on the prompt screen with a seed already stored, is any affordance shown to indicate the composer has content ready? Or does the user need to notice the populated textarea independently?

  • The requestAnimationFrame timing guarantees focus happens after the next paint, which is correct when the composer is already visible. Does the trending variant, which may need to reveal the composer first, always complete its reveal within one frame? Or is there a layout transition that could make focus fire before the composer is fully on screen?

Recommendation

Ship it
Every in-scope product decision is sound: seeding is unified, the composer reveals and focuses without auto-submitting, and focus routing for the history popover matches user intent in both the selection and dismiss cases. All four prior concerns and open questions have been answered by the author. The one remaining gap (filesystem path inconsistency) is acknowledged, explicitly scoped out, and small enough to address in a follow-up without blocking this fix.

Copy link
Copy Markdown
Contributor Author

Thanks — I checked each open question against the current branch:

  • Filesystem action: “Edit with a prompt” stores the seed and closes the Filesystem view. It does not use the shared seedPrompt path, focus the textarea, or scroll it into view. That remains a separate cross-screen path outside ENG-612; this PR covers the in-place suggestion controls.
  • Suggestion coverage: Spotlight, Trending (row selection and “Use”), starter chips, Mac recommendations, and prompt history all call the shared seedPrompt. The filesystem transition is the only production non-empty prompt writer outside PromptInput.
  • Processing state: During normal evolve, the overlay covers the controls and the textarea and history control are disabled. Rebuild also uses a full-content overlay. Some apply actions run from Begin, but the composer remains enabled, so suggestion seeding still reveals and focuses it normally. There is a brief cancellation wind-down where suggestions can be selected while the textarea remains disabled; on the cancellation path, the selected text is retained when processing clears and is not auto-submitted.

@darkmatteragent darkmatteragent 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.

Review — APPROVE

ba1dcb6dce86 · 0 findings

The shared seeding path correctly reveals, focuses, and positions the composer without submitting, while history selection preserves focus behavior for both selected and dismissed popovers. No provable, actionable defects remain in the supplied patch.

No findings.

@darkmatteragent

Copy link
Copy Markdown
Reviewer · darkmatter agent VERDICT
APPROVE
The shared seeding path correctly reveals, focuses, and positions the composer without submitting, while history selection preserves focus behavior for both selected and dismissed popovers. No provable, actionable defects remain in the supplied patch.

No findings.

reviewed: ba1dcb6 — 2026-08-29T07:44Z verdict: approve findings: 0

Reviewer avatar Reviewer
darkmatter agent
Run details
Metadata Value
Agent darkmatter/agent/reviewer
Session pr:darkmatter/nixmac#661
Kind pr
Runtime platform-runtime
Configured model litellm/glm-5.2-fp8
Target darkmatter/nixmac#661
Revision ba1dcb6dce867458abb3013184846b48b81b7cff
Verdict approve
Reviewed at 2026-08-29T07:44Z
Logs Open Braintrust session

@czxtm
cooper (czxtm) force-pushed the agent/eng-612-focus-seeded-prompt branch from ba1dcb6 to 80f5a2e Compare August 29, 2026 08:27
@gitar-bot

gitar-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Consolidates route suggestion chips, Spotlight, trending prompts, Mac recommendations, and prompt history through a shared prompt-seeding path. The composer is now revealed and focused with the caret positioned at the end, without auto-submit, and history-trigger focus restoration is preserved on popover dismissal. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

Suggestion chips feel dead when prompt is scrolled off-screen

3 participants