← Back to Pull requests

feat(desktop): add opt-in next prompt suggestions #5629

Closed
unknown closed this pull request without merging on Sep 24, 2026 13:26 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 10:42 UTC
Author

Summary

Adds opt-in next-prompt suggestions to ordinary AI SDK conversations and WorkHub. After a completed reply, an empty composer may show one suggestion with the same position, typography and wrapping as normal input. Tab accepts an editable draft; clicking focuses the input without accepting; Enter sends and Esc dismisses. Typing, navigation, hidden interaction forms and newer turns invalidate stale results.

Runtime Host owns bounded, tool-free prediction requests through the existing credential/model authority, with usage metering, a five-second timeout and per-turn deduplication. The feature defaults off. WorkHub admits only its permanent coordination identity and uses recent visible conversation rather than the session's distant original task. Background subagents and other existing eligibility restrictions remain excluded. The overlay stays outside contenteditable and has no layout-measuring state loop.

Rebased onto main acaa29e40, preserving delegated-result notifications and the updated executor picker.

Refs #4117. A separate investigation exercised 2,040 natural Chromium cases without reproducing React 185. Artificial geometry oscillation also did not reproduce the crash. The old engine came from Maka's Astryx patch. This PR corrects overly certain historical commentary; it does not claim to fix that crash.

The opt-in setting is a renderer-local preference, not a Host authorization boundary. Authenticated remote owners can invoke prediction just as they can invoke paid turns.

Review fixes add unique per-call usage IDs, click-through ghost text, automated-session/turn filtering, a deadline covering source reads, recovery after transient reconciliation failures, and collapsed WorkHub geometry constraints. Review artifacts are excluded from the current branch; the historical evidence below uses a fixed commit link. Native ordinary/WorkHub acceptance and 60 Host tests passed after the review changes; full build, typecheck and formatting passed.

Additional review fixes: read user messages through userFacingText, synchronize the opt-in across renderer storage events, share first-line/think-tag cleanup with title generation, and keep operation residency until actual model cleanup completes. Declared reasoning models without a supported off level are skipped before provider invocation; supported requests explicitly disable reasoning and retries. Prediction costs count toward the session totals and cache-hit statistics. The bounded per-turn result cache remains to prevent duplicate paid requests across clients; it is insertion-ordered, not LRU.

Validation includes provider request reasoning fields, truncated responses, no retry on HTTP 503, a reasoning-only model making zero provider requests, source-identity changes without reconciliation, and close waiting for delayed model cleanup. The cross-renderer adapter event test and WorkHub native acceptance pass. A full multi-window UI journey, exhaustive Host eligibility table and IME/mention-menu Tab cases were not added in this revision.

Verification

  • Full workspace build, Storybook typecheck/build, renderer typecheck/architecture, ASF headers and whitespace checks passed.

  • Focused Host/UI tests: 13 passed. Execution/model composition: 37 passed on final standalone run. An existing implementation-child-patch test timed out during a combined run, then passed alone and in the entire standalone suite. Protocol tests passed.

  • Actual Electron WorkHub WebContentsView → preload → main → Runtime Host → controlled HTTP model verified generation, Tab without sending, native Undo, Enter in the durable coordination transcript, Esc and delayed-result preservation. Ordinary conversation acceptance also covers deduplication and disabling.

  • Product/WorkHub/NextPromptSuggestion uses the production WorkHubRoot/controller/Composer with mocked service transport. All four real Chromium plays completed at 1280/720px × light/dark, including exact before/after-Tab glyph rectangles and typography, accepted Enter and Esc.

  • Injecting the previous 12px overlay padding makes the Storybook geometry assertion fail. This exposed a missing playFunctionThrewException listener in the smoke probe; the listener and regression coverage are included. Smoke-runner unit tests: 15 passed. The CI catalog explicitly schedules the four viewport/theme combinations.

  • Real-provider prediction quality, other operating systems, all workspace tests and the full Storybook catalog were not run. Native conversation replies use FakeBackend; prediction requests use a controlled HTTP endpoint. Full-repository lint/format and locale hygiene now pass. The protocol compatibility epoch is bumped to 185; the guard and its 17 tests pass. After the CI fixes, 93 Host/protocol tests and 12 UI/copy tests pass.
  • Historical UI evidence and reproduction commands (before review fixes)

    Screenshots are from the built Storybook in the in-app browser; the assertion matrix ran in Ego Chromium. Ego screenshot calls timed out, so these are not labeled as Ego captures.

    !WorkHub light, 1280px

    !WorkHub dark, 720px

    AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex implemented the feature, tests and documentation; local Claude Code was used during initial behavior research. Generated-by trailers are included.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: liugddx Review duration: 1604m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5629"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository