Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/telegram_codex_bot/transcript_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ def _display_tool_name(name: str) -> str:
def _is_internal_tool_name(cls, name: str | None) -> bool:
if not isinstance(name, str):
return False
return name.lower() in cls._INTERNAL_TOOL_NAMES
# Codex connector/app tools are exposed in transcripts with private
# underscore-prefixed names (for example _list_repositories). These are
# implementation details and should stay behind the Thinking status
# instead of becoming persistent Telegram bubbles.
return name.startswith("_") or name.lower() in cls._INTERNAL_TOOL_NAMES

@staticmethod
def _clean_runtime_tool_output(output: str) -> str:
Expand Down
43 changes: 43 additions & 0 deletions tests/telegram_codex_bot/test_transcript_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,49 @@ def test_update_plan_function_call_is_hidden_from_messages(self):
assert result == []
assert pending == {}

def test_private_connector_tool_calls_are_hidden_but_thinking_stays(
self, monkeypatch
):
monkeypatch.setattr(config, "show_commentary_messages", True)
thinking_item = {
"type": "response_item",
"timestamp": "2026-05-26T00:00:00Z",
"payload": {
"type": "reasoning",
"summary": [{"type": "summary_text", "text": "checking repos"}],
},
}
use_item = {
"type": "response_item",
"timestamp": "2026-05-26T00:00:01Z",
"payload": {
"type": "function_call",
"call_id": "call_repos",
"name": "_list_repositories",
"arguments": json.dumps({"owner": "QuantStrategyLab"}),
},
}
result_item = {
"type": "response_item",
"timestamp": "2026-05-26T00:00:02Z",
"payload": {
"type": "function_call_output",
"call_id": "call_repos",
"output": '{"repositories": []}',
},
}

entries = [
TranscriptParser.parse_line(json.dumps(thinking_item)),
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 [entry.content_type for entry in result] == ["thinking"]
assert "checking repos" in result[0].text
assert pending == {}

def test_response_item_function_call_output_is_normalized_as_tool_result(self):
item = {
"type": "response_item",
Expand Down
Loading