Skip to content

Commit 50b83ea

Browse files
authored
Merge branch 'main' into feat(webapp)-chat-ai-UI-improvements
2 parents 5dbda76 + b7ef51d commit 50b83ea

10 files changed

Lines changed: 70 additions & 7 deletions

File tree

.github/workflows/check-review-md.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ concurrency:
1414

1515
jobs:
1616
audit:
17+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
18+
# jobs; leave it unset (the default) to keep them enabled.
1719
if: >-
20+
vars.ENABLE_CLAUDE_CODE != 'false' &&
1821
github.event.pull_request.draft == false &&
1922
github.event.pull_request.head.repo.full_name == github.repository
2023
runs-on: ubuntu-latest

.github/workflows/claude-md-audit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ concurrency:
1515

1616
jobs:
1717
audit:
18+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
19+
# jobs; leave it unset (the default) to keep them enabled.
1820
if: >-
21+
vars.ENABLE_CLAUDE_CODE != 'false' &&
1922
github.event.pull_request.draft == false &&
2023
github.event.pull_request.head.repo.full_name == github.repository
2124
runs-on: ubuntu-latest

.github/workflows/claude.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ on:
1212

1313
jobs:
1414
claude:
15+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
16+
# jobs; leave it unset (the default) to keep them enabled.
1517
if: |
16-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
18+
vars.ENABLE_CLAUDE_CODE != 'false' &&
19+
(
20+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
21+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
22+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
23+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
24+
)
2025
runs-on: ubuntu-latest
2126
permissions:
2227
contents: write

.github/workflows/workflow-checks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636

3737
zizmor:
3838
name: Zizmor
39+
# Uploads SARIF to the Security tab, which requires GitHub code scanning to be
40+
# enabled on the repository. Set the ENABLE_WORKFLOW_SECURITY_SCAN repository
41+
# variable to 'false' to skip this job where code scanning isn't available;
42+
# leave it unset (the default) to run the scan.
43+
if: ${{ vars.ENABLE_WORKFLOW_SECURITY_SCAN != 'false' }}
3944
runs-on: ubuntu-latest
4045
permissions:
4146
security-events: write # Upload SARIF to GitHub Security tab
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+
Harden the native realtime backend's run-change publishing so a publish can never throw into a run lifecycle operation and never buffers commands in memory during a pub/sub Redis outage.

apps/webapp/app/redis.server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type RedisWithClusterOptions = {
1111
clusterMode?: boolean;
1212
clusterOptions?: Omit<ClusterOptions, "redisOptions">;
1313
keyPrefix?: string;
14+
/** Cap retries for a command before it rejects; `null` means unlimited (default: ioredis's default of 20). */
15+
maxRetriesPerRequest?: number | null;
1416
};
1517

1618
export type RedisClient = Redis | Cluster;
@@ -44,6 +46,9 @@ export function createRedisClient(
4446
password: options.password,
4547
enableAutoPipelining: true,
4648
reconnectOnError: defaultReconnectOnError,
49+
...(options.maxRetriesPerRequest !== undefined
50+
? { maxRetriesPerRequest: options.maxRetriesPerRequest }
51+
: {}),
4752
...(options.tlsDisabled
4853
? {
4954
checkServerIdentity: () => {
@@ -72,6 +77,9 @@ export function createRedisClient(
7277
enableAutoPipelining: true,
7378
keyPrefix: options.keyPrefix,
7479
reconnectOnError: defaultReconnectOnError,
80+
...(options.maxRetriesPerRequest !== undefined
81+
? { maxRetriesPerRequest: options.maxRetriesPerRequest }
82+
: {}),
7583
...(options.tlsDisabled ? {} : { tls: {} }),
7684
});
7785
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,13 @@ export class RunChangeNotifier {
225225

226226
#ensurePublisher(): RedisClient {
227227
if (!this.#publisher) {
228-
this.#publisher = createRedisClient(`${this.#connectionName}:pub`, this.options.redis);
228+
// Publishes are fire-and-forget with a consumer-side backstop, so a dropped publish is
229+
// latency-only. Cap retries (vs ioredis's default 20) so a pub/sub outage rejects publishes
230+
// after ~1 reconnect cycle instead of buffering them in memory across the fleet.
231+
this.#publisher = createRedisClient(`${this.#connectionName}:pub`, {
232+
...this.options.redis,
233+
maxRetriesPerRequest: 1,
234+
});
229235
}
230236
return this.#publisher;
231237
}

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getMeter } from "@internal/tracing";
22
import { env } from "~/env.server";
33
import { singleton } from "~/utils/singleton";
4+
import { logger } from "../logger.server";
45
import { RunChangeNotifier, type ChangeRecordInput } from "./runChangeNotifier.server";
56

67
/**
@@ -74,12 +75,24 @@ export function publishChangeRecord(input: ChangeRecordInput): void {
7475
if (!nativeBackendEnabled) {
7576
return;
7677
}
77-
getRunChangeNotifier().publish(input);
78+
// Publish runs on the run-engine event bus / metadata flush loop; lazy init + encoding happen
79+
// before the notifier's own try/catch, so guard the whole call — it must never throw at its caller.
80+
try {
81+
getRunChangeNotifier().publish(input);
82+
} catch (error) {
83+
logger.error("[runChangeNotifier] publishChangeRecord threw; dropping notification", { error });
84+
}
7885
}
7986

8087
export function publishManyChangeRecords(inputs: ChangeRecordInput[]): void {
8188
if (!nativeBackendEnabled) {
8289
return;
8390
}
84-
getRunChangeNotifier().publishMany(inputs);
91+
try {
92+
getRunChangeNotifier().publishMany(inputs);
93+
} catch (error) {
94+
logger.error("[runChangeNotifier] publishManyChangeRecords threw; dropping notifications", {
95+
error,
96+
});
97+
}
8598
}

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ RUN chmod +x ./scripts/wait-for-it.sh
6868
RUN chmod +x ./scripts/entrypoint.sh
6969
COPY --chown=node:node .configs/tsconfig.base.json .configs/tsconfig.base.json
7070
COPY --chown=node:node scripts/updateVersion.ts scripts/updateVersion.ts
71+
COPY --chown=node:node scripts/bundleSdkDocs.ts scripts/bundleSdkDocs.ts
7172
RUN pnpm run generate
7273
RUN --mount=type=secret,id=sentry_auth_token \
7374
SENTRY_AUTH_TOKEN=$(cat /run/secrets/sentry_auth_token) \

scripts/bundleSdkDocs.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ async function collectManifest(): Promise<string[]> {
6565
}
6666

6767
async function bundleSdkDocs() {
68+
// When the SDK is built as a dependency inside a pruned workspace (e.g. the webapp Docker
69+
// image), the repo-level docs/ tree is a separate workspace package that isn't part of that
70+
// build's dependency graph, so it isn't present. The SDK isn't being published there, so
71+
// there's nothing to bundle: skip rather than fail. Publishing always runs from the full
72+
// monorepo where docs/ exists, so the missing-docs guard below still protects releases.
73+
const docsRoot = path.join(repoRoot, "docs");
74+
try {
75+
await fs.access(docsRoot);
76+
} catch {
77+
console.log(`[bundleSdkDocs] docs/ not present at ${docsRoot}; skipping (pruned build)`);
78+
return;
79+
}
80+
6881
const manifest = await collectManifest();
6982

7083
if (manifest.length === 0) {

0 commit comments

Comments
 (0)