Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): respawn Claude after an expired login #9468

Closedrobertnisipeanu(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/9468/headopened View on GitHub

Showing 2 changed files with 177 additions and 4 deletions.

x
0 of 2 viewed, 2 left
141 additions and 0 deletionsapps/server/src/provider/Layers/ClaudeAdapter.test.tsModified
View file
@@ -3133,6 +3133,147 @@
+ it.effect("stops the session after an authentication failure so the next turn respawns", () => {
+ const harness = makeHarness();
+ return Effect.gen(function* () {
+ const adapter = yield* ClaudeAdapter;
+​
+ const runtimeEventsFiber = yield* Stream.takeUntil(
+ adapter.streamEvents,
+ (event) => event.type === "session.exited",
+ ).pipe(Stream.runCollect, Effect.forkChild);
+​
+ const session = yield* adapter.startSession({
+ threadId: THREAD_ID,
+ provider: ProviderDriverKind.make("claudeAgent"),
+ runtimeMode: "full-access",
+ });
+​
+ const turn = yield* adapter.sendTurn({
+ threadId: session.threadId,
+ input: "hello",
+ attachments: [],
+ });
+​
+ // The CLI reports expired or missing credentials as a synthetic
+ // assistant message stamped with error: "authentication_failed".
+ harness.query.emit({
+ type: "assistant",