Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): restarts no longer stall on old subagent result deliveries #19631

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/19631/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 149 additions and 14 deletions.

x
0 of 2 viewed, 2 left
124 additions and 0 deletionsapps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.tsModified
View file
@@ -21,6 +21,7 @@
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Stream from "effect/Stream";
+import * as Tracer from "effect/Tracer";
​
import * as CheckpointStore from "../checkpointing/CheckpointStore.ts";
import * as ServerConfig from "../config.ts";
@@ -749,6 +750,24 @@
​
// Runtime reconciliation writes restart cancellations under this command
// prefix, which the live terminal-run listener skips.
+// Collects the SQL text of every statement run under the returned tracer.
+const traceSqlStatements = () => {
+ const statements: Array<string> = [];
+ const tracer = Tracer.make({
+ span(options) {
+ const span = new Tracer.NativeSpan(options);
+ const end = span.end.bind(span);
+ span.end = (endTime, exit) => {
+ end(endTime, exit);
+ const query = span.attributes.get("db.query.text");
+ if (typeof query === "string") statements.push(query);
+ };
+ return span;
+ },
+ });
+ return { statements, tracer };
+};