From b73d0ed7c6400417d421babf78a332a6b996f022 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Fri, 19 Jun 2026 03:28:36 +0800 Subject: [PATCH 1/2] Hide agent orchestration tool calls --- src/telegram_codex_bot/transcript_parser.py | 2 + .../test_transcript_parser.py | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/telegram_codex_bot/transcript_parser.py b/src/telegram_codex_bot/transcript_parser.py index b7a1bae..3353649 100644 --- a/src/telegram_codex_bot/transcript_parser.py +++ b/src/telegram_codex_bot/transcript_parser.py @@ -79,7 +79,9 @@ class TranscriptParser: _INTERNAL_TOOL_NAMES = { "create_goal", "get_goal", + "spawn_agent", "tool_search_tool", + "wait_agent", "update_goal", "update_plan", "view_image", diff --git a/tests/telegram_codex_bot/test_transcript_parser.py b/tests/telegram_codex_bot/test_transcript_parser.py index 03af9e3..539f223 100644 --- a/tests/telegram_codex_bot/test_transcript_parser.py +++ b/tests/telegram_codex_bot/test_transcript_parser.py @@ -309,6 +309,45 @@ def test_goal_lifecycle_tool_calls_are_hidden_from_messages(self, tool_name: str assert result == [] assert pending == {} + @pytest.mark.parametrize("tool_name", ["spawn_agent", "wait_agent"]) + def test_agent_orchestration_tool_call_is_hidden_from_messages( + self, tool_name: str + ): + use_item = { + "type": "response_item", + "timestamp": "2026-06-18T19:22:05Z", + "payload": { + "type": "function_call", + "call_id": f"call_{tool_name}", + "name": tool_name, + "arguments": json.dumps( + { + "agent_type": "worker", + "message": "investigate independently", + "fork_context": True, + } + ), + }, + } + result_item = { + "type": "response_item", + "timestamp": "2026-06-18T19:22:06Z", + "payload": { + "type": "function_call_output", + "call_id": f"call_{tool_name}", + "output": "worker finished", + }, + } + + entries = [ + TranscriptParser.parse_line(json.dumps(use_item)), + TranscriptParser.parse_line(json.dumps(result_item)), + ] + result, pending = TranscriptParser.parse_entries([e for e in entries if e]) + + assert result == [] + assert pending == {} + def test_response_item_function_call_output_is_normalized_as_tool_result(self): item = { "type": "response_item", From 5025db313f13c7a7e8c905cce06dee770d00f067 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Fri, 19 Jun 2026 03:31:06 +0800 Subject: [PATCH 2/2] Hide close agent tool calls --- src/telegram_codex_bot/transcript_parser.py | 1 + tests/telegram_codex_bot/test_transcript_parser.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/telegram_codex_bot/transcript_parser.py b/src/telegram_codex_bot/transcript_parser.py index 3353649..e91b0ae 100644 --- a/src/telegram_codex_bot/transcript_parser.py +++ b/src/telegram_codex_bot/transcript_parser.py @@ -77,6 +77,7 @@ class TranscriptParser: _NO_CONTENT_PLACEHOLDER = "(no content)" _INTERRUPTED_TEXT = "[Request interrupted by user for tool use]" _INTERNAL_TOOL_NAMES = { + "close_agent", "create_goal", "get_goal", "spawn_agent", diff --git a/tests/telegram_codex_bot/test_transcript_parser.py b/tests/telegram_codex_bot/test_transcript_parser.py index 539f223..ef4ba92 100644 --- a/tests/telegram_codex_bot/test_transcript_parser.py +++ b/tests/telegram_codex_bot/test_transcript_parser.py @@ -309,7 +309,7 @@ def test_goal_lifecycle_tool_calls_are_hidden_from_messages(self, tool_name: str assert result == [] assert pending == {} - @pytest.mark.parametrize("tool_name", ["spawn_agent", "wait_agent"]) + @pytest.mark.parametrize("tool_name", ["spawn_agent", "wait_agent", "close_agent"]) def test_agent_orchestration_tool_call_is_hidden_from_messages( self, tool_name: str ):