FN-6633: guide chat agents to ask questions for options
Encourage dashboard chat agents to turn option sets into selectable ask-question cards. - Expand chat-lane prompt guidance so options, choices, and alternatives use `fn_ask_question` instead of prose-only lists. - Cover the guidance in chat manager tests and assert the prompt is passed to resolved sessions. - Record the patch changeset and quarantine unrelated flaky dashboard tests observed during verification. Files changed: .changeset/fn-6633-chat-question-guidance.md | 5 +++++ packages/dashboard/src/__tests__/chat-manager.test.ts | 14 +++++++++++++- packages/dashboard/src/chat.ts | 5 ++++- packages/dashboard/vitest.config.ts | 9 ++++++++- scripts/lib/test-quarantine.json | 10 ++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) Fusion-Task-Id: FN-6633 Fusion-Task-Lineage: e59371d3-b198-4fe8-a70c-b94994060c59
This commit is contained in:
5
.changeset/fn-6633-chat-question-guidance.md
Normal file
5
.changeset/fn-6633-chat-question-guidance.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
Encourage dashboard chat agents to use structured `fn_ask_question` cards when offering choices or alternatives.
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
chatStreamManager,
|
||||
__getChatDiagnostics,
|
||||
__setChatDiagnostics,
|
||||
CHAT_ASK_QUESTION_GUIDANCE,
|
||||
} from "../chat.js";
|
||||
|
||||
// ── Mock Setup ──────────────────────────────────────────────────────────────
|
||||
@@ -1167,10 +1168,21 @@ describe("ChatManager.sendMessage", () => {
|
||||
|
||||
await chatManager.sendMessage("chat-001", "Hello");
|
||||
|
||||
const customTools = createResolvedSession.mock.calls[0]?.[0]?.customTools ?? [];
|
||||
const createOptions = createResolvedSession.mock.calls[0]?.[0];
|
||||
const customTools = createOptions?.customTools ?? [];
|
||||
expect(customTools.map((tool: { name: string }) => tool.name)).toContain("fn_ask_question");
|
||||
expect(customTools.map((tool: { name: string }) => tool.name)).not.toContain("fn_send_message");
|
||||
expect(customTools.map((tool: { name: string }) => tool.name)).not.toContain("fn_read_messages");
|
||||
expect(createOptions?.systemPrompt).toContain(CHAT_ASK_QUESTION_GUIDANCE);
|
||||
});
|
||||
|
||||
it("guides chat agents to use ask-question cards for option sets", () => {
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toContain("## Asking the User");
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toContain("fn_ask_question");
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toMatch(/options|choices|alternatives/);
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toContain("instead of listing options only in prose");
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toContain("single_select");
|
||||
expect(CHAT_ASK_QUESTION_GUIDANCE).toContain("multi_select");
|
||||
});
|
||||
|
||||
it("uses the assigned built-in pi agent model when the chat session has no explicit model override", async () => {
|
||||
|
||||
@@ -211,8 +211,11 @@ export const CHAT_AGENT_MESSAGE_ROUTING_GUIDANCE = `## Messaging Semantics\n\nYo
|
||||
/**
|
||||
* FNXC:ChatAskQuestion 2026-06-17-13:17:
|
||||
* Only the dashboard chat lane registers `fn_ask_question`, so append this guidance during sendMessage prompt assembly instead of baking it into room-responder prompts that do not receive the tool.
|
||||
*
|
||||
* FNXC:ChatAskQuestion 2026-06-18-05:53:
|
||||
* Agents presenting a set of options, choices, or alternatives should render them as `fn_ask_question` cards instead of prose so users can select an answer in chat.
|
||||
*/
|
||||
export const CHAT_ASK_QUESTION_GUIDANCE = `## Asking the User\n\nWhen you need structured input, call \`fn_ask_question\` with one or more questions, then stop and wait for the user's next chat message.`;
|
||||
export const CHAT_ASK_QUESTION_GUIDANCE = `## Asking the User\n\nWhen you need structured input, or whenever you present options, choices, or a decision between alternatives, call \`fn_ask_question\` with one or more questions using the right shape (single_select, multi_select, confirm/yes-no, or text) instead of listing options only in prose, then stop and wait for the user's next chat message.`;
|
||||
|
||||
/** Rate limiting window in milliseconds (1 minute) */
|
||||
const RATE_LIMIT_WINDOW_MS = 60 * 1000;
|
||||
|
||||
@@ -253,8 +253,15 @@ Quarantine the cleanup-flaky file under the deletion ratchet rather than changin
|
||||
FNXC:DashboardTestQuarantine 2026-06-17-16:12:
|
||||
FN-6593 deletes github-tracking-hook under the ratchet because the temp-cleanup ENOTEMPTY flake did not have a non-appeasement root-cause fix in this follow-up.
|
||||
Keep the ledger entry and exclude removed together; git history remains the archive for this dropped GitHub tracking hook coverage.
|
||||
|
||||
FNXC:DashboardTestQuarantine 2026-06-18-06:12:
|
||||
FN-6633 workspace verification observed unrelated QuickEntryBox focus and chat-routes SSE lifecycle flakes after the targeted chat prompt regression suite passed.
|
||||
Quarantine the files under the deletion ratchet so this prompt-only chat guidance change does not appease flaky timing/focus behavior.
|
||||
*/
|
||||
const quarantinedDashboardTests: string[] = [];
|
||||
const quarantinedDashboardTests: string[] = [
|
||||
"app/components/__tests__/QuickEntryBox.test.tsx",
|
||||
"src/__tests__/chat-routes.test.ts",
|
||||
];
|
||||
|
||||
const qualityApiTests = [
|
||||
// Critical HTTP/server behavior: auth, task/project/settings mutation,
|
||||
|
||||
@@ -5,6 +5,16 @@
|
||||
"file": "plugins/fusion-plugin-paperclip-runtime/src/__tests__/paperclip-client.test.ts",
|
||||
"reason": "FN-6631 broad `pnpm test` run observed unrelated Paperclip CLI spawn-mock timeouts and unhandled ENOENT errors in mintAgentApiKeyViaCli coverage; targeted Command Center/core checks, lint, typecheck, build, and engine tests passed. Quarantined per deletion-ratchet policy pending Paperclip runtime owner rescue.",
|
||||
"quarantinedAt": "2026-06-18"
|
||||
},
|
||||
{
|
||||
"file": "packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx",
|
||||
"reason": "FN-6633 workspace pnpm test observed focus-restoration assertion flake after this task's targeted chat-manager coverage passed; unrelated dashboard jsdom focus race, quarantined under deletion ratchet instead of appeasement.",
|
||||
"quarantinedAt": "2026-06-18"
|
||||
},
|
||||
{
|
||||
"file": "packages/dashboard/src/__tests__/chat-routes.test.ts",
|
||||
"reason": "FN-6633 workspace pnpm test observed SSE lifecycle test timeout after this task's targeted chat-manager coverage passed; unrelated dashboard route timing flake, quarantined under deletion ratchet instead of broadening this prompt-only change.",
|
||||
"quarantinedAt": "2026-06-18"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user