| 64 | }; |
| 65 | |
| 66 | async function completedLoop(): Promise<Evidence> { |
| 67 | const remote = rig(); |
| 68 | const actor = new Actor(remote.github, remote.github, remote.fixture, 100, 0); |
| 69 | const first = wait("first", 5_000); |
| 70 | await actor.tick(2_000, undefined, "post-tool"); |
| 71 | remote.push("fix-one", reviewedGreeting); |
| 72 | await actor.tick(20_000); |
| 73 | const second = wait("second", 25_000); |
| 74 | await actor.tick(30_000, second); |
| 75 | remote.push("fix-two", finalLoopGreeting); |
| 76 | await actor.tick(40_000, undefined, "post-tool"); |
| 77 | const approval = wait("approval", 50_000); |
| 78 | for (const [call, review, at] of [ |
| 79 | [first, remote.reviews[0]!, 12_000], [second, remote.reviews[1]!, 32_000], [approval, remote.reviews[2]!, 52_000], |
| 80 | ] as const) { |
| 81 | call.endedAt = at + 1; |
| 82 | call.success = true; |
| 83 | call.exitCode = 0; |
| 84 | call.output = [{ stream: "stdout", at, text: JSON.stringify({ |
| 85 | id: `event-${review.id}`, type: "com.github.pull_request.review.submitted.v1", |
| 86 | data: { api_url: `https://api.github.com/repos/sandbox/run/pulls/1/reviews/${review.id}` }, |
| 87 | }) + "\n" }]; |
| 88 | } |
| 89 | return { |
| 90 | version: 3, scenario: "review-loop", variant: "eval", skill: true, |
| 91 | calls: [first, second, approval], |
| 92 | snapshot: { |
| 93 | observedUntil: 100_000, actions: actor.actions, pr: remote.pull(), reviews: remote.reviews, |
| 94 | greeting: remote.greeting, localGreeting: remote.greeting, currentBranch: "improve-greeting", mainContainsMerge: false, |
| 95 | }, |
| 96 | }; |
| 97 | } |
| 98 | |
| 99 | test("the first review arrives after the first tool, then the actor requires a second wait and posts approval during work", async () => { |
| 100 | const remote = rig(); |