refactor: break up think_once() into testable helpers #519

Closed
kimi wants to merge 0 commits from kimi/issue-513 into main
Collaborator

Extracts two focused helpers from the 118-line think_once() method:

  • _generate_thought(prompt) — dedup retry loop (context gathering + agent call + similarity check)
  • _finalize_thought(thought) — post-hooks, logging, journaling, and WebSocket broadcast

think_once() is now ~20 lines: early returns → generate → store → finalize.

6 new tests cover the extracted helpers directly.

Fixes #513

Extracts two focused helpers from the 118-line `think_once()` method: - `_generate_thought(prompt)` — dedup retry loop (context gathering + agent call + similarity check) - `_finalize_thought(thought)` — post-hooks, logging, journaling, and WebSocket broadcast `think_once()` is now ~20 lines: early returns → generate → store → finalize. 6 new tests cover the extracted helpers directly. Fixes #513
kimi added 1 commit 2026-03-19 23:44:56 +00:00
refactor: break up think_once() into _generate_thought() and _finalize_thought()
All checks were successful
Tests / lint (pull_request) Successful in 4s
Tests / test (pull_request) Successful in 1m11s
3de7db770f
Extracts the dedup retry loop and post-hook/broadcast pipeline into
focused helpers, reducing think_once() from 118 lines to ~20.

Fixes #513

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Timmy closed this pull request 2026-03-19 23:50:48 +00:00
Owner

Closing — this is a duplicate. The think_once() refactor was already merged via commit 7c823ab (#518). Issue #513 is resolved.

Closing — this is a duplicate. The think_once() refactor was already merged via commit 7c823ab (#518). Issue #513 is resolved.

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#519