@devries-cameron20 / t3code Mirror · read-only / commits / 44e3f42e69
Fork 0

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 21, 06:00 UTC

fix(server): starting a native subagent no longer records a failed projection read span (#39284)

Co-authored-by: mInrOz <14320143+mInrOz@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Martin Bergo committed Nov 19, 2026 at 20:53 UTC 44e3f42e6915806275539871c10f2c18c6543f80
2 files changed +26 -13
apps/server/src/orchestration-v2/ProviderEventIngestor.test.ts
+25 -8
@@ -37,6 +37,7 @@ import * as Schema from "effect/Schema";
37 import * as SqlClient from "effect/sql/SqlClient";
38 import * as SqlError from "effect/sql/SqlError";
39 import * as Stream from "effect/Stream";
40 +import * as Tracer from "effect/Tracer";
41
42 import { toolOutputImages } from "@t3tools/shared/toolOutput";
43 import * as SqlitePersistence from "../persistence/Sqlite.ts";
@@ -1920,16 +1921,32 @@ layer("ProviderEventIngestorV2", (it) => {
1921 threadId: rootEvent.threadId,
1922 });
1923
1923 - const threadEvents = yield* ingestor.normalize({
1924 - providerSessionId,
1925 - providerInstanceId: modelSelection.instanceId,
1926 - threadId: rootEvent.threadId,
1927 - event: {
1928 - type: "app_thread.created",
1929 - driver: CODEX_DRIVER,
1930 - appThread: childThread,
1924 + const failedSpans: Array<string> = [];
1925 + const tracer = Tracer.make({
1926 + span(options) {
1927 + const span = new Tracer.NativeSpan(options);
1928 + const end = span.end.bind(span);
1929 + span.end = (time, exit) => {
1930 + end(time, exit);
1931 + if (Exit.isFailure(exit)) failedSpans.push(span.name);
1932 + };
1933 + return span;
1934 },
1935 });
1936 + const threadEvents = yield* ingestor
1937 + .normalize({
1938 + providerSessionId,
1939 + providerInstanceId: modelSelection.instanceId,
1940 + threadId: rootEvent.threadId,
1941 + event: {
1942 + type: "app_thread.created",
1943 + driver: CODEX_DRIVER,
1944 + appThread: childThread,
1945 + },
1946 + })
1947 + .pipe(Effect.withTracer(tracer));
1948 + // A new child's existence check expects a miss; a failed span there reads as an error in Tempo.
1949 + assert.deepEqual(failedSpans, []);
1950 const messageEvents = yield* ingestor.normalize({
1951 providerSessionId,
1952 providerInstanceId: modelSelection.instanceId,
apps/server/src/orchestration-v2/ProviderEventIngestor.ts
+1 -5
@@ -471,11 +471,7 @@ export const layer: Layer.Layer<
471 switch (input.event.type) {
472 case "app_thread.created": {
473 const offered = input.event.appThread;
474 - const existing = yield* projections.getThread(offered.id).pipe(
475 - Effect.catchTags({
476 - ProjectionStoreThreadNotFoundError: () => Effect.succeed(null),
477 - }),
478 - );
474 + const existing = yield* projections.findThread(offered.id);
475 if (
476 existing !== null &&
477 (input.event.createOnly === true ||