@@ -130,7 +130,9 @@ const makeTurnStartCheckoutLeaseFork = Effect.gen(function* () {
130130 if ( current === null ) return yield * dispatch ;
131131 // A move waits for the thread to go idle; a new turn would starve it.
132132 if ( isCheckoutMoveInFlightFork ( current . checkoutMove ) ) {
133- return yield * reject ( `Thread ${ current . id } has a checkout move in progress.` ) ;
133+ return yield * reject (
134+ `Thread "${ current . title } " has a checkout move in progress. Send again when it finishes.` ,
135+ ) ;
134136 }
135137 const thread = yield * checkoutMoves . recoverRemovedWorktree ( current ) ;
136138 const cwd = yield * threadCwd ( thread ) . pipe ( Effect . mapError ( reject ) ) ;
@@ -154,17 +156,18 @@ export const sharedCheckoutWsLayerFork = Layer.mergeAll(
154156 const withTurnStartLease = yield * makeTurnStartCheckoutLeaseFork ;
155157 return ThreadManagement . ThreadManagementService . of ( {
156158 ...inner ,
157- dispatch : ( command ) =>
159+ // The wrapped service owns the dispatch span.
160+ dispatch : Effect . fnUntraced ( function * ( command ) {
158161 // Move state is server-resolved; a client may only request a move.
159- command . type === "thread.metadata.update" && command . checkoutMove !== undefined
160- ? Effect . fail (
161- new Orchestrator . OrchestratorCommandRejectedError ( {
162- commandId : command . commandId ,
163- commandType : command . type ,
164- cause : "Checkout moves are requested through thread.checkoutMove.request." ,
165- } ) ,
166- )
167- : withTurnStartLease ( inner , command , inner . dispatch ( command ) ) ,
162+ if ( command . type === "thread.metadata.update" && command . checkoutMove !== undefined ) {
163+ return yield * new Orchestrator . OrchestratorCommandRejectedError ( {
164+ commandId : command . commandId ,
165+ commandType : command . type ,
166+ cause : "Checkout moves are requested through thread.checkoutMove.request." ,
167+ } ) ;
168+ }
169+ return yield * withTurnStartLease ( inner , command , inner . dispatch ( command ) ) ;
170+ } ) ,
168171 } ) ;
169172 } ) ,
170173 ) ,
@@ -175,11 +178,15 @@ export const sharedCheckoutWsLayerFork = Layer.mergeAll(
175178 const withBranchGuard = yield * makeSharedCheckoutBranchGuardFork ;
176179 return GitWorkflow . GitWorkflowService . of ( {
177180 ...inner ,
178- createRef : ( input ) =>
179- input . switchRef === true
181+ // The wrapped service owns the ref spans.
182+ createRef : Effect . fnUntraced ( function * ( input ) {
183+ return yield * input . switchRef === true
180184 ? withBranchGuard ( input . cwd , inner . createRef ( input ) )
181- : inner . createRef ( input ) ,
182- switchRef : ( input ) => withBranchGuard ( input . cwd , inner . switchRef ( input ) ) ,
185+ : inner . createRef ( input ) ;
186+ } ) ,
187+ switchRef : Effect . fnUntraced ( function * ( input ) {
188+ return yield * withBranchGuard ( input . cwd , inner . switchRef ( input ) ) ;
189+ } ) ,
183190 } ) ;
184191 } ) ,
185192 ) ,
0 commit comments