Skip to content

refactor(conversation_loop): extract text helper slice CL-R1-1 into agent/conversation_text.py - #84275

Open
andrexibiza wants to merge 3 commits into
NousResearch:mainfrom
andrexibiza:gfg/conversation-loop-r11-text
Open

refactor(conversation_loop): extract text helper slice CL-R1-1 into agent/conversation_text.py#84275
andrexibiza wants to merge 3 commits into
NousResearch:mainfrom
andrexibiza:gfg/conversation-loop-r11-text

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Byte-verbatim extraction of slice CL-R1-1 from agent/conversation_loop.py (7,757 lines at pin ee4bb75b532e932a1055d9a710802a7435163b6a) into a new module, per the repo-wide god-file sharding policy.

  • Moved: _join_truncated_parts (lines 190–197, 338 bytes, continuation-fragment joiner) → agent/conversation_text.py
  • Golden sha (window at pin): bd297624f82ca8020c42556b35110e5729fa111fe31ad7fcf68a01d7ca26f3e4 — byte-verbatim, re-verified from the committed blob (module lines 8–15 == pin window, byte-identical)
  • Seam: identity-preserving re-export in agent/conversation_loop.py (from agent.conversation_text import _join_truncated_parts) — no public rename, no stale duplicate, same-file call sites (3415, 7360) + tests/run_agent/test_continuation_ceiling_wedge.py:238 resolve through the original namespace, monkeypatch authority intact. New module: leaf utility (typing only), no heavy imports, startup-latency contract preserved.
  • Seam tests: tests/agent/test_conversation_text_seam.py — object identity + behavioral cases
  • Zero behavior change. Diff: agent/conversation_loop.py 1 insertion / 8 deletions (deleted set exactly 190–197); new module 15 lines; seam test 25 lines.

Method

5×2×3 double-blind decomposition (per the All Gods Must Die mandate): 5 blind region analysts → 5 blind adversarial witnesses → 5 consensus adjudicators → blind implementer → 2 blind re-reviewers. Round 1: both reviewers REQUEST CHANGES (collateral audit: the splice had removed the two trailing separator blank lines 198–199, making the deleted set 190–199). Fix lane restored the two blanks (commit b6a19fb96e1, +2 insertions, deleted set now exactly 190–197). Round 2: both re-reviewers APPROVED:

  • Review 1 (r2): C:/tmp/tg-Feature Package/conversation-loop/review/CLR11-review-1-r2.md (12,981 B) — all 7 battery gates PASS
  • Review 2 (r2): C:/tmp/tg-Feature Package/conversation-loop/review/CLR11-review-2-r2.md (12,015 B) — APPROVED, all gates

Suite evidence: pristine-pin baseline vs post-extraction failure sets identical (continuation wedge 10/10, region 37/37, seam tests pass). No new failures.

Coordination table

Item Value
Pin ee4bb75b532e932a1055d9a710802a7435163b6a (origin/main)
Slice CL-R1-1 (conversation_loop region 1, first slice)
Window 190–197 (8 lines, 338 bytes)
Module agent/conversation_text.py
Golden sha bd297624f82ca8020c42556b35110e5729fa111fe31ad7fcf68a01d7ca26f3e4
Colliders #83437 (langfuse tracing) — live file-list check at extraction: no hunks in 190–197; semantic overlap LOW (pure string joiner, no tracing/telemetry)
Dependencies none
Conflicts none
Merge position standalone; no stacking

Dedup statement

No prior extraction of this window exists. This is the first conversation_loop slice; no sibling PRs on this file. No duplicate work.

Credit

  • Author: Axl Ibiza, MBA (DCO-signed commits ffbbf9781c8 + b6a19fb96e1)
  • Method: All Gods Must Die 5×2×3 (blind lanes, consensus contracts, blind re-review, fix cycle)

This slice is governed by the conversation_loop (posted on #78641). Former whole: 7,757 lines. Fixer roster: #83437.

Part of #78641
Part of #78647

Signed-off-by: Axl Ibiza <andrexibiza@gmail.com>
…raction

Signed-off-by: Axl Ibiza <andrexibiza@gmail.com>
Contributor email mapping required by check-attribution CI for the
god-file kill campaign PRs (Axl Ibiza, MBA <andrexibiza@gmail.com>).

Signed-off-by: Axl Ibiza, MBA <andrexibiza@gmail.com>
Signed-off-by: Axl Ibiza <andrexibiza@gmail.com>
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

refactor(conversation_loop): extract text helper slice CL-R1-1 into agent/conversation_text.py

  1. Leftover blank lines at the removal siteagent/conversation_loop.py (diff hunk at the old definition, ~lines 188-191): a double blank line remains where _join_truncated_parts used to live. Cosmetic; remove for cleanliness.

  2. Import placement is the right one — the from agent.conversation_text import _join_truncated_parts goes into the top import block (line 38), unlike the mid-file placements in several sibling slices. conversation_text imports only typing, so there is no cycle hazard. Consistent and clean.

  3. No blocking issues — the helper is trivial and the tests cover the four behaviors that matter: empty input, whitespace preservation, newline-injection only when fragments would glue, and identity of the re-export. This slice is a good minimal example for the campaign.

Copy link
Copy Markdown
Contributor Author

Decision recorded against current main 3a034356a237341452b7afebd3a2bfd21021609f.

This is the first conversation-loop extraction to rebase and land. _join_truncated_parts remains an intact top-level helper on current main, and the adjacent Langfuse/tracing work from #83437 was salvaged through #85439 with stale conversation_loop.py hunks explicitly discarded, so there is no remaining tracing-owned reason to hold this pure leaf.

Required landing gate: rebase onto current main, recompute the exact source-window/golden identity, retain the single canonical definition/re-export seam, and rerun the focused conversation-text seam plus current continuation/truncation tests. Land #84275 before #84653. The decision is complete; the current non-mergeable head still requires rebase and exact-head CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants