Skip to content

Commit 08b16d0

Browse files
committed
Merge remote-tracking branch 'origin/main' into samejr/task-landing-page-layout-improvements
2 parents 6c9f7be + db6228d commit 08b16d0

41 files changed

Lines changed: 3783 additions & 78 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Fix a preloaded `chat.agent` run dropping an in-flight message when it retries after an out-of-memory error. The message being processed when the run hit the OOM is now recovered and re-run on the retry, instead of being skipped while the run waited for a new message.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Fix a chunk occasionally dropped when a chat.agent run takes over from the warm first turn. The realtime stream writer now reports the inclusive last-written position as the resume cursor, so the agent's first record after the handover is no longer skipped.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@trigger.dev/core": patch
3+
"@trigger.dev/sdk": patch
4+
"trigger.dev": patch
5+
---
6+
7+
`AgentChat.reconnect()` now settles promptly when reconnecting to an idle chat instead of holding the connection open for the full long-poll window. Also upgrades the S2 streamstore client to 0.25 and moves realtime streams to S2's current hosts.

.github/workflows/e2e-webapp.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
e2eTests:
1616
name: "🧪 E2E Tests: Webapp"
1717
runs-on: warp-ubuntu-latest-x64-16x
18-
timeout-minutes: 20
18+
timeout-minutes: 30
1919
env:
2020
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
2121
steps:
@@ -80,6 +80,8 @@ jobs:
8080
docker pull postgres:14
8181
docker pull redis:7.2
8282
docker pull testcontainers/ryuk:0.11.0
83+
docker pull ghcr.io/s2-streamstore/s2:0.40.0@sha256:b26249e2ede0949755f5af8028185dc2bcfc3aa2db21eb9610543d144eb6ee9d
84+
docker pull minio/minio:latest
8385
echo "Image pre-pull complete"
8486
8587
- name: 📥 Download deps
@@ -91,6 +93,9 @@ jobs:
9193
- name: 🏗️ Build Webapp
9294
run: pnpm run build --filter webapp
9395

96+
- name: 🎭 Install Playwright Chromium
97+
run: cd apps/webapp && pnpm exec playwright install chromium
98+
9499
- name: 🧪 Run Webapp E2E Tests
95100
run: cd apps/webapp && pnpm exec vitest run --config vitest.e2e.config.ts --reporter=default
96101
env:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Speeds up resolving the latest worker version and deployment for an environment, removing an occasional stall when triggering runs in projects that have accumulated many deployed versions.

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,8 @@ const EnvironmentSchema = z
21222122
REALTIME_STREAMS_S2_BASIN: z.string().optional(),
21232123
REALTIME_STREAMS_S2_ACCESS_TOKEN: z.string().optional(),
21242124
REALTIME_STREAMS_S2_ENDPOINT: z.string().optional(),
2125+
REALTIME_STREAMS_S2_ACCOUNT_URL: z.string().default("https://a.s2.dev/v1"),
2126+
REALTIME_STREAMS_S2_BASIN_URL: z.string().default("https://{basin}.b.s2.dev/v1"),
21252127
REALTIME_STREAMS_S2_SKIP_ACCESS_TOKENS: z.enum(["true", "false"]).default("false"),
21262128
REALTIME_STREAMS_S2_ACCESS_TOKEN_EXPIRATION_IN_MS: z.coerce
21272129
.number()

apps/webapp/app/services/realtime/s2realtimeStreams.server.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export type S2RealtimeStreamsOptions = {
4444

4545
// Custom endpoint for s2-lite (self-hosted)
4646
endpoint?: string; // e.g., "http://localhost:4566/v1"
47+
/** Account-level API base for account/basin ops. Defaults to S2 cloud. */
48+
accountUrl?: string;
49+
/** Per-basin API base, with a `{basin}` placeholder. Defaults to S2 cloud. */
50+
basinUrl?: string;
4751

4852
// Skip access token issuance (s2-lite doesn't support /access-tokens)
4953
skipAccessTokens?: boolean;
@@ -74,6 +78,15 @@ export type S2RealtimeStreamsOptions = {
7478
const S2_TOKEN_OPS = ["append", "create-stream", "trim"] as const;
7579
const S2_TOKEN_OPS_FINGERPRINT = [...S2_TOKEN_OPS].sort().join(",");
7680

81+
/**
82+
* Placeholder handed back as the S2 access token when `skipAccessTokens` is set
83+
* and no token is configured (self-hosted s2-lite ignores the token entirely).
84+
* The SDK's session-stream writer rejects an empty access token as "no S2
85+
* credentials" and never opens the writer, so the token must be non-empty even
86+
* when it is semantically unused.
87+
*/
88+
const SKIP_ACCESS_TOKENS_SENTINEL = "s2-skip-access-tokens";
89+
7790
type S2IssueAccessTokenResponse = { access_token: string };
7891
type S2AppendInput = { records: { body: string }[] };
7992
type S2AppendAck = {
@@ -107,8 +120,10 @@ export class S2RealtimeStreams implements StreamResponder, StreamIngestor {
107120

108121
constructor(opts: S2RealtimeStreamsOptions) {
109122
this.basin = opts.basin;
110-
this.baseUrl = opts.endpoint ?? `https://${this.basin}.b.aws.s2.dev/v1`;
111-
this.accountUrl = opts.endpoint ?? `https://aws.s2.dev/v1`;
123+
this.baseUrl =
124+
opts.endpoint ??
125+
(opts.basinUrl ?? `https://{basin}.b.s2.dev/v1`).replace("{basin}", this.basin);
126+
this.accountUrl = opts.endpoint ?? opts.accountUrl ?? `https://a.s2.dev/v1`;
112127
this.endpoint = opts.endpoint;
113128
this.token = opts.accessToken;
114129
this.streamPrefix = opts.streamPrefix ?? "";
@@ -168,7 +183,7 @@ export class S2RealtimeStreams implements StreamResponder, StreamIngestor {
168183
relativeName: string
169184
): Promise<{ responseHeaders?: Record<string, string> }> {
170185
const accessToken = this.skipAccessTokens
171-
? this.token
186+
? this.token || SKIP_ACCESS_TOKENS_SENTINEL
172187
: await this.getS2AccessToken(randomUUID());
173188

174189
return {
@@ -178,7 +193,7 @@ export class S2RealtimeStreams implements StreamResponder, StreamIngestor {
178193
"X-S2-Basin": this.basin,
179194
"X-S2-Flush-Interval-Ms": this.flushIntervalMs.toString(),
180195
"X-S2-Max-Retries": this.maxRetries.toString(),
181-
...(this.endpoint ? { "X-S2-Endpoint": this.endpoint } : {}),
196+
"X-S2-Endpoint": this.baseUrl,
182197
},
183198
};
184199
}

apps/webapp/app/services/realtime/streamBasinProvisioner.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ type CreateBasinOptions = {
185185
};
186186

187187
async function s2CreateBasin(name: string, opts: CreateBasinOptions): Promise<void> {
188-
const url = `https://aws.s2.dev/v1/basins`;
188+
const url = `${env.REALTIME_STREAMS_S2_ACCOUNT_URL}/basins`;
189189
const body = {
190190
basin: name,
191191
config: {
@@ -222,7 +222,7 @@ type ReconfigureBasinOptions = {
222222
};
223223

224224
async function s2ReconfigureBasin(name: string, opts: ReconfigureBasinOptions): Promise<void> {
225-
const url = `https://aws.s2.dev/v1/basins/${encodeURIComponent(name)}`;
225+
const url = `${env.REALTIME_STREAMS_S2_ACCOUNT_URL}/basins/${encodeURIComponent(name)}`;
226226
const body = {
227227
default_stream_config: {
228228
retention_policy: { age: parseDuration(opts.retentionPolicy) },

apps/webapp/app/services/realtime/v1StreamsGlobal.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export function getRealtimeStreamInstance(
7070
basin: resolvedBasin,
7171
accessToken: env.REALTIME_STREAMS_S2_ACCESS_TOKEN ?? "",
7272
endpoint: env.REALTIME_STREAMS_S2_ENDPOINT,
73+
accountUrl: env.REALTIME_STREAMS_S2_ACCOUNT_URL,
74+
basinUrl: env.REALTIME_STREAMS_S2_BASIN_URL,
7375
skipAccessTokens: env.REALTIME_STREAMS_S2_SKIP_ACCESS_TOKENS === "true",
7476
streamPrefix: streamPrefixFor(environment, resolvedBasin),
7577
logLevel: env.REALTIME_STREAMS_S2_LOG_LEVEL,

apps/webapp/app/services/runsRepository/clickhouseRunsRepository.server.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,6 @@ export class ClickHouseRunsRepository implements IRunsRepository {
271271
in: ids,
272272
},
273273
},
274-
orderBy: {
275-
id: "desc",
276-
},
277274
select: {
278275
id: true,
279276
friendlyId: true,

0 commit comments

Comments
 (0)