From a31418134f2b05bdb0bdaa4d4e15787a4a52aab0 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Tue, 9 Jun 2026 02:41:04 +0800 Subject: [PATCH] Hide goal tool prompts --- src/telegram_codex_bot/transcript_parser.py | 10 +++++- .../test_transcript_parser.py | 31 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/telegram_codex_bot/transcript_parser.py b/src/telegram_codex_bot/transcript_parser.py index 84ce889..2e08100 100644 --- a/src/telegram_codex_bot/transcript_parser.py +++ b/src/telegram_codex_bot/transcript_parser.py @@ -76,7 +76,15 @@ class TranscriptParser: # Magic string constants _NO_CONTENT_PLACEHOLDER = "(no content)" _INTERRUPTED_TEXT = "[Request interrupted by user for tool use]" - _INTERNAL_TOOL_NAMES = {"update_plan", "view_image", "viewimage"} + _INTERNAL_TOOL_NAMES = { + "create_goal", + "get_goal", + "tool_search_tool", + "update_goal", + "update_plan", + "view_image", + "viewimage", + } _MAX_SUMMARY_LENGTH = 200 _AUTH_ERROR_HINT_MARKERS = ( "could not be refreshed", diff --git a/tests/telegram_codex_bot/test_transcript_parser.py b/tests/telegram_codex_bot/test_transcript_parser.py index 64e62a2..59ab415 100644 --- a/tests/telegram_codex_bot/test_transcript_parser.py +++ b/tests/telegram_codex_bot/test_transcript_parser.py @@ -249,6 +249,37 @@ def test_view_image_tool_calls_are_hidden_from_messages(self): assert result == [] assert pending == {} + @pytest.mark.parametrize("tool_name", ["get_goal", "create_goal", "update_goal"]) + def test_goal_lifecycle_tool_calls_are_hidden_from_messages(self, tool_name: str): + use_item = { + "type": "response_item", + "timestamp": "2026-06-08T09:40:05Z", + "payload": { + "type": "function_call", + "call_id": f"call_{tool_name}", + "name": tool_name, + "arguments": json.dumps({"status": "complete"}), + }, + } + result_item = { + "type": "response_item", + "timestamp": "2026-06-08T09:40:06Z", + "payload": { + "type": "function_call_output", + "call_id": f"call_{tool_name}", + "output": json.dumps({"goal": {"status": "complete"}}), + }, + } + + 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",