@@ -3,7 +3,10 @@ import { spawn } from "node:child_process";
33import path from "node:path" ;
44import process from "node:process" ;
55import type { AppConfig } from "../config.js" ;
6- import { repairNodePtySpawnHelperPermissions } from "../runner/ptyPreflight.js" ;
6+ import {
7+ repairNodePtySpawnHelperPermissions ,
8+ type ExecutablePermissionResult
9+ } from "../runner/ptyPreflight.js" ;
710import { extractCodexExecResponse } from "../bot/formatter.js" ;
811import { toErrorMessage } from "../lib/errors.js" ;
912
@@ -39,6 +42,7 @@ interface HealthcheckOptions {
3942 telegramLiveCheck ?: boolean ;
4043 codexLiveCheck ?: boolean ;
4144 codexLiveRunner ?: ( config : AppConfig ) => Promise < CodexLiveCheckResult > ;
45+ ptyHelperProbe ?: ( ) => ExecutablePermissionResult ;
4246}
4347
4448interface TelegramGetMeResponse {
@@ -258,21 +262,30 @@ export async function runHealthcheck(
258262 )
259263 ) ;
260264
261- const ptyHelper = repairNodePtySpawnHelperPermissions ( ) ;
262- if ( ptyHelper . error ) {
263- checks . push (
264- makeCheck ( "node-pty helper" , strict ? "fail" : "warn" , ptyHelper . error )
265- ) ;
266- } else if ( ptyHelper . changed ) {
265+ if ( config . runner . backend === "sdk" ) {
267266 checks . push (
268- makeCheck (
269- "node-pty helper" ,
270- "pass" ,
271- `Repaired execute permissions: ${ ptyHelper . path } `
272- )
267+ makeCheck ( "node-pty helper" , "pass" , "Not required for sdk backend." )
273268 ) ;
274269 } else {
275- checks . push ( makeCheck ( "node-pty helper" , "pass" , ptyHelper . path ) ) ;
270+ const ptyHelperProbe =
271+ options . ptyHelperProbe || repairNodePtySpawnHelperPermissions ;
272+ const ptyHelper = ptyHelperProbe ( ) ;
273+
274+ if ( ptyHelper . error ) {
275+ checks . push (
276+ makeCheck ( "node-pty helper" , strict ? "fail" : "warn" , ptyHelper . error )
277+ ) ;
278+ } else if ( ptyHelper . changed ) {
279+ checks . push (
280+ makeCheck (
281+ "node-pty helper" ,
282+ "pass" ,
283+ `Repaired execute permissions: ${ ptyHelper . path } `
284+ )
285+ ) ;
286+ } else {
287+ checks . push ( makeCheck ( "node-pty helper" , "pass" , ptyHelper . path ) ) ;
288+ }
276289 }
277290
278291 const liveTelegramCheck = Boolean ( options . telegramLiveCheck ) ;
0 commit comments