Repository navigation
test(evals): Make the asking evals realistic, and ask for draft facts #2518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5d2c85b
fix(images): Say that an unreadable image file exists but is not imag…
sentry-junior[bot] 949f470
fix(evals): Read the posts of one split Slack reply as one reply
sentry-junior[bot] 0d8683e
test(guardian): Allow a direct reminder to the creator from a public …
sentry-junior[bot] 093e4bb
fix(automations): Say that outcomes set where an automation's message…
sentry-junior[bot] 283b45d
fix(vision): Say that an image attachment arrived when vision cannot …
sentry-junior[bot] 24f824e
test(evals): Use a realistic request in the blocked child asking case
sentry-junior[bot] 8f44b31
fix(prompt): Use a neutral example for a gap that nobody can fill
sentry-junior[bot] f1de597
fix(prompt): Ask for a fact that only the person knows
sentry-junior[bot] 7996903
Revert "fix(prompt): Ask for a fact that only the person knows"
sentry-junior[bot] 1582603
test(evals): Make the out-of-office case need the return day
sentry-junior[bot] 04cfdb3
fix(prompt): Ask for the facts behind a draft placeholder
sentry-junior[bot] f215517
fix(evals): Read a reply split inside a code block as one reply
sentry-junior[bot] 0a23d5e
fix(evals): Keep real code fences when reading split replies
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
packages/junior-evals/tests/unit/fixture/results.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { splitSlackReplyText } from "@/chat/slack/output"; | ||
| import { slackCallReplies } from "@junior-evals/fixture/results"; | ||
|
|
||
| // Long enough that Slack delivery splits it into three posts. | ||
| const answer = Array.from( | ||
| { length: 100 }, | ||
| (_, step) => `${step + 1}. Take a **heap snapshot** and compare it.`, | ||
| ).join("\n"); | ||
|
|
||
| function read(texts: string[], text = answer) { | ||
| return slackCallReplies({ | ||
| conversationId: "conversation", | ||
| durable: { | ||
| replies: [ | ||
| { | ||
| conversationId: "conversation", | ||
| messageId: "message-1", | ||
| text, | ||
| }, | ||
| ], | ||
| visibleMessages: [], | ||
| }, | ||
| posts: texts.map((text, index) => ({ | ||
| channel: "C1", | ||
| text, | ||
| ts: `1.00000${index + 1}`, | ||
| })), | ||
| }); | ||
| } | ||
|
|
||
| describe("slackCallReplies", () => { | ||
| it("reads the posts of one split reply as one reply", () => { | ||
| const posts = splitSlackReplyText(answer); | ||
| expect(posts).toHaveLength(3); | ||
|
|
||
| const { replies, visibleMessages } = read(posts); | ||
|
|
||
| expect(replies).toEqual([ | ||
| expect.objectContaining({ messageId: "message-1" }), | ||
| ]); | ||
| expect(visibleMessages).toEqual([]); | ||
| }); | ||
|
|
||
| it("reads a split inside a code block as one reply", () => { | ||
| const code = [ | ||
| "Run this script:", | ||
| "```ts", | ||
| ...Array.from( | ||
| { length: 120 }, | ||
| (_, line) => `console.log("heap step ${line + 1}");`, | ||
| ), | ||
| "```", | ||
| ].join("\n"); | ||
| const posts = splitSlackReplyText(code); | ||
| // Delivery closes the block at the end of a post and opens it again in | ||
| // the next post. | ||
| expect(posts.length).toBeGreaterThan(1); | ||
| expect(posts[1]).toMatch(/^```ts\n/); | ||
|
|
||
| const { replies, visibleMessages } = read(posts, code); | ||
|
|
||
| expect(replies).toEqual([ | ||
| expect.objectContaining({ messageId: "message-1" }), | ||
| ]); | ||
| expect(visibleMessages).toEqual([]); | ||
| }); | ||
|
|
||
| it("keeps the fences of two code blocks split between them", () => { | ||
| const block = (step: number) => [ | ||
| "```ts", | ||
| ...Array.from( | ||
| { length: 40 }, | ||
| (_, line) => `console.log("step ${step} line ${line + 1}");`, | ||
| ), | ||
| "```", | ||
| ]; | ||
| const code = [...block(1), ...block(2)].join("\n"); | ||
| const posts = splitSlackReplyText(code); | ||
| // The cut is between the blocks, so it has the same fence close and | ||
| // reopen as a split inside one block. | ||
| expect(posts).toHaveLength(2); | ||
| expect(posts[1]).toMatch(/^```ts\nconsole\.log\("step 2 line 1"\)/); | ||
|
|
||
| const { replies, visibleMessages } = read(posts, code); | ||
|
|
||
| expect(replies).toEqual([ | ||
| expect.objectContaining({ messageId: "message-1" }), | ||
| ]); | ||
| expect(visibleMessages).toEqual([]); | ||
| }); | ||
|
|
||
| it("reads a repeated post of the reply as another reply", () => { | ||
| const { replies, visibleMessages } = read([answer, answer]); | ||
|
|
||
| expect(replies.map((reply) => reply.messageId)).toEqual([ | ||
| "message-1", | ||
| "slack:1.000002", | ||
| ]); | ||
| expect(visibleMessages).toEqual([{ content: answer, role: "assistant" }]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fence-only posts break reply matching
Low Severity
comparableTextnow drops every fence line, so a Slack split whose first chunk is only a fence close or reopen becomes an emptypostTextsentry.postCountthen returns immediately and never joins the later chunks, soslackCallRepliesmisses the stored reply.Additional Locations (1)
packages/junior-evals/src/fixture/results.ts#L358-L367Reviewed by Cursor Bugbot for commit 0a23d5e. Configure here.