Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): clear Codex commands when their native thread closes #19936

MergedItayCohen-Prog(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/19936/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 160 additions and 0 deletions.

x
0 of 2 viewed, 2 left
128 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.tsModified
View file
@@ -4836,6 +4836,134 @@
+ it.effect.each([false, true])(
+ "keeps commands interrupted after native thread closure (persistent tool: %s)",
+ (retainContext) =>
+ Effect.gen(function* () {
+ const notification = (method: string, params: unknown) => ({
+ type: "emit_inbound" as const,
+ label: method,
+ frame: { method, params },
+ });
+ const monitor = (status: "inProgress" | "completed") =>
+ notification(status === "inProgress" ? "item/started" : "item/completed", {
+ threadId: BG_NATIVE_THREAD,
+ turnId: BG_NATIVE_TURN,
+ item: {
+ type: "dynamicToolCall",
+ id: "persistent-monitor",
+ namespace: "grok",
+ tool: "monitor",
+ status,
+ arguments: { persistent: true, command: "tail -f" },
+ },
+ });
+ // Replies fence notification handling on the same protocol reader.
+ const unsubscribe = (id: number, notifications: ReturnType<typeof notification>[] = []) => [
+ {
+ type: "expect_outbound" as const,