Repository navigation
refactor(server): move turn boundaries and the Devin session lookup into their own modules - #1765
Conversation
…nto their own modules Move the Claude branch/turn-boundary code (ClaudeBranch, claudeForks, followClaudeBranch, PromptChain, turnStarts and their helpers) verbatim into server/transcript-turns.ts, and isDevinProcess/devinSessionForPane verbatim into server/devin-session.ts. The moved names conversation.ts still uses gain `export`; conversation.ts re-exports isDevinProcess and devinSessionForPane so importers are unchanged. Plan: .omo/plans/agent-modules-split.md C3.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
The first CI run's I believe this PR did not cause it:
Rerun on this branch (
|
|
Merge pass: move-only PR (per-agent split, wave C3). It merges on its checks without waiting for a CodeRabbit review, as AGENTS.md allows.
All required checks are green and no review thread is open. Note: on the first CI run, |
Wave C3 of the per-agent module split. The plan is
.omo/plans/agent-modules-split.mdin the maintainer's workspace, and plan-reviewer approved it. It follows C2 (#1763), which this wave builds on:StreamSourceandConversationUnavailablenow come fromserver/conversation-shared.ts.This wave moves two state-free clusters out of
server/conversation.tsinto new leaf modules.conversation.tskeeps every cache,paneReads(including Devin's per-pane reads), the paging core and the transcript resolvers. The three functions tests spy on (paneTranscript,readCommandTranscript,paneProcessRoots) stay.What changes
server/transcript-turns.ts: the turn-boundary cluster, verbatim with its doc comments:ClaudeBranch,claudeForks,answeredBetween,claudeCommandEchoRecord,CLAUDE_CHAIN_LINE_BYTES,followClaudeBranch;PEER_MARK,TURN_MARK,opensTurn;PromptChain,turnStarts.followClaudeBranchcallsopensTurn, whichturnStartsalso needs, so the cluster moves as one module.exportis added to the five namesconversation.tsstill uses:turnStarts,followClaudeBranch,claudeForks, and the typesClaudeBranchandPromptChain.server/devin-session.ts:isDevinProcessanddevinSessionForPane, verbatim. Both were already exported.conversation.tsre-exports them forserver/session-history.tsandserver/conversation.test.ts, so no importer changes.conversation.tsimports: the imports from./transcript-records.tsand./claude-transcript.tsdrop the names only the moved code used.Not in this wave:
rememberPaneDevinandDevinPaneReadstay, because they are fields ofpaneReads, whichforgetPaneTranscriptStateowns.server/conversation.tsgoes from 1,732 to 1,532 lines.Checks
--color-moved:git diff --color-moved=plain --color-moved-ws=allow-indentation-change origin/main...HEADshows 394 lines as moved. The other 23 lines are:conversation.ts's narrowed and new imports and its one re-export line;export, each shown as removed and added.No import cycles:
bun <plan>/no-path.ts <new file> server/conversation.ts server/prompt.tsprints "no path to server/conversation.ts, server/prompt.ts" for both new files. They import onlyconversation-shared.ts,transcript-records.ts,claude-transcript.tsandshared/protocol.ts.No new herdr calls: neither new file calls
herdrRpc.Typecheck:
bun run typecheckpasses.Unit tests: 305 pass, 0 fail across 10 files, from:
HERDR_TEST_MODE=unit bun test server/claude-turn-boundaries.test.ts server/native-incremental.test.ts server/chat-history.test.ts server/pi.test.ts server/pi-tree.test.ts server/pi-large-history.test.ts server/grok.test.ts server/cmd.test.ts server/conversation.test.ts server/devin.test.tsbun run check fast: passes (unit 6253 pass, 0 fail, 13 skip in 443 files, 8 at a time, 58.7s)Integration lane: runs in CI.
Outside PRs that touch the same files
No other maintainer PR touches these files. Three outside contributors' PRs touch
server/conversation.ts: #1706, #1652 and #1442.TURN_MARK,opensTurnorfollowClaudeBranch. Those edits move toserver/transcript-turns.tsin the rebase.Move-only: moved declarations plus imports, five added
exports and one re-export line. No changelog fragment: users see no change.