Skip to content

Commit 7bfb5b6

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-25639
2 parents d00eeb8 + 576a40f commit 7bfb5b6

74 files changed

Lines changed: 2487 additions & 1876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/desktop/src/backend/DesktopBackendPool.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const layer = Layer.effect(
132132
});
133133
yield* electronDialog.showErrorBox(
134134
"WSL backend couldn't start",
135-
`${reason}\n\nFalling back to the Windows backend so T3 Code can open. Re-enable the WSL backend from Settings > Connections once the WSL distro is fixed.`,
135+
`${reason}\n\nFalling back to the Windows backend so T3 Code can open. Re-enable the WSL backend from Settings > Sharing & access once the WSL distro is fixed.`,
136136
);
137137
// Clear wslOnly too so enabling WSL cannot restore a failed mode.
138138
// Keep the in-memory fallback if persistence fails.

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,40 +1382,40 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
13821382
onLayout={handleComposerOverlayLayout}
13831383
className="w-full"
13841384
>
1385-
<FloatingWorkingControl
1386-
colorScheme={isDarkMode ? "dark" : "light"}
1387-
status={floatingStatus}
1388-
lift={floatingControlLift}
1389-
devicePreview={
1390-
devicePreviews.length > 0
1391-
? { count: devicePreviews.length, onPress: openDevicePreview }
1392-
: null
1393-
}
1394-
browserPreview={
1395-
browserTabs.tabs.length > 0
1396-
? { count: browserTabs.tabs.length, onPress: () => openBrowserPreview() }
1397-
: null
1398-
}
1399-
showScrollToEnd={showScrollToEndButton}
1400-
onScrollToEnd={handleScrollToEnd}
1401-
agents={agentsSegment}
1402-
onOpenAgents={() => {
1403-
Keyboard.dismiss();
1404-
navigation.navigate("ThreadAgents", {
1405-
environmentId: props.environmentId,
1406-
threadId: props.selectedThread.id,
1407-
});
1408-
}}
1409-
queuedCount={queuedCount}
1410-
onOpenQueue={() => {
1411-
Keyboard.dismiss();
1412-
navigation.navigate("ThreadQueue", {
1413-
environmentId: props.environmentId,
1414-
threadId: props.selectedThread.id,
1415-
});
1416-
}}
1417-
/>
14181385
<View className="w-full self-center" style={{ maxWidth: contentMaxWidth }}>
1386+
<FloatingWorkingControl
1387+
colorScheme={isDarkMode ? "dark" : "light"}
1388+
status={floatingStatus}
1389+
lift={floatingControlLift}
1390+
devicePreview={
1391+
devicePreviews.length > 0
1392+
? { count: devicePreviews.length, onPress: openDevicePreview }
1393+
: null
1394+
}
1395+
browserPreview={
1396+
browserTabs.tabs.length > 0
1397+
? { count: browserTabs.tabs.length, onPress: () => openBrowserPreview() }
1398+
: null
1399+
}
1400+
showScrollToEnd={showScrollToEndButton}
1401+
onScrollToEnd={handleScrollToEnd}
1402+
agents={agentsSegment}
1403+
onOpenAgents={() => {
1404+
Keyboard.dismiss();
1405+
navigation.navigate("ThreadAgents", {
1406+
environmentId: props.environmentId,
1407+
threadId: props.selectedThread.id,
1408+
});
1409+
}}
1410+
queuedCount={queuedCount}
1411+
onOpenQueue={() => {
1412+
Keyboard.dismiss();
1413+
navigation.navigate("ThreadQueue", {
1414+
environmentId: props.environmentId,
1415+
threadId: props.selectedThread.id,
1416+
});
1417+
}}
1418+
/>
14191419
{props.queuedRunEdit !== null ? (
14201420
<Animated.View
14211421
className="shrink-0"

‎apps/server/src/telemetry/AnalyticsService.test.ts‎

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
22
import * as NodeServices from "@effect/platform-node/NodeServices";
33
import { assert, it } from "@effect/vitest";
4+
import * as Clock from "effect/Clock";
45
import * as ConfigProvider from "effect/ConfigProvider";
56
import * as Effect from "effect/Effect";
67
import * as Layer from "effect/Layer";
@@ -80,6 +81,24 @@ const respondWithStatus =
8081
(request) =>
8182
Effect.succeed(HttpClientResponse.fromWeb(request, new Response(null, { status })));
8283

84+
/**
85+
* Answers 503 for `minutes` after the first send, then 204. `answers` holds each
86+
* answer with its time in ms after the first send (the test clock runs on across tests).
87+
*/
88+
const failingFor = (minutes: number) => {
89+
const answers: Array<{ readonly at: number; readonly status: number }> = [];
90+
let firstSend: number | undefined;
91+
const respond: Respond = (request) =>
92+
Effect.flatMap(Clock.currentTimeMillis, (now) => {
93+
firstSend ??= now;
94+
const at = now - firstSend;
95+
const status = at < minutes * 60_000 ? 503 : 204;
96+
answers.push({ at, status });
97+
return respondWithStatus(status)(request);
98+
});
99+
return { respond, answers };
100+
};
101+
83102
const recordTwentyEvents = Effect.gen(function* () {
84103
const analytics = yield* AnalyticsService.AnalyticsService;
85104
for (let index = 0; index < 20; index += 1) {
@@ -88,11 +107,12 @@ const recordTwentyEvents = Effect.gen(function* () {
88107
});
89108

90109
/**
91-
* Runs `record` (20 events by default), then lets ten minutes of background
110+
* Runs `record` (20 events by default), then lets `minutes` of background
92111
* flushes run against a client that answers every send with `respond`.
93112
* Returns the sent batches.
94113
*/
95-
const sendForTenMinutes = (
114+
const sendFor = (
115+
minutes: number,
96116
respond: Respond,
97117
record: Effect.Effect<
98118
void,
@@ -137,7 +157,7 @@ const sendForTenMinutes = (
137157

138158
yield* Effect.gen(function* () {
139159
yield* record;
140-
for (let second = 0; second < 600; second += 1) {
160+
for (let second = 0; second < minutes * 60; second += 1) {
141161
yield* TestClock.adjust("1 second");
142162
}
143163
}).pipe(Effect.provide(runtimeLayer));
@@ -147,7 +167,8 @@ const sendForTenMinutes = (
147167
it.layer(NodeServices.layer)("AnalyticsService test", (it) => {
148168
it.effect("client owner reports cannot use up the server's owner cap", () =>
149169
Effect.gen(function* () {
150-
const batches = yield* sendForTenMinutes(
170+
const batches = yield* sendFor(
171+
10,
151172
respondWithStatus(204),
152173
Effect.gen(function* () {
153174
const analytics = yield* AnalyticsService.AnalyticsService;
@@ -170,6 +191,36 @@ it.layer(NodeServices.layer)("AnalyticsService test", (it) => {
170191
}),
171192
);
172193

194+
it.effect("keeps a failed batch through a 20-minute outage and sends it once after", () =>
195+
Effect.gen(function* () {
196+
const ingest = failingFor(20);
197+
const batches = yield* sendFor(40, ingest.respond);
198+
const statuses = ingest.answers.map(({ status }) => status);
199+
assert.equal(statuses.at(-1), 204);
200+
assert.equal(statuses.filter((status) => status === 204).length, 1);
201+
const sentUuids = new Set(batches.map((batch) => batch.map(({ uuid }) => uuid).join()));
202+
assert.equal(sentUuids.size, 1);
203+
assert.equal(batches[0]?.length, 20);
204+
}),
205+
);
206+
207+
it.effect("drops a batch that keeps failing for 30 minutes", () =>
208+
Effect.gen(function* () {
209+
const ingest = failingFor(Infinity);
210+
yield* sendFor(60, ingest.respond);
211+
const lastSend = ingest.answers.at(-1)?.at ?? 0;
212+
assert.isAtLeast(lastSend, 30 * 60_000);
213+
assert.isBelow(lastSend, 36 * 60_000);
214+
}),
215+
);
216+
217+
it.effect("drops a batch the endpoint rejects without sending it again", () =>
218+
Effect.gen(function* () {
219+
const batches = yield* sendFor(10, respondWithStatus(400));
220+
assert.equal(batches.length, 1);
221+
}),
222+
);
223+
173224
it.effect("flush drains all buffered events across multiple batches", () =>
174225
Effect.gen(function* () {
175226
const capturedRequests: Array<RecordedBatchRequest> = [];

‎apps/server/src/telemetry/AnalyticsService.ts‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ interface BufferedAnalyticsEvent {
3232
interface DeliveryState {
3333
readonly failedBatch: ReadonlyArray<BufferedAnalyticsEvent>;
3434
readonly batchAttempts: number;
35+
readonly firstFailedAt: number;
3536
readonly failures: number;
3637
readonly retryAt: number;
3738
}
@@ -40,7 +41,10 @@ interface DeliveryState {
4041
const FLUSH_INTERVAL_MS = 10_000;
4142
// A hung send would hold the flush lock, and with it the shutdown flush.
4243
const SEND_TIMEOUT = "10 seconds";
43-
const MAX_BATCH_ATTEMPTS = 5;
44+
// A failed batch is tried again until it has failed for this long. Ingest answers 503 when it
45+
// cannot store a batch, and a broken Cloudflare location can take about 5 minutes to fail over.
46+
// The waiting batch holds newer events back; `maxBufferedEvents` bounds them meanwhile.
47+
const MAX_BATCH_RETRY_MS = 30 * 60_000;
4448
const RETRY_BASE_DELAY_MS = 2_000;
4549
// Clients can report any number of owner ids; past this many per observer, new ones
4650
// are not sent. Each observer has its own cap, so client reports never crowd out the
@@ -133,6 +137,7 @@ export const make = Effect.gen(function* () {
133137
const deliveryRef = yield* Ref.make<DeliveryState>({
134138
failedBatch: [],
135139
batchAttempts: 0,
140+
firstFailedAt: 0,
136141
failures: 0,
137142
retryAt: 0,
138143
});
@@ -232,27 +237,47 @@ export const make = Effect.gen(function* () {
232237

233238
const sent = yield* Effect.result(sendBatch(batch));
234239
if (Result.isSuccess(sent)) {
235-
yield* Ref.set(deliveryRef, { failedBatch: [], batchAttempts: 0, failures: 0, retryAt: 0 });
240+
yield* Ref.set(deliveryRef, {
241+
failedBatch: [],
242+
batchAttempts: 0,
243+
firstFailedAt: 0,
244+
failures: 0,
245+
retryAt: 0,
246+
});
236247
continue;
237248
}
238249

250+
const now = yield* Clock.currentTimeMillis;
239251
const failures = delivery.failures + 1;
240252
const batchAttempts = delivery.batchAttempts + 1;
241-
const retryAt = (yield* Clock.currentTimeMillis) + retryDelayMs(failures, yield* Random.next);
253+
const firstFailedAt = delivery.batchAttempts === 0 ? now : delivery.firstFailedAt;
254+
const retryAt = now + retryDelayMs(failures, yield* Random.next);
242255
const error = sent.failure;
243256
const rejected =
244257
error._tag === "HttpClientError" &&
245258
error.reason._tag === "StatusCodeError" &&
246259
REJECTED_BATCH_STATUSES.has(error.reason.response.status);
247-
if (!rejected && batchAttempts < MAX_BATCH_ATTEMPTS) {
248-
yield* Ref.set(deliveryRef, { failedBatch: batch, batchAttempts, failures, retryAt });
260+
if (!rejected && now - firstFailedAt < MAX_BATCH_RETRY_MS) {
261+
yield* Ref.set(deliveryRef, {
262+
failedBatch: batch,
263+
batchAttempts,
264+
firstFailedAt,
265+
failures,
266+
retryAt,
267+
});
249268
yield* Effect.logDebug("Failed to send telemetry batch; will retry", {
250269
attempt: batchAttempts,
251270
cause: error,
252271
});
253272
return;
254273
}
255-
yield* Ref.set(deliveryRef, { failedBatch: [], batchAttempts: 0, failures, retryAt });
274+
yield* Ref.set(deliveryRef, {
275+
failedBatch: [],
276+
batchAttempts: 0,
277+
firstFailedAt: 0,
278+
failures,
279+
retryAt,
280+
});
256281
yield* Effect.logWarning(
257282
rejected
258283
? "Dropped telemetry batch the endpoint rejected"

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
36953695
operation: "GitVcsDriver.createWorktree",
36963696
command: "git worktree add",
36973697
cwd: input.cwd,
3698-
detail: `The worktree location "${options?.worktreesDirectory}" must be an absolute folder on this machine, not a drive root. Change it in Settings → Storage.`,
3698+
detail: `The worktree location "${options?.worktreesDirectory}" must be an absolute folder on this machine, not a drive root. Change it in Settings → Worktrees.`,
36993699
});
37003700
}
37013701
worktreePath = path.join(parentDir, repoName, sanitizedBranch);

‎apps/web/src/components/HostedEmptyState.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function HostedEmptyState() {
4949
<EmptyContent>
5050
{localEnvironmentOff ? (
5151
<Button render={<Link to="/settings/connections" />} size="sm">
52-
Open Connections
52+
Open Environments
5353
</Button>
5454
) : (
5555
<ol className="w-full space-y-4 text-left">

‎apps/web/src/components/PermissionUpdateNotice.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ function showPermissionNotice(
4848
timeout: 0,
4949
onClose: persistDismissal,
5050
actionProps: {
51-
children: "Open Connections",
51+
children: "Open Sharing & access",
5252
onClick: () => {
5353
dismiss();
54-
void router.navigate({ to: "/settings/connections" });
54+
void router.navigate({ to: "/settings/access" });
5555
},
5656
},
5757
data: {

‎apps/web/src/components/auth/ConnectAgentSurface.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ export function ConnectAgentSurface() {
233233
value={pairingCode}
234234
/>
235235
<p className="text-xs text-muted-foreground">
236-
Create one in Settings → Connections, or run <code>t3 auth pairing create</code> on
237-
this machine.
236+
Create one in Settings → Sharing & access, or run <code>t3 auth pairing create</code>{" "}
237+
on this machine.
238238
</p>
239239
</div>
240240
)}

‎apps/web/src/components/chat/guestShareAvailability.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { serverEnvironment } from "~/state/server";
66

77
/**
88
* Whether this environment offers "Share with guest": the user may create links there, and its
9-
* Guest links beta is on (Settings > Beta). The server refuses links while the beta is off.
9+
* Guest links beta is on (Settings > Labs). The server refuses links while the beta is off.
1010
*/
1111
export const canShareWithGuestAtom = Atom.family((environmentId: EnvironmentId) =>
1212
Atom.make(

‎apps/web/src/components/chat/useSystemComposerBanners.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export function useSystemComposerBanners(input: SystemComposerBannersInput) {
178178
size="xs"
179179
variant="ghost"
180180
disabled={disconnectingEnvironment}
181-
title="Hide this server's threads. Switch it on again in Connections."
181+
title="Hide this server's threads. Switch it on again in Environments."
182182
onClick={() =>
183183
void handleDisconnectActiveEnvironmentStable(
184184
activeEnvironmentUnavailableState.environmentId,

0 commit comments

Comments
 (0)