-
Notifications
You must be signed in to change notification settings - Fork 49
[Chore] Unskip VS Code e2e replay for mutating tools #92
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
12 commits
Select commit
Hold shift + click to select a range
e1db7da
test(read-file): unskipping read-file tests
edelauna abde03b
test(list-files,search-files): unskip read-only e2e tools
roomote eb505e1
test: unskip mutating vscode e2e tool suites
roomote 9c96559
test(e2e): replace opaque smoke codes with explicit instructions
edelauna ef2b99a
test(e2e): address review feedback on readonly tool fixtures
edelauna 4430443
test(list-files,search-files): unskip read-only e2e tools
roomote 63fc516
test(e2e): replace opaque smoke codes with explicit instructions
edelauna 3d76e4c
test(e2e): address review feedback on readonly tool fixtures
edelauna 009cdd4
test(e2e): address search-files review feedback
edelauna 9fa41b7
test(e2e): address mutating tool review feedback
edelauna dafa9c9
test: validate mutating replay payload fixtures
roomote cb244e4
test: drop read-file fixture whitespace churn
roomote 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "fixtures": [ | ||
| { | ||
| "match": { | ||
| "userMessage": "APPLY_DIFF_SIMPLE_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "apply_diff", | ||
| "arguments": "{\"path\":\"apply-diff-tool-fixture/simple-modify.txt\",\"diff\":\"<<<<<<< SEARCH\\n:start_line:1\\n-------\\nHello World\\n=======\\nHello Universe\\n>>>>>>> REPLACE\"}", | ||
| "id": "call_apply_diff_simple_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "APPLY_DIFF_MULTI_REPLACE_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "apply_diff", | ||
| "arguments": "{\"path\":\"apply-diff-tool-fixture/multiple-replace.js\",\"diff\":\"<<<<<<< SEARCH\\n:start_line:1\\n-------\\nfunction calculate(x, y) {\\n\\tconst sum = x + y\\n\\tconst product = x * y\\n\\treturn { sum: sum, product: product }\\n}\\n=======\\nfunction compute(a, b) {\\n\\tconst total = a + b\\n\\tconst result = a * b\\n\\treturn { total: total, result: result }\\n}\\n>>>>>>> REPLACE\"}", | ||
| "id": "call_apply_diff_multi_replace_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "APPLY_DIFF_LINE_HINTS_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "apply_diff", | ||
| "arguments": "{\"path\":\"apply-diff-tool-fixture/line-hints.js\",\"diff\":\"<<<<<<< SEARCH\\n:start_line:2\\n-------\\nfunction oldFunction() {\\n\\tconsole.log(\\\"Old implementation\\\")\\n}\\n=======\\nfunction newFunction() {\\n\\tconsole.log(\\\"New implementation\\\")\\n}\\n>>>>>>> REPLACE\"}", | ||
| "id": "call_apply_diff_line_hints_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "APPLY_DIFF_ERROR_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "apply_diff", | ||
| "arguments": "{\"path\":\"apply-diff-tool-fixture/error-handling.txt\",\"diff\":\"<<<<<<< SEARCH\\n:start_line:1\\n-------\\nThis content does not exist\\n=======\\nNew content\\n>>>>>>> REPLACE\"}", | ||
| "id": "call_apply_diff_error_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "APPLY_DIFF_MULTI_BLOCK_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "apply_diff", | ||
| "arguments": "{\"path\":\"apply-diff-tool-fixture/multi-search-replace.js\",\"diff\":\"<<<<<<< SEARCH\\n:start_line:1\\n-------\\nfunction processData(data) {\\n\\tconsole.log(\\\"Processing data\\\")\\n=======\\nfunction transformData(data) {\\n\\tconsole.log(\\\"Transforming data\\\")\\n>>>>>>> REPLACE\\n\\n<<<<<<< SEARCH\\n:start_line:12\\n-------\\nfunction validateInput(input) {\\n\\tconsole.log(\\\"Validating input\\\")\\n=======\\nfunction checkInput(input) {\\n\\tconsole.log(\\\"Checking input\\\")\\n>>>>>>> REPLACE\"}", | ||
| "id": "call_apply_diff_multi_block_001" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
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,60 @@ | ||
| { | ||
| "fixtures": [ | ||
| { | ||
| "match": { | ||
| "userMessage": "EXECUTE_COMMAND_SIMPLE_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "execute_command", | ||
| "arguments": "{\"command\":\"printf 'Hello from test\\\\n' > execute-command-tool-fixture/simple-echo.txt\"}", | ||
| "id": "call_execute_command_simple_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "EXECUTE_COMMAND_CWD_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "execute_command", | ||
| "arguments": "{\"command\":\"printf 'Test in subdirectory\\\\n' > output.txt\",\"cwd\":\"execute-command-tool-fixture/custom-cwd\"}", | ||
| "id": "call_execute_command_cwd_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "EXECUTE_COMMAND_MULTI_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "execute_command", | ||
| "arguments": "{\"command\":\"printf 'Line 1\\\\n' > execute-command-tool-fixture/multi-command.txt\"}", | ||
| "id": "call_execute_command_multi_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "EXECUTE_COMMAND_LONG_RUNNING_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "execute_command", | ||
| "arguments": "{\"command\":\"node -e \\\"setTimeout(() => console.log('Command completed after delay'), 1000)\\\"\"}", | ||
| "id": "call_execute_command_long_running_001" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
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,32 @@ | ||
| { | ||
| "fixtures": [ | ||
| { | ||
| "match": { | ||
| "userMessage": "WRITE_TO_FILE_CREATE_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "write_to_file", | ||
| "arguments": "{\"path\":\"write-to-file-tool-fixture/write-to-file-smoke.txt\",\"content\":\"Hello, this is a test file!\"}", | ||
| "id": "call_write_to_file_create_001" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "match": { | ||
| "userMessage": "WRITE_TO_FILE_NESTED_SMOKE" | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "write_to_file", | ||
| "arguments": "{\"path\":\"write-to-file-tool-fixture/nested/deep/directory/write-to-file-nested-smoke.txt\",\"content\":\"File in nested directory\"}", | ||
| "id": "call_write_to_file_nested_001" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
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,63 @@ | ||
| import { LLMock } from "@copilotkit/aimock" | ||
|
|
||
| import { toolResultContains } from "./tool-result" | ||
|
|
||
| type ApplyDiffFixture = { | ||
| toolCallId: string | ||
| expected: string[] | ||
| result: string | ||
| id: string | ||
| } | ||
|
|
||
| export function addApplyDiffResultFixtures(mock: InstanceType<typeof LLMock>) { | ||
| const fixtures: ApplyDiffFixture[] = [ | ||
| { | ||
| toolCallId: "call_apply_diff_simple_001", | ||
| expected: ['"path":"apply-diff-tool-fixture/simple-modify.txt"', '"operation":"modified"'], | ||
| result: "Updated `apply-diff-tool-fixture/simple-modify.txt` to say `Hello Universe`.", | ||
| id: "call_apply_diff_simple_002", | ||
| }, | ||
| { | ||
| toolCallId: "call_apply_diff_multi_replace_001", | ||
| expected: ['"path":"apply-diff-tool-fixture/multiple-replace.js"', '"operation":"modified"'], | ||
| result: "Updated `apply-diff-tool-fixture/multiple-replace.js` with the renamed function, parameters, and return fields.", | ||
| id: "call_apply_diff_multi_replace_002", | ||
| }, | ||
| { | ||
| toolCallId: "call_apply_diff_line_hints_001", | ||
| expected: ['"path":"apply-diff-tool-fixture/line-hints.js"', '"operation":"modified"'], | ||
| result: "Updated `apply-diff-tool-fixture/line-hints.js` so `oldFunction` became `newFunction` with the new log message.", | ||
| id: "call_apply_diff_line_hints_002", | ||
| }, | ||
| { | ||
| toolCallId: "call_apply_diff_error_001", | ||
| expected: ["No sufficiently similar match found at line: 1", "This content does not exist"], | ||
| result: "The apply_diff operation on `apply-diff-tool-fixture/error-handling.txt` was rejected - the search content did not match any content in the file, so it was not modified.", | ||
| id: "call_apply_diff_error_002", | ||
| }, | ||
| { | ||
| toolCallId: "call_apply_diff_multi_block_001", | ||
| expected: ['"path":"apply-diff-tool-fixture/multi-search-replace.js"', '"operation":"modified"'], | ||
| result: "Applied both search/replace blocks in `apply-diff-tool-fixture/multi-search-replace.js` to rename the two target functions.", | ||
| id: "call_apply_diff_multi_block_002", | ||
| }, | ||
| ] | ||
|
|
||
| for (const fixture of fixtures) { | ||
| mock.addFixture({ | ||
| match: { | ||
| toolCallId: fixture.toolCallId, | ||
| predicate: (req) => toolResultContains(req, fixture.toolCallId, fixture.expected), | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| arguments: JSON.stringify({ result: fixture.result }), | ||
| id: fixture.id, | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
| } | ||
| } | ||
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,101 @@ | ||
| import { LLMock } from "@copilotkit/aimock" | ||
|
|
||
| import { toolResultContains } from "./tool-result" | ||
|
|
||
| type ExecuteCommandToolCall = { | ||
| name: "execute_command" | "attempt_completion" | ||
| params: Record<string, unknown> | ||
| id: string | ||
| } | ||
|
|
||
| type ExecuteCommandFixture = { | ||
| toolCallId: string | ||
| expected: string[] | ||
| toolCalls: ExecuteCommandToolCall[] | ||
| } | ||
|
|
||
| export function addExecuteCommandResultFixtures(mock: InstanceType<typeof LLMock>) { | ||
| const fixtures: ExecuteCommandFixture[] = [ | ||
| { | ||
| toolCallId: "call_execute_command_simple_001", | ||
| expected: ["Command executed in terminal within working directory '", "Exit code: 0\nOutput:\n"], | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| params: { | ||
| result: "Ran the echo command and created `execute-command-tool-fixture/simple-echo.txt`.", | ||
| }, | ||
| id: "call_execute_command_simple_002", | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| toolCallId: "call_execute_command_cwd_001", | ||
| expected: ["execute-command-tool-fixture/custom-cwd'. Exit code: 0", "Output:\n"], | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| params: { | ||
| result: "Ran the command inside `execute-command-tool-fixture/custom-cwd` and created `output.txt`.", | ||
| }, | ||
| id: "call_execute_command_cwd_002", | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| toolCallId: "call_execute_command_multi_001", | ||
| expected: ["Command executed in terminal within working directory '", "Exit code: 0\nOutput:\n"], | ||
| toolCalls: [ | ||
| { | ||
| name: "execute_command", | ||
| params: { | ||
| command: "printf 'Line 2\\n' >> execute-command-tool-fixture/multi-command.txt", | ||
| }, | ||
| id: "call_execute_command_multi_002", | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| toolCallId: "call_execute_command_multi_002", | ||
| expected: ["Command executed in terminal within working directory '", "Exit code: 0\nOutput:\n"], | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| params: { | ||
| result: "Ran both commands and populated `execute-command-tool-fixture/multi-command.txt` with two lines.", | ||
| }, | ||
| id: "call_execute_command_multi_003", | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| toolCallId: "call_execute_command_long_running_001", | ||
| expected: ["Exit code: 0", "Command completed after delay"], | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| params: { | ||
| result: "The delayed command completed and printed `Command completed after delay`.", | ||
| }, | ||
| id: "call_execute_command_long_running_002", | ||
| }, | ||
| ], | ||
| }, | ||
| ] | ||
|
|
||
| for (const fixture of fixtures) { | ||
| mock.addFixture({ | ||
| match: { | ||
| toolCallId: fixture.toolCallId, | ||
| predicate: (req) => toolResultContains(req, fixture.toolCallId, fixture.expected), | ||
| }, | ||
| response: { | ||
| toolCalls: fixture.toolCalls.map((toolCall) => ({ | ||
| name: toolCall.name, | ||
| arguments: JSON.stringify(toolCall.params), | ||
| id: toolCall.id, | ||
| })), | ||
| }, | ||
| }) | ||
| } | ||
| } |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.