Skip to content

Commit 1baf274

Browse files
committed
fix: skip pty helper strict failures on sdk backend
1 parent 237749b commit 1baf274

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

src/ops/healthcheck.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface HealthcheckOptions {
3939
telegramLiveCheck?: boolean;
4040
codexLiveCheck?: boolean;
4141
codexLiveRunner?: (config: AppConfig) => Promise<CodexLiveCheckResult>;
42+
ptyHelperCheck?: typeof repairNodePtySpawnHelperPermissions;
4243
}
4344

4445
interface TelegramGetMeResponse {
@@ -258,11 +259,23 @@ export async function runHealthcheck(
258259
)
259260
);
260261

261-
const ptyHelper = repairNodePtySpawnHelperPermissions();
262+
const ptyHelperCheck =
263+
options.ptyHelperCheck || repairNodePtySpawnHelperPermissions;
264+
const ptyHelper = ptyHelperCheck();
262265
if (ptyHelper.error) {
263-
checks.push(
264-
makeCheck("node-pty helper", strict ? "fail" : "warn", ptyHelper.error)
265-
);
266+
if (config.runner.backend === "sdk") {
267+
checks.push(
268+
makeCheck(
269+
"node-pty helper",
270+
"pass",
271+
`Not required for sdk backend (${ptyHelper.error})`
272+
)
273+
);
274+
} else {
275+
checks.push(
276+
makeCheck("node-pty helper", strict ? "fail" : "warn", ptyHelper.error)
277+
);
278+
}
266279
} else if (ptyHelper.changed) {
267280
checks.push(
268281
makeCheck(

tests/healthcheck.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,30 @@ test("runHealthcheck fails when the configured command is missing in strict mode
126126
);
127127
});
128128

129+
test("runHealthcheck skips node-pty helper failures in strict mode when backend is sdk", async () => {
130+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "claws-health-"));
131+
const config = createConfig(root);
132+
133+
const result = await runHealthcheck(config, {
134+
env: process.env,
135+
strict: true,
136+
ptyHelperCheck: () => ({
137+
path: "",
138+
changed: false,
139+
executable: false,
140+
error: "simulated missing spawn-helper"
141+
})
142+
});
143+
144+
assert.equal(result.ok, true);
145+
assert.equal(
146+
result.checks.some(
147+
(check) => check.name === "node-pty helper" && check.status === "pass"
148+
),
149+
true
150+
);
151+
});
152+
129153
test("runHealthcheck reports a passing live Codex probe when the backend responds", async () => {
130154
const root = fs.mkdtempSync(path.join(os.tmpdir(), "claws-health-"));
131155
const config = createConfig(root);

0 commit comments

Comments
 (0)