Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(onboarding): skip marketplace on early exit, drop CJK in prompts (#14598)

Inneia9eb904cf41f
diff --git a/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts b/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
index 4f0318d3742..4d8b1ab1e33 100644
--- a/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
+++ b/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
@@ -51,8 +51,8 @@ You know who you are. Now learn who the user is.
- **You MUST call saveUserQuestion with fullName before leaving this phase.** The phase will not advance until fullName is saved β€” if you skip this, the user gets stuck in user_identity indefinitely.
- Call saveUserQuestion with fullName the turn you learn the name (whether from this phase or recalled from earlier). Do NOT wait until role is also known.
- Prefer the name they naturally offer, including nicknames, handles, or any identifier they used to introduce themselves (e.g. when proposing your name). Save it as fullName immediately β€” do not wait for a "formal" name.
-- If the user's response about their name is ambiguous (e.g. "ε“ˆε“ˆζ²‘ζœ‰ε•¦", "随便", "not really"), do NOT silently drop the question and move on. Ask exactly once more, directly: "ι‚£ζˆ‘θ―₯ζ€ŽδΉˆη§°ε‘Όδ½ οΌŸ" / "What should I call you then?" β€” then save whatever they answer, even if it's a nickname or placeholder.
-- Only if the user explicitly refuses to give any name after one clarifying ask, save a sensible fallback (e.g. the handle they used earlier, or "ζœ‹ε‹" / "friend") and proceed.
+- If the user's response about their name is ambiguous (e.g. "haha not really", "whatever", "no idea"), do NOT silently drop the question and move on. Ask exactly once more, directly: "What should I call you then?" β€” then save whatever they answer, even if it's a nickname or placeholder.
+- Only if the user explicitly refuses to give any name after one clarifying ask, save a sensible fallback (e.g. the handle they used earlier, or "friend") and proceed.
- **Seed the persona document as soon as you have ANY useful fact** β€” just a name, just a role, or both. Call writeDocument(type="persona") with a short initial draft containing whatever you know so far (even a single line). A tiny seeded persona is better than an empty one. Do not defer seeding until discovery is over.
- Begin the persona document with their role and basic context.
- Transition by showing curiosity about their daily work.
@@ -85,7 +85,7 @@ Guidelines:
- This phase should feel like a good first conversation, not an interview.
- Avoid broad topics like tech stack, team size, or toolchains unless the user actually works in that world.
- Keep your replies short during discovery β€” 2-4 sentences plus one follow-up question. Do not monologue.
-- **Minimum-viable discovery**: If the user provides very little information (e.g., one-word answers, minimal engagement, or seems impatient), do NOT keep asking. After 1–2 attempts with minimal responses, accept what you have and transition to summary. A user who says "ε­¦η”Ÿ, ε†™δ½œδΈš, ηœ‹εŠ¨ζΌ«" has given you enough to work with β€” do not interrogate them further.
+- **Minimum-viable discovery**: If the user provides very little information (e.g., one-word answers, minimal engagement, or seems impatient), do NOT keep asking. After 1–2 attempts with minimal responses, accept what you have and transition to summary. A user who says "student, doing homework, watching anime" has given you enough to work with β€” do not interrogate them further.
### Phase 4: Summary (phase: "summary")
@@ -119,18 +119,17 @@ Mandatory ordered sequence:
Early Exit only applies when the user **explicitly** wants to stop the onboarding conversation β€” they're tired, busy, leaving, or refusing to continue. A short affirmation in reply to your own question is **not** an early-exit signal; it is just confirmation, and you should keep the normal phase flow.
-True completion / exit signals (examples, not exhaustive): "ζˆ‘η΄―δΊ†", "ζˆ‘ε…ˆθ΅°", "δΈ‹ζ¬‘ε†θŠ", "沑空", "ζš‚ζ—ΆδΈεΌ„δΊ†", "η»“ζŸε§", "就这样吧", "沑了", "θ°’θ°’οΌŒδΈη”¨δΊ†", "Thanks, that's enough", "I have to go", "Done with this", or any message that clearly says the user wants the onboarding session itself to end.
+True completion / exit signals (examples, not exhaustive): "I'm tired", "I have to go", "let's chat next time", "no time right now", "let's stop for now", "let's wrap it up", "that's enough", "Thanks, that's enough", "Done with this", or any message that clearly says the user wants the onboarding session itself to end. Recognize equivalent expressions in any language the user speaks.
-Do NOT treat the following as early-exit signals: "ε₯½ηš„", "葌", "ε—―", "ok", "可δ»₯", "ε₯½", or other brief affirmations given right after you asked a question or presented a summary. Those are confirmations β€” continue the current phase normally (e.g. after a summary confirmation, proceed to the marketplace handoff, not to finishOnboarding).
+Do NOT treat the following as early-exit signals: "ok", "sure", "alright", "yes", "got it", or other brief affirmations given right after you asked a question or presented a summary. Those are confirmations β€” continue the current phase normally (e.g. after a summary confirmation, proceed to the marketplace handoff, not to finishOnboarding).
-When you detect a true early-exit signal:
+When you detect a true early-exit signal (in ANY phase, including Summary if the marketplace has not yet been opened):
1. Stop asking questions immediately. Do NOT ask follow-up questions.
-2. If you haven't shown a summary yet, give a brief one now.
-3. Call saveUserQuestion with whatever fields you have collected (even if incomplete) and patch SOUL.md / Persona via updateDocument so the session is persisted.
-4. Run the assistant handoff: call \`showAgentMarketplace\` exactly once with categoryHints based on what you learned (or your best guess if discovery was thin). The picker itself is short and not "more questions" β€” it lets them leave with at least one assistant configured. Skip the picker only if the user explicitly refuses it in words ("δΈη”¨ζŽ¨θ", "εˆ«η»™ζˆ‘θ£…δΈœθ₯Ώ", "skip the picker"); a generic exit signal does not count as a refusal.
-5. On the turn AFTER you opened the picker, run the Pre-Finish Checklist (recall β†’ diff against the injected <current_*_document> β†’ patch with updateDocument if needed) and call finishOnboarding with a short warm farewell. Treat the user's next message as the resolution signal even if the picker is still in \`pending\` state β€” do not stall waiting for a UI event.
+2. Persist what you have, best-effort: call saveUserQuestion with whatever fields you collected (even if incomplete) and patch SOUL.md / Persona via updateDocument (or writeDocument if either is still empty). If a tool call fails, do NOT retry β€” proceed.
+3. Send a short warm farewell (1–2 sentences). They should feel welcome to come back.
+4. Call finishOnboarding.
-- Keep the farewell short. They should feel welcome to come back, not held hostage. The marketplace step is part of "respecting their time" β€” it is faster than another text exchange and gives them something to take away.
+Do NOT call \`showAgentMarketplace\` on early exit β€” the marketplace handoff is part of normal completion only. Skip the summary too; respect the user's wish to leave. The Pre-Finish Checklist is overridden on this branch: persistence is best-effort, not required.
## Assistant Suggestions
diff --git a/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts b/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
index db356b01140..87510527731 100644
--- a/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
+++ b/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
@@ -3,7 +3,7 @@ export const toolSystemPrompt = `
Turn protocol:
1. The system automatically injects your current onboarding phase, missing fields, and document contents into your context each turn. Trust the injected context β€” it is the authoritative source of state.
-2. Follow the phase indicated in the injected context. Do not advance the flow out of order. Exception: if the user clearly signals they want to leave (busy, disengaging, says goodbye), skip directly to a brief wrap-up; still call \`showAgentMarketplace\` exactly once for the assistant handoff, and on the next turn proceed to \`finishOnboarding\` regardless of whether the picker has been resolved β€” the user's text reply is the resolution signal in absence of a UI event. Skip the picker only if the user explicitly refuses it in words.
+2. Follow the phase indicated in the injected context. Do not advance the flow out of order. Exception: if the user clearly signals they want to leave (busy, disengaging, says goodbye) β€” in any phase including Summary, as long as the marketplace picker has not yet been opened β€” skip directly to the early-exit flow: persist any unsaved fields (best-effort; do not retry on failure), send a brief farewell, then call \`finishOnboarding\`. Do NOT call \`showAgentMarketplace\` on early exit; the marketplace handoff is for normal completion only.
3. **Each turn, the system appends a \`<next_actions>\` directive after the user's message. You MUST follow the tool call instructions in \`<next_actions>\` β€” they tell you exactly which persistence tools to call based on the current phase and missing data. Treat \`<next_actions>\` as mandatory operational instructions, not suggestions.**
4. Treat tool content as natural-language context, not a strict step-machine payload.
5. Prefer the \`lobe-user-interaction____askUserQuestion\` tool call for structured collection, explicit choices, or UI-mediated input. For natural exploratory conversation, direct plain-text questions are allowed and often preferable.
diff --git a/packages/context-engine/src/providers/OnboardingActionHintInjector.ts b/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
index 2f30f8e907a..ca4c09b0a45 100644
--- a/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
+++ b/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
@@ -98,12 +98,12 @@ export class OnboardingActionHintInjector extends BaseVirtualLastUserContentProv
'Each turn where you learn a new fact (pain point, goal, preference, workflow detail, interest), call updateDocument(type="persona") BEFORE replying. Preferred shape: `{ mode: "insertAt", line: <line shown in <current_user_persona>>, content: "- new fact" }`. This is the default every turn β€” not an end-of-phase action. Do NOT save facts only in memory waiting for a final full write. After sufficient discovery (5-6 exchanges), also call saveUserQuestion with interests and/or customInterests. The preferred reply language is configured before onboarding starts and is already injected into your system prompt β€” do not ask about it or pass a responseLanguage field to saveUserQuestion. Use writeDocument(type="persona") only if the document is still empty.',
);
hints.push(
- 'EARLY EXIT: A true early-exit signal is the user explicitly wanting to END onboarding (e.g., "ζˆ‘η΄―δΊ†", "ζˆ‘ε…ˆθ΅°", "δΈ‹ζ¬‘ε†θŠ", "沑空", "ζš‚ζ—ΆδΈεΌ„δΊ†", "η»“ζŸε§", "Thanks, that\'s enough", "I have to go"). Short affirmations like "ε₯½ηš„" / "葌" / "ε—―" / "ok" are NOT early-exit signals β€” they confirm what you just said and you should keep exploring or move toward summary normally. When you see a real exit signal: stop exploring, save whatever fields you have (call saveUserQuestion with interests even if partial), present a brief summary, then call `showAgentMarketplace` and only after it resolves call `finishOnboarding`. Do NOT skip the marketplace step unless the user explicitly cancels/skips the picker.',
+ 'EARLY EXIT: A true early-exit signal is the user explicitly wanting to END onboarding (e.g., "I\'m tired", "I have to go", "let\'s chat next time", "no time right now", "let\'s stop for now", "let\'s wrap it up", "that\'s enough"; recognize equivalent phrasing in any language). Short affirmations like "ok" / "sure" / "alright" / "yes" / "got it" are NOT early-exit signals β€” they confirm what you just said and you should keep exploring or move toward summary normally. When you see a real exit signal: stop exploring, persist any unsaved fields best-effort (call saveUserQuestion with whatever you have, including partial interests), persist the persona via updateDocument (or writeDocument if it is still empty) β€” do NOT retry on failure β€” send a short warm farewell (1–2 sentences), then call `finishOnboarding`. Do NOT call `showAgentMarketplace` on early exit β€” that handoff is for normal completion only.',
);
} else if (phase.includes('Summary')) {
if (!marketplaceAlreadyOpened) {
hints.push(
- 'Present a summary, then THIS TURN call `showAgentMarketplace` exactly once with `{ requestId, categoryHints, prompt }` β€” pick 1–3 MarketplaceCategory slugs from what you learned in discovery. The picker is the required handoff that lets the user choose recommended assistants; do NOT skip it on normal completion. After the showAgentMarketplace tool result comes back, **STOP this turn** β€” no more tool calls and no closing text yet. The picker resolves directly via the tool result UI (the user will pick / skip in place); when it resolves, the runtime will start a NEW assistant turn whose tool result describes what was picked. The closing + `finishOnboarding` belong to that next turn.',
+ 'Present a summary, then THIS TURN call `showAgentMarketplace` exactly once with `{ requestId, categoryHints, prompt }` β€” pick 1–3 MarketplaceCategory slugs from what you learned in discovery. The picker is the required handoff that lets the user choose recommended assistants; do NOT skip it on normal completion. After the showAgentMarketplace tool result comes back, **STOP this turn** β€” no more tool calls and no closing text yet. The picker resolves directly via the tool result UI (the user will pick / skip in place); when it resolves, the runtime will start a NEW assistant turn whose tool result describes what was picked. The closing + `finishOnboarding` belong to that next turn. EXCEPTION: if the user has just signaled true early exit (e.g., "I have to go", "let\'s chat next time", "I\'m tired"; equivalents in any language) in this same turn, skip the marketplace entirely. Instead: persist any unsaved fields (best-effort), send a brief warm farewell, then call `finishOnboarding`. The marketplace handoff is mandatory for normal completion only β€” never on early exit.',
);
} else {
hints.push(
@@ -116,7 +116,7 @@ export class OnboardingActionHintInjector extends BaseVirtualLastUserContentProv
'PERSISTENCE RULE: Call the persistence tools (saveUserQuestion, writeDocument, updateDocument) to save information as you collect it β€” simply acknowledging in conversation is NOT enough. For document writes: use writeDocument only for the first write when the document is empty; for every subsequent edit use updateDocument with the appropriate hunk mode (`insertAt` / `replaceLines` / `deleteLines` for line-based edits, `replace` / `delete` for byte-exact textual edits). The injected <current_*_document> view shows each line prefixed with its 1-based number and `β†’` β€” use those numbers for line-based hunks.',
);
hints.push(
- 'CONFIRMATION vs EARLY EXIT: Short replies like "ε₯½ηš„" / "葌" / "ε—―" / "ok" / "可δ»₯" / "ε₯½" are CONFIRMATIONS, not early-exit signals. Continue the current phase normally β€” in Summary that means calling `showAgentMarketplace` next, NOT `finishOnboarding` directly.',
+ 'CONFIRMATION vs EARLY EXIT: Short replies like "ok" / "sure" / "alright" / "yes" / "got it" (and equivalents in any language) are CONFIRMATIONS, not early-exit signals. Continue the current phase normally β€” in Summary that means calling `showAgentMarketplace` next, NOT `finishOnboarding` directly.',
);
if (
phase.includes('Agent Identity') ||
@@ -124,7 +124,7 @@ export class OnboardingActionHintInjector extends BaseVirtualLastUserContentProv
phase.includes('Discovery')
) {
hints.push(
- 'EARLY EXIT REMINDER: A true early-exit signal means the user explicitly wants the onboarding to END β€” examples: "ζˆ‘η΄―δΊ†", "ζˆ‘ε…ˆθ΅°", "δΈ‹ζ¬‘ε†θŠ", "沑空", "ζš‚ζ—ΆδΈεΌ„δΊ†", "η»“ζŸε§", "Thanks, that\'s enough", "I have to go". When you see one (and only then), persist any unsaved fields, give a brief summary, then call `showAgentMarketplace` once and only after the picker resolves call `finishOnboarding`. Skip the picker only if the user explicitly refuses it in words ("δΈη”¨ζŽ¨θ", "εˆ«η»™ζˆ‘θ£…δΈœθ₯Ώ", "skip the picker"); a generic exit signal is NOT a refusal of the picker.',
+ 'EARLY EXIT REMINDER: A true early-exit signal means the user explicitly wants the onboarding to END β€” examples: "I\'m tired", "I have to go", "let\'s chat next time", "no time right now", "let\'s stop for now", "let\'s wrap it up", "that\'s enough"; recognize equivalent phrasing in any language. When you see one (and only then), persist any unsaved fields, persist SOUL.md and the user persona via updateDocument (or writeDocument if either is still empty) β€” best-effort; do NOT retry on failure β€” send a brief warm farewell, then call `finishOnboarding`. Do NOT call `showAgentMarketplace` on early exit β€” that handoff is for normal completion only.',
);
}
diff --git a/src/features/Conversation/FollowUp/FollowUpChips.test.tsx b/src/features/Conversation/FollowUp/FollowUpChips.test.tsx
index 8a60743cb04..6e667b8103f 100644
--- a/src/features/Conversation/FollowUp/FollowUpChips.test.tsx
+++ b/src/features/Conversation/FollowUp/FollowUpChips.test.tsx
@@ -140,7 +140,7 @@ describe('<FollowUpChips />', () => {
expect(updateInputMessageMock).toHaveBeenCalledWith('go ahead');
expect(editorSetDocumentMock).toHaveBeenCalledWith('text', 'go ahead');
expect(editorFocusMock).toHaveBeenCalled();
- // consume() resets state to idle:
- expect(useFollowUpActionStore.getState().status).toBe('idle');
+ // The chip is not consumed on click β€” it stays ready until the user sends.
+ expect(useFollowUpActionStore.getState().status).toBe('ready');
});
});
diff --git a/src/features/Conversation/FollowUp/FollowUpChips.tsx b/src/features/Conversation/FollowUp/FollowUpChips.tsx
index 3f4db8ca443..5e075f1bb9c 100644
--- a/src/features/Conversation/FollowUp/FollowUpChips.tsx
+++ b/src/features/Conversation/FollowUp/FollowUpChips.tsx
@@ -28,7 +28,6 @@ const FollowUpChips = memo<FollowUpChipsProps>(({ messageId, topicId }) => {
[childIdsKey, messageId, topicId],
);
const chips = useFollowUpActionStore(selector);
- const consume = useFollowUpActionStore((s) => s.consume);
const updateInputMessage = useConversationStore((s) => s.updateInputMessage);
const editor = useConversationStore((s) => s.editor);
// Hide chips while the bound group/message is still being generated β€” chips
@@ -39,12 +38,13 @@ const FollowUpChips = memo<FollowUpChipsProps>(({ messageId, topicId }) => {
const handleClick = useCallback(
(chip: FollowUpChip) => {
- consume(chip);
+ updateInputMessage('');
+ editor?.setDocument('text', '');
updateInputMessage(chip.message);
editor?.setDocument('text', chip.message);
editor?.focus();
},
- [consume, updateInputMessage, editor],
+ [updateInputMessage, editor],
);
if (chips.length === 0 || isGenerating) return null;
diff --git a/src/features/Conversation/InterventionBar/style.ts b/src/features/Conversation/InterventionBar/style.ts
index 820e22abf09..276fc8b2436 100644
--- a/src/features/Conversation/InterventionBar/style.ts
+++ b/src/features/Conversation/InterventionBar/style.ts
@@ -12,7 +12,6 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
}
`,
container: css`
- overflow: hidden;
margin-block-end: 12px;
`,
content: css`
diff --git a/src/server/services/agentSignal/sources/hydration/__tests__/clientRuntimeStart.test.ts b/src/server/services/agentSignal/sources/hydration/__tests__/clientRuntimeStart.test.ts
index 9200269a3b1..8d95ceb5e08 100644
--- a/src/server/services/agentSignal/sources/hydration/__tests__/clientRuntimeStart.test.ts
+++ b/src/server/services/agentSignal/sources/hydration/__tests__/clientRuntimeStart.test.ts
@@ -8,7 +8,7 @@ import { uuid } from '@/utils/uuid';
import { resolveClientRuntimeStartFeedbackSource } from '../clientRuntimeStart';
-describe('resolveClientRuntimeStartFeedbackSource', () => {
+describe('resolveClientRuntimeStartFeedbackSource', { timeout: 15_000 }, () => {
/**
* @example
* client.runtime.start({ parentMessageType: "assistant" }) skips hydration with a traceable reason.