Skip to content

Commit eaa5966

Browse files
committed
fix(codex-adapter): distinguish worker failures from cancels
Addressed the review feedback where Codex stream consumers always saw a cancelled event even when the worker crashed. The exit handler now only emits cancelled metadata when an actual abort occurred; other exit paths produce the worker-exit error event so UIs can differentiate real cancellations from infrastructure failures. Verified via npm run test --workspace examples.
1 parent 6951561 commit eaa5966

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

packages/codex-adapter/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,20 +383,17 @@ export class CodexAdapter implements HeadlessCoder {
383383
}
384384
if (signal) {
385385
const reason = `Codex worker exited via signal ${signal}`;
386-
push(createCancelledEvent(reason, stderrOutput));
387386
push(createWorkerExitErrorEvent(reason, stderrOutput));
388387
push(DONE);
389388
return;
390389
}
391390
if (code === 0) {
392391
const reason = 'Codex worker exited before completing the stream.';
393-
push(createCancelledEvent(reason, stderrOutput));
394392
push(createWorkerExitErrorEvent(reason, stderrOutput));
395393
push(DONE);
396394
return;
397395
}
398396
const reason = `Codex worker exited with code ${code}`;
399-
push(createCancelledEvent(reason, stderrOutput));
400397
push(createWorkerExitErrorEvent(reason, stderrOutput));
401398
push(DONE);
402399
});

0 commit comments

Comments
 (0)