The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 08:15 UTC
fix(provider): show exit details when ACP session startup crashes (#28419)
Co-authored-by: PR Batch Tester <agent@local.test> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
shivam committed
Nov 2, 2026 at 03:22 UTC
8918a6591b84fa0698d441c94d22aea548cbebea
2 files changed
+50
packages/provider-core/src/server/failure.test.ts
+33
@@ -3,6 +3,7 @@ import {
3
NodeId,
4
ProviderDriverKind,
5
ProviderInstanceId,
6
+ ProviderSessionId,
7
ProviderSetupError,
8
ProviderThreadId,
9
ProviderTurnId,
@@ -14,6 +15,7 @@ import * as DateTime from "effect/DateTime";
15
import * as Effect from "effect/Effect";
16
17
import {
18
+ knownProviderFailureMessage,
19
makeProviderFailure,
20
makeProviderFailureTurnItem,
21
MAX_PROVIDER_FAILURE_MESSAGE_LENGTH,
@@ -106,6 +108,37 @@ it("preserves actionable T3 errors wrapped by turn startup", () => {
108
}
109
});
110
111
+it("names how the provider process exited and the stage it failed in, without its output", () => {
112
+ for (const [exit, status] of [
113
+ [{ signal: "SIGILL" }, " after signal SIGILL"],
114
+ [{ code: 134 }, " with code 134"],
115
+ [{}, ""],
116
+ [{ signal: "SIGILL Bearer signal-secret" }, ""],
117
+ ] as const) {
118
+ const sessionOpenFailure = {
119
+ _tag: "ProviderSessionOpenError",
120
+ cause: new ProviderAdapter.ProviderAdapterOpenSessionError({
121
+ driver: ProviderDriverKind.make("antigravity"),
122
+ providerSessionId: ProviderSessionId.make("provider-session:private-id"),
123
+ cause: {
124
+ _tag: "AcpProcessExitedError",
125
+ ...exit,
126
+ pid: 4242,
127
+ stderr: "*** SIGILL *** token=stderr-secret",
128
+ cause: new Error("Process interrupted with private-detail"),
129
+ },
130
+ }),
131
+ };
132
+ const expected = `The provider session could not be opened: the provider process exited${status}. Check the server logs for the provider's output, then retry the turn.`;
133
+ assert.equal(knownProviderFailureMessage(sessionOpenFailure), expected);
134
+ assert.equal(makeProviderFailure({ cause: Cause.fail(sessionOpenFailure) }).message, expected);
135
+ }
136
+ assert.equal(
137
+ makeProviderFailure({ cause: { _tag: "AcpProcessExitedError", code: 1 } }).message,
138
+ "The provider process exited with code 1. Check the server logs for the provider's output, then retry the turn.",
139
+ );
140
+});
141
+
142
it("keeps unrecognized reasons and provider text out of category messages", () => {
143
for (const cause of [
144
"Private launch command",
packages/provider-core/src/server/failure.ts
+17
@@ -110,6 +110,14 @@ function curatedCauseMessages(cause: unknown): {
110
case "CursorModelUnavailableError":
111
case "ProviderSetupError":
112
return { known: stringField(cause, "message"), category: categoryMessage() };
113
+ case "AcpProcessExitedError": {
114
+ const exit = `provider process exited${processExitStatus(cause)}`;
115
+ const stage = category === undefined ? `The ${exit}` : `${category.summary}: the ${exit}`;
116
+ return {
117
+ known: `${stage}. Check the server logs for the provider's output, then retry the turn.`,
118
+ category: categoryMessage(),
119
+ };
120
+ }
121
case "ContextHandoffDeliveryUncertainError":
122
return {
123
known:
@@ -140,6 +148,15 @@ function curatedCauseMessages(cause: unknown): {
148
return { known: undefined, category: categoryMessage() };
149
}
150
151
+// Only the structured status; stderr and the spawner cause can carry provider output.
152
+function processExitStatus(exited: object): string {
153
+ const { signal, code } = exited as Record<string, unknown>;
154
+ if (typeof signal === "string" && /^SIG[A-Z0-9]{1,16}$/u.test(signal)) {
155
+ return ` after signal ${signal}`;
156
+ }
157
+ return typeof code === "number" && Number.isSafeInteger(code) ? ` with code ${code}` : "";
158
+}
159
+
160
/**
161
* The curated message of a domain error in a failure's cause chain, if any.
162
* Callers that pass their own `message` to `makeProviderFailure` check it