Skip to content

fix(composer): trim prompt suggestion whitespace - #3632

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/fix-prompt-suggestion-whitespace
Oct 30, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/fix-prompt-suggestion-whitespace

Conversation

@bobleer

@bobleer bobleer commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Accepting a prompt suggestion with Tab could insert leading blank lines that were hidden in the single-line preview. Trim surrounding whitespace in the portable runtime before publishing suggestions and in the Web UI store for compatibility with older hosts. Preserve message-internal whitespace, line breaks, and indentation; ignore blank suggestions.

Type and Areas

Type: Bug fix

Areas: Agent Runtime prompt suggestions, Core suggestion integration contracts, Web UI suggestion store and event projection, focused verification guides.

Motivation / Impact

The runtime previously called trim() only to detect empty or literal null output, then returned the unmodified model text. The preview collapsed its whitespace while the composer preserved it. Preview and accepted text now use the same normalized suggestion, including when an older peer sends padded output.

Verification

  • cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,git --lib agentic::execution::prompt_suggestion::tests — 10 passed (loopback provider response through event publication).
  • cargo test --locked -p openbitfun-agent-runtime --no-default-features --features agent-runtime --lib prompt_suggestion::tests — 6 passed.
  • pnpm --dir src/web-ui run test:run src/flow_chat/store/promptSuggestionStore.test.ts src/flow_chat/hooks/usePromptSuggestionsEnabled.test.tsx src/flow_chat/services/flow-chat-manager/EventHandlerModule.test.ts — 88 passed.
  • The whitespace regressions failed before the fix and passed afterward.
  • pnpm run check:web — passed.
  • pnpm run fmt:rs and git diff --check — passed.
  • node scripts/check-git-object-sizes.mjs --base upstream/main --head HEAD — passed.

Reviewer Notes

AI-assisted; tested with focused automated checks. Coverage includes leading blank lines, CRLF, tabs, Unicode spaces, retained inner formatting, whitespace-only suggestions, legacy event payloads, and simulated local/Peer surface identities. No protocol or persisted shape changes are required.

Native desktop rendering and live Remote Workspace, Remote Control, Peer Device, and Detached Dispatch scenarios were not exercised. Detached/headless eligibility remains unchanged.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer
bobleer merged commit 9ea94cb into GCWing:main Oct 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant