


























@@ -3865,87 +3865,73 @@ describe("matrix live qa scenarios", () => {
3865386538663866it("keeps Matrix-looking tool progress mentions inert in partial previews", async () => {
38673867const previewEventId = "$tool-progress-mention-preview";
3868-const gatewayWorkspaceDir = await mkdtemp(path.join(os.tmpdir(), "matrix-qa-workspace-"));
3869-try {
3870-const { sendTextMessage } = mockMatrixQaRoomClient({
3871-driverEventId: "$tool-progress-mention-trigger",
3872-events: [
3873-{
3874-event: matrixQaMessageEvent({
3875-kind: "message",
3868+const { sendTextMessage } = mockMatrixQaRoomClient({
3869+driverEventId: "$tool-progress-mention-trigger",
3870+events: [
3871+{
3872+event: matrixQaMessageEvent({
3873+kind: "message",
3874+eventId: previewEventId,
3875+body: "Working...\n- `tool: exec`",
3876+}),
3877+since: "driver-sync-preview",
3878+},
3879+{
3880+event: matrixQaMessageEvent({
3881+kind: "message",
3882+eventId: "$tool-progress-mention-edit",
3883+body:
3884+'Working...\n- `search "matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt" in . -> run sleep 2`',
3885+formattedBody:
3886+'Working...<br><ul><li><code>search "matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt" in . -> run sleep 2</code></li></ul>',
3887+mentions: {},
3888+relatesTo: {
3889+relType: "m.replace",
38763890eventId: previewEventId,
3877-body: "Working...\n- `tool: read`",
3878-}),
3879-since: "driver-sync-preview",
3880-},
3881-{
3882-event: matrixQaMessageEvent({
3891+},
3892+}),
3893+since: "driver-sync-progress",
3894+},
3895+{
3896+event: ({ sendTextMessage }) =>
3897+matrixQaMessageEvent({
38833898kind: "message",
3884-eventId: "$tool-progress-mention-edit",
3885-body: "Working...\n- `tool: read`\n- `read from matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt`",
3886-formattedBody:
3887-"Working...<br><ul><li><code>read from matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt</code></li></ul>",
3888-mentions: {},
3899+eventId: "$tool-progress-mention-final",
3900+body: readMatrixQaReplyDirective(
3901+ mockMessageBody(sendTextMessage, "sendTextMessage"),
3902+"MATRIX_QA_TOOL_PROGRESS_MENTION_SAFE_FIXED",
3903+),
38893904relatesTo: {
38903905relType: "m.replace",
38913906eventId: previewEventId,
38923907},
38933908}),
3894-since: "driver-sync-progress",
3895-},
3896-{
3897-event: ({ sendTextMessage }) =>
3898-matrixQaMessageEvent({
3899-kind: "message",
3900-eventId: "$tool-progress-mention-final",
3901-body: readMatrixQaReplyDirective(
3902-mockMessageBody(sendTextMessage, "sendTextMessage"),
3903-"MATRIX_QA_TOOL_PROGRESS_MENTION_SAFE_FIXED",
3904-),
3905-relatesTo: {
3906-relType: "m.replace",
3907-eventId: previewEventId,
3908-},
3909-}),
3910-since: "driver-sync-next",
3911-},
3912-],
3913-});
3909+since: "driver-sync-next",
3910+},
3911+],
3912+});
391439133915- const scenario = requireMatrixQaScenario("matrix-room-tool-progress-mention-safety");
3914+const scenario = requireMatrixQaScenario("matrix-room-tool-progress-mention-safety");
391639153917-const result = await runMatrixQaScenario(scenario, {
3918- ...matrixQaScenarioContext(),
3919- gatewayWorkspaceDir,
3920-});
3921-const artifacts = result.artifacts as {
3922-driverEventId?: unknown;
3923-previewEventId?: unknown;
3924-previewMentions?: unknown;
3925-reply?: { eventId?: unknown };
3926-token?: unknown;
3927-};
3928-expect(artifacts.driverEventId).toBe("$tool-progress-mention-trigger");
3929-expect(artifacts.previewEventId).toBe("$tool-progress-mention-preview");
3930-expect(artifacts.previewMentions).toEqual({});
3931-expect(artifacts.reply?.eventId).toBe("$tool-progress-mention-final");
3932-const prompt = mockMessageBody(sendTextMessage, "sendTextMessage");
3933-expect(prompt).toContain(
3934-"call the read tool exactly once on `matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt`",
3935-);
3936-expect(prompt).toContain("Do not use search for this check.");
3937-await expect(
3938-readFile(
3939-path.join(
3940-gatewayWorkspaceDir,
3941-"matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt",
3942-),
3943-"utf8",
3944-),
3945-).resolves.toContain(String(artifacts.token));
3946-} finally {
3947-await rm(gatewayWorkspaceDir, { force: true, recursive: true });
3948-}
3916+const result = await runMatrixQaScenario(scenario, matrixQaScenarioContext());
3917+const artifacts = result.artifacts as {
3918+driverEventId?: unknown;
3919+previewEventId?: unknown;
3920+previewMentions?: unknown;
3921+reply?: { eventId?: unknown };
3922+};
3923+expect(artifacts.driverEventId).toBe("$tool-progress-mention-trigger");
3924+expect(artifacts.previewEventId).toBe("$tool-progress-mention-preview");
3925+expect(artifacts.previewMentions).toEqual({});
3926+expect(artifacts.reply?.eventId).toBe("$tool-progress-mention-final");
3927+const prompt = mockMessageBody(sendTextMessage, "sendTextMessage");
3928+expect(prompt).toContain(
3929+"call the exec tool exactly once with this exact command before answering",
3930+);
3931+expect(prompt).toContain(
3932+"`rg -n 'matrix-progress-@room-@alice:matrix-qa.test-!room:matrix-qa.test.txt' . ; sleep 2`",
3933+);
3934+expect(prompt).toContain("The QA harness must observe that exec tool call");
39493935});
3950393639513937it("preserves separate finalized block events when Matrix block streaming is enabled", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。