Dhanji R. Prasanna
5e45e110e2
refactor(g3-core): extract finalize_streaming_turn() to unify return paths
Extract a single canonical helper function for completing streaming turns,
eliminating 3 nearly-identical return paths in stream_completion_with_tools().
Changes:
- Add finalize_streaming_turn() helper that handles:
- Finishing streaming markdown
- Saving context window
- Adding timing footer (when requested)
- Dehydrating context (when ACD enabled)
- Building TaskResult
- Replace 3 duplicated return blocks with calls to the helper
- Remove unused mut on full_response variable
Results:
- Function reduced from 1067 to 999 lines (-68 lines)
- Eliminated code-path aliasing: 3 paths → 1 canonical path
- All 32 characterization tests pass
- Full g3-core test suite passes
Agent: fowler
2026-01-13 16:52:48 +05:30
..
2025-11-27 21:00:02 +11:00
2026-01-13 16:52:48 +05:30
2026-01-13 16:25:33 +05:30
2026-01-11 06:35:18 +08:00