Alishahryar1
710e532888
lint
2026-02-14 19:17:51 -08:00
Alishahryar1
9be9943401
Improved test coverage
2026-02-14 19:17:19 -08:00
Alishahryar1
ba344f26c9
Revamped logging
2026-02-14 18:55:33 -08:00
Alishahryar1
64e5b10612
Refactor done by z-ai/glm5
2026-02-14 18:47:26 -08:00
Cursor Agent
1cface7f8c
Fix all ty check errors without using type: ignore
...
- messaging/telegram.py: Remove unused type: ignore, fix retry_after typing
with isinstance(timedelta), use local app variable for None narrowing
- messaging/tree_data.py: Replace _queue._queue access with drain-and-restore
approach for get_queue_snapshot (avoids private API)
- tests/test_api.py: Use APIError instead of RuntimeError for status_code test
- tests/test_config.py: Use cast(Any, ...) for invalid validation tests
- tests/test_dependencies.py: Add isinstance check for NvidiaNimProvider
- tests/test_handler_markdown_and_status_edges.py: Use patch.object for
tree_queue method mocks
- tests/test_response_models.py: Add isinstance narrowing for content blocks,
use Literal list for stop_reason parametrization
- tests/test_restart_reply_restore.py: Use patch.object for enqueue mock
- tests/test_server_module.py: Use patch.object for uvicorn.run and
get_settings
- tests/test_telegram_edge_cases.py: Use patch.object for method mocks
- tests/test_tree_concurrency.py: Add None assertions for get_node/get_tree
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 02:28:33 +00:00
Alishahryar1
25b9d9d1e4
Added ruff and ty dependencies and lint
2026-02-14 18:00:21 -08:00
Cursor Agent
959d1bdf5b
Phase 5: Encapsulation - Repository and MessageTree API
...
TreeRepository:
- Add has_node(node_id) -> bool
- Add tree_count() -> int
MessageTree:
- Add cancel_current_task() -> bool
- Add drain_queue_and_mark_cancelled() -> List[MessageNode]
- Add reset_processing_state()
- Add current_node_id property
TreeQueueManager:
- Remove _trees and _node_to_tree properties
- add_to_tree: use has_node() and get_tree_for_node()
- get_tree_count: use repository.tree_count()
- cancel_tree: use tree.cancel_current_task(), drain_queue_and_mark_cancelled(), reset_processing_state()
TreeQueueProcessor:
- cancel_current: delegate to tree.cancel_current_task()
Tests: update to use get_tree_count(), has_node(), get_tree_for_node()
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 01:38:35 +00:00
Cursor Agent
952e40dae7
Phase 4: O(1) find_node_by_status_message via reverse index
...
- Add _status_to_node: Dict[str, str] (status_msg_id -> node_id)
- Populate in __init__ (root), add_node, and from_dict
- find_node_by_status_message: O(n) -> O(1) lookup
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 01:37:00 +00:00
Cursor Agent
f27c2caf18
Phase 3: Split _process_node into smaller methods
...
- _create_transcript_and_render_ctx(): returns transcript + RenderCtx
- _handle_session_info_event(): handles session_info, returns (captured, temp)
- _process_parsed_event(): processes single parsed event, returns (last_status, had_transcript_events)
- _process_node: now ~90 lines, delegates to helpers
Improves readability and testability.
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 01:36:12 +00:00
Cursor Agent
7496f67ae0
Phase 2: Extract markdown utilities to messaging/telegram_markdown.py
...
- Create messaging/telegram_markdown.py with all MarkdownV2 helpers
- Move escape_md_v2, escape_md_v2_code, escape_md_v2_link_url, mdv2_bold,
mdv2_code_inline, format_status, render_markdown_to_mdv2
- Update handler.py to import from telegram_markdown (~300 lines removed)
- Update telegram.py to use shared escape_md_v2 (remove duplicate)
- Update tests to import from messaging.telegram_markdown
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 01:34:27 +00:00
Cursor Agent
c4b52cb4ce
Remove dead code: MessageTree.get_queue_position
...
Method always returned 0 and was never called. Queue positions
are computed on-the-fly in _update_queue_positions via get_queue_snapshot.
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com >
2026-02-15 01:31:26 +00:00
Alishahryar1
bd1e097d74
fixed tool parser and added signal handlers
2026-02-14 04:25:12 -08:00
Alishahryar1
d2e6e52742
Subagent summarized display
2026-02-14 03:13:59 -08:00
Alishahryar1
6887de9cab
added more tests for parser and made it more robust
2026-02-14 02:49:21 -08:00
Alishahryar1
4247f411b0
Fixed truncation errors in telegram and added subagent display
2026-02-14 02:41:48 -08:00
Alishahryar1
b95f2ef9c4
Revamped telegram result display
2026-02-14 02:14:36 -08:00
Alishahryar1
89edeaa6ac
Migrated telegram rate limiter to sliding window
2026-02-13 22:12:33 -08:00
Alishahryar1
5471044258
limiter time complexity improved by kimi-k2.5 in claude-code
2026-02-13 22:02:34 -08:00
Alishahryar1
fabca59f5c
lint
2026-02-13 17:24:18 -08:00
Alishahryar1
98966fe688
fixed table rendering v2
2026-02-13 16:57:14 -08:00
Alishahryar1
28a56d3af8
fixed table rendering for telegram
2026-02-13 16:31:46 -08:00
Alishahryar1
4ee0114891
Implemented /clear command
2026-02-13 16:24:52 -08:00
Alishahryar1
459ce6e8fd
introduced per reply /stop command to stop just that task and fixed context leakage in reply session forking
2026-02-13 14:53:48 -08:00
Alishahryar1
de7677ba6c
added graceful shutdown
2026-02-13 13:40:49 -08:00
Alishahryar1
42bfb2da9b
improve test coverage
2026-02-13 12:54:48 -08:00
Alishahryar1
ff22e9baa2
lint
2026-02-08 04:10:57 -08:00
Alishahryar1
697bc37faf
Upon dequeue the current request immediately displays processing state instead of position 1 waiting
2026-02-08 04:06:41 -08:00
Alishahryar1
6d8f13d84e
Added feature to update queue positions on telegram when messages are dequeued and added new tests
2026-02-08 04:00:58 -08:00
Alishahryar1
0cad642e4b
Implemented markdownv2 rendering
2026-02-05 17:31:40 -08:00
Alishahryar1
3a69a51f62
fixed markdown errors for telegram
2026-02-05 17:22:00 -08:00
Alishahryar1
6102583026
Major Refactor Part 2 with kimi-k2.5 in claude code
2026-02-05 16:09:16 -08:00
Alishahryar1
fcbe204f44
Major refactor done with kimi-k2.5 in claude code
2026-02-05 10:51:33 -08:00
Alishahryar1
78d0276d03
fixed /stop
2026-01-31 14:39:24 -08:00
Alishahryar1
8ce86f4267
fixed type errors
2026-01-31 14:13:09 -08:00
Alishahryar1
3acabcb8e0
add new template kwargs and fixed linter errors
2026-01-31 00:03:21 -08:00
Alishahryar1
303767e346
fixed linter errors
2026-01-30 23:32:02 -08:00
Alishahryar1
5bc978c545
Implemented fixes using test case errors
2026-01-30 17:11:35 -08:00
Alishahryar1
07b0c9233e
switched to start truncation from end truncation
2026-01-30 17:05:23 -08:00
Alishahryar1
5d26bdbb9f
fixed /stop race condition
2026-01-30 17:01:41 -08:00
Alishahryar1
e6bf052edf
fixed /stop
2026-01-30 16:58:33 -08:00
Alishahryar1
8aae7c3d3d
fixed redundant telegram calls
2026-01-30 15:46:49 -08:00
Alishahryar1
7045e0ed44
add retry for telegram message edits with tests and updated rate telegram limit
2026-01-30 15:41:24 -08:00
Alishahryar1
3f8b9af2c3
improved test suite and fixed error propagation bug in telegram
2026-01-30 14:04:28 -08:00
Alishahryar1
3b037932d7
refactor to reduce coupling
2026-01-30 13:39:40 -08:00
Alishahryar1
40af7739d2
added retry for bot server start
2026-01-30 01:16:51 -08:00
Alishahryar1
f7f5b98590
more robust error handling by telegram bot
2026-01-30 00:54:16 -08:00
Alishahryar1
d958544c3d
Migrated from telethon to telegram bot api
2026-01-30 00:38:39 -08:00
Alishahryar1
fb845384f0
fixed server start message on telegram
2026-01-30 00:02:39 -08:00
Alishahryar1
1cf32da002
fixed replies
2026-01-29 23:52:00 -08:00
Alishahryar1
5465fefdd3
implemented task compaction for telegram rate limiter
2026-01-29 23:48:02 -08:00