diff --git a/dotnet/test/HooksTests.cs b/dotnet/test/HooksTests.cs index 21479a376..a37ef3c15 100644 --- a/dotnet/test/HooksTests.cs +++ b/dotnet/test/HooksTests.cs @@ -46,8 +46,7 @@ await session.SendAsync(new MessageOptions Assert.Contains(preToolUseInputs, i => !string.IsNullOrEmpty(i.ToolName)); } - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - [Fact(Skip = "Runtime postToolUse hooks broken")] + [Fact] public async Task Should_Invoke_PostToolUse_Hook_After_Model_Runs_A_Tool() { var postToolUseInputs = new List(); @@ -84,8 +83,7 @@ await session.SendAsync(new MessageOptions Assert.Contains(postToolUseInputs, i => i.ToolResult != null); } - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - [Fact(Skip = "Runtime postToolUse hooks broken")] + [Fact] public async Task Should_Invoke_Both_PreToolUse_And_PostToolUse_Hooks_For_Single_Tool_Call() { var preToolUseInputs = new List(); diff --git a/go/internal/e2e/hooks_test.go b/go/internal/e2e/hooks_test.go index 2b8a63921..70aa6ec71 100644 --- a/go/internal/e2e/hooks_test.go +++ b/go/internal/e2e/hooks_test.go @@ -74,9 +74,7 @@ func TestHooks(t *testing.T) { } }) - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) t.Run("should invoke postToolUse hook after model runs a tool", func(t *testing.T) { - t.Skip("Runtime postToolUse hooks broken") ctx.ConfigureForTest(t) var postToolUseInputs []copilot.PostToolUseHookInput @@ -141,9 +139,7 @@ func TestHooks(t *testing.T) { } }) - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) t.Run("should invoke both preToolUse and postToolUse hooks for a single tool call", func(t *testing.T) { - t.Skip("Runtime postToolUse hooks broken") ctx.ConfigureForTest(t) var preToolUseInputs []copilot.PreToolUseHookInput diff --git a/nodejs/test/e2e/hooks.test.ts b/nodejs/test/e2e/hooks.test.ts index c510d7154..9743d91f3 100644 --- a/nodejs/test/e2e/hooks.test.ts +++ b/nodejs/test/e2e/hooks.test.ts @@ -48,8 +48,7 @@ describe("Session hooks", async () => { await session.disconnect(); }); - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - it.skip("should invoke postToolUse hook after model runs a tool", async () => { + it("should invoke postToolUse hook after model runs a tool", async () => { const postToolUseInputs: PostToolUseHookInput[] = []; const session = await client.createSession({ @@ -80,8 +79,7 @@ describe("Session hooks", async () => { await session.disconnect(); }); - // TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - it.skip("should invoke both preToolUse and postToolUse hooks for a single tool call", async () => { + it("should invoke both preToolUse and postToolUse hooks for a single tool call", async () => { const preToolUseInputs: PreToolUseHookInput[] = []; const postToolUseInputs: PostToolUseHookInput[] = []; diff --git a/python/e2e/test_hooks.py b/python/e2e/test_hooks.py index 2ecdc6b07..e355f3a80 100644 --- a/python/e2e/test_hooks.py +++ b/python/e2e/test_hooks.py @@ -41,8 +41,6 @@ async def on_pre_tool_use(input_data, invocation): await session.disconnect() - # TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - @pytest.mark.skip(reason="Runtime postToolUse hooks broken") async def test_should_invoke_posttooluse_hook_after_model_runs_a_tool( self, ctx: E2ETestContext ): @@ -73,8 +71,6 @@ async def on_post_tool_use(input_data, invocation): await session.disconnect() - # TODO: Re-enable once runtime postToolUse hooks are fixed (https://github.com/github/copilot-sdk/issues/972) - @pytest.mark.skip(reason="Runtime postToolUse hooks broken") async def test_should_invoke_both_pretooluse_and_posttooluse_hooks_for_a_single_tool_call( self, ctx: E2ETestContext ): diff --git a/test/snapshots/hooks/invoke_both_hooks_for_single_tool_call.yaml b/test/snapshots/hooks/invoke_both_hooks_for_single_tool_call.yaml deleted file mode 100644 index 0bb88c130..000000000 --- a/test/snapshots/hooks/invoke_both_hooks_for_single_tool_call.yaml +++ /dev/null @@ -1,47 +0,0 @@ -models: - - claude-sonnet-4.5 -conversations: - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of both.txt - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - role: assistant - tool_calls: - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/both.txt"}' - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of both.txt - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/both.txt"}' - - role: tool - tool_call_id: toolcall_0 - content: Intent logged - - role: tool - tool_call_id: toolcall_1 - content: 1. Testing both hooks! - - role: assistant - content: 'The file contains: "Testing both hooks!"' diff --git a/test/snapshots/hooks/invoke_post_tool_use_hook_after_model_runs_a_tool.yaml b/test/snapshots/hooks/invoke_post_tool_use_hook_after_model_runs_a_tool.yaml deleted file mode 100644 index 59369b1c8..000000000 --- a/test/snapshots/hooks/invoke_post_tool_use_hook_after_model_runs_a_tool.yaml +++ /dev/null @@ -1,47 +0,0 @@ -models: - - claude-sonnet-4.5 -conversations: - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of world.txt and tell me what it says - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - role: assistant - tool_calls: - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/world.txt"}' - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of world.txt and tell me what it says - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/world.txt"}' - - role: tool - tool_call_id: toolcall_0 - content: Intent logged - - role: tool - tool_call_id: toolcall_1 - content: 1. World from the test! - - role: assistant - content: 'The file world.txt contains: "World from the test!"' diff --git a/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_a_single_tool_call.yaml b/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_a_single_tool_call.yaml index dd55858bf..27ccee618 100644 --- a/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_a_single_tool_call.yaml +++ b/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_a_single_tool_call.yaml @@ -6,6 +6,8 @@ conversations: content: ${system} - role: user content: Read the contents of both.txt + - role: assistant + content: I'll read the contents of both.txt for you. - role: assistant tool_calls: - id: toolcall_0 @@ -26,6 +28,7 @@ conversations: - role: user content: Read the contents of both.txt - role: assistant + content: I'll read the contents of both.txt for you. tool_calls: - id: toolcall_0 type: function @@ -44,4 +47,8 @@ conversations: tool_call_id: toolcall_1 content: 1. Testing both hooks! - role: assistant - content: 'The file contains a single line: "Testing both hooks!"' + content: |- + The file `both.txt` contains a single line: + ``` + Testing both hooks! + ``` diff --git a/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_single_tool_call.yaml b/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_single_tool_call.yaml deleted file mode 100644 index ff422fee1..000000000 --- a/test/snapshots/hooks/should_invoke_both_pretooluse_and_posttooluse_hooks_for_single_tool_call.yaml +++ /dev/null @@ -1,47 +0,0 @@ -models: - - claude-sonnet-4.5 -conversations: - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of both.txt - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - role: assistant - tool_calls: - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/both.txt"}' - - messages: - - role: system - content: ${system} - - role: user - content: Read the contents of both.txt - - role: assistant - tool_calls: - - id: toolcall_0 - type: function - function: - name: report_intent - arguments: '{"intent":"Reading file contents"}' - - id: toolcall_1 - type: function - function: - name: view - arguments: '{"path":"${workdir}/both.txt"}' - - role: tool - tool_call_id: toolcall_0 - content: Intent logged - - role: tool - tool_call_id: toolcall_1 - content: 1. Testing both hooks! - - role: assistant - content: 'The file `both.txt` contains: "Testing both hooks!"' diff --git a/test/snapshots/hooks/should_invoke_posttooluse_hook_after_model_runs_a_tool.yaml b/test/snapshots/hooks/should_invoke_posttooluse_hook_after_model_runs_a_tool.yaml index 518f6d06e..5f592eab2 100644 --- a/test/snapshots/hooks/should_invoke_posttooluse_hook_after_model_runs_a_tool.yaml +++ b/test/snapshots/hooks/should_invoke_posttooluse_hook_after_model_runs_a_tool.yaml @@ -6,6 +6,8 @@ conversations: content: ${system} - role: user content: Read the contents of world.txt and tell me what it says + - role: assistant + content: I'll read the contents of world.txt for you. - role: assistant tool_calls: - id: toolcall_0 @@ -26,6 +28,7 @@ conversations: - role: user content: Read the contents of world.txt and tell me what it says - role: assistant + content: I'll read the contents of world.txt for you. tool_calls: - id: toolcall_0 type: function @@ -44,4 +47,8 @@ conversations: tool_call_id: toolcall_1 content: 1. World from the test! - role: assistant - content: 'The file contains: "World from the test!"' + content: |- + The file **world.txt** contains: + ``` + World from the test! + ```