feat(cli,core): add opt-in dev-only telnet log streaming#4110
Conversation
🦋 Changeset detectedLatest commit: fbbdd25 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis pull request adds an opt-in, dev-only telnet/TCP log streaming feature to the Trigger.dev core package. A new Changes
Sequence Diagram(s)sequenceDiagram
participant EnvVar
participant AppStartup
participant TelnetLogServer
participant OnLogHook
participant TCPClient
EnvVar->>AppStartup: telnet port value
AppStartup->>TelnetLogServer: start()
AppStartup->>OnLogHook: assign log callback
OnLogHook->>TelnetLogServer: broadcast(formatted log)
TelnetLogServer->>TCPClient: write(line)
Related PRs: None identified. Suggested labels: area: supervisor, area: webapp, area: core, type: feature Suggested reviewers: None identified. 🐰 A whisker-thin port, a telnet-y stream, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b14264b to
992097f
Compare
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
992097f to
802cc0d
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/core/src/v3/telnetLogServer.ts (2)
29-30: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win
hostoverride can silently defeat the localhost-only guarantee.The doc comment says to "never bind a public interface for an unauthenticated stream," but
options.hostis accepted as-is with no validation. A future caller passing"0.0.0.0"(or any non-loopback address) would expose an unauthenticated, unauthenticated write-only log stream externally, with nothing in this module to prevent it.🛡️ Proposed guard against non-loopback hosts
+const LOOPBACK_HOSTS = new Set(["127.0.0.1", "localhost", "::1"]); + constructor(options: TelnetLogServerOptions) { this.name = options.name; this.port = options.port; this.host = options.host ?? "127.0.0.1"; + if (!LOOPBACK_HOSTS.has(this.host)) { + throw new Error( + `[telnet-logs] refusing to bind non-loopback host "${this.host}" for an unauthenticated stream` + ); + } this.#banner = options.banner;Also applies to: 50-54
225-251: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRepeated
patchConsoleToTelnetcalls stack patches.No guard prevents calling this twice on the same process; a second call would wrap the already-patched methods, double-broadcasting every line if
restore()isn't called between invocations. Low risk given this is a dev-only, single-call-site utility.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2a3006f6-e8f8-45c7-b3a9-db690ce89db2
📒 Files selected for processing (17)
.changeset/telnet-dev-logs.md.env.example.server-changes/coordinator-telnet-logs.md.server-changes/supervisor-telnet-logs.md.server-changes/webapp-telnet-logs.mdapps/coordinator/.env.exampleapps/coordinator/src/index.tsapps/supervisor/.env.exampleapps/supervisor/src/env.tsapps/supervisor/src/index.tsapps/webapp/app/env.server.tsapps/webapp/app/services/logger.server.tspackages/core/package.jsonpackages/core/src/logger.tspackages/core/src/v3/telnetLogServer.test.tspackages/core/src/v3/telnetLogServer.tspackages/core/src/v3/utils/structuredLogger.ts
✅ Files skipped from review due to trivial changes (5)
- .server-changes/webapp-telnet-logs.md
- apps/supervisor/src/env.ts
- .server-changes/supervisor-telnet-logs.md
- .server-changes/coordinator-telnet-logs.md
- .changeset/telnet-dev-logs.md
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/webapp/app/env.server.ts
- apps/supervisor/src/index.ts
- .env.example
- apps/coordinator/src/index.ts
- packages/core/src/logger.ts
- packages/core/src/v3/telnetLogServer.test.ts
- packages/core/package.json
- apps/webapp/app/services/logger.server.ts
- packages/core/src/v3/utils/structuredLogger.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
- GitHub Check: webapp / 📊 Merge Reports
- GitHub Check: packages / 📊 Merge Reports
- GitHub Check: internal / 🧪 Unit Tests: Internal (2, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (6, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (3, 12)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
Files:
packages/core/src/v3/telnetLogServer.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use zod for validation in packages/core and apps/webapp
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries
Files:
packages/core/src/v3/telnetLogServer.ts
packages/core/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (packages/core/CLAUDE.md)
Never import the root package (
@trigger.dev/core). Always use subpath imports such as@trigger.dev/core/v3,@trigger.dev/core/v3/utils,@trigger.dev/core/logger, or@trigger.dev/core/schemas
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}: Usepnpm run typecheckfor changes in apps (apps/*) and internal packages (internal-packages/*), and never usebuildto verify those changes.
Use Vitest for tests, and never mock anything; use testcontainers instead.
Prefer static imports over dynamicimport(), and only use dynamic imports for unresolved circular dependencies, genuine code-splitting needs, or conditional runtime loading.
Files:
packages/core/src/v3/telnetLogServer.ts
packages/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
pnpm run buildto verify changes in public packages (packages/*).
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,md,mdx}
📄 CodeRabbit inference engine (CLAUDE.md)
Always import from
@trigger.dev/sdkwhen writing Trigger.dev tasks; never use@trigger.dev/sdk/v3or deprecatedclient.defineJob.
Files:
packages/core/src/v3/telnetLogServer.ts
🧠 Learnings (9)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma error P1001 ("Can't reach database server") in TypeScript, don’t assume a single error shape. Prisma can surface P1001 via two different error classes/fields: `PrismaClientKnownRequestError` exposes it as `err.code === "P1001"` (common during mid-query connection drops), while `PrismaClientInitializationError` exposes it as `err.errorCode === "P1001"` (common on client startup failure). Therefore, predicates should use `err.code === "P1001" || err.errorCode === "P1001"`. Do not flag `err.code === "P1001"` as “unreachable/never matches,” as it is expected in production.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma errors for P1001 ("Can't reach database server"), do not assume it only appears under a single property name. Prisma may surface P1001 via either `PrismaClientKnownRequestError` (`err.code === "P1001"`, e.g., mid-query connection drops) or `PrismaClientInitializationError` (`err.errorCode === "P1001"`, e.g., client startup connection failure). To reliably detect the condition, check `err.code === "P1001" || err.errorCode === "P1001"`, and avoid review rules that would incorrectly flag `err.code === "P1001"` as unreachable/never-matching.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-13T19:53:13.759Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3937
File: packages/trigger-sdk/skills/realtime-and-frontend/SKILL.md:258-260
Timestamp: 2026-06-13T19:53:13.759Z
Learning: When reviewing code that uses `trigger.dev/react-hooks`’s `useRealtimeRun`, preserve the call signature where the first argument is the full realtime handle object (not `handle.id`). This is intentional to maintain type-safety and is consistent with the official docs; do not suggest changing the first argument from the handle object to `handle.id`.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-17T17:13:49.929Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3948
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx:48-62
Timestamp: 2026-06-17T17:13:49.929Z
Learning: In triggerdotdev/trigger.dev, within `dashboardLoader`/`dashboardAction` (or similar context resolver code) whenever you resolve an organization ID from an organization slug for RBAC/enterprise authorization scope, always read from the primary Prisma client (`prisma`), not `$replica`. Using `$replica` can hit replica-lag and cause the RBAC lookup/authorization to run without the correct org scope (bypassing intended role enforcement). Implement the slug→org lookup with `prisma.organization.findFirst(...)` (or equivalent primary-client query) and add an inline comment documenting why the primary client is required (replica lag could lead to unscoped RBAC checks).
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-23T13:04:21.413Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4023
File: apps/webapp/app/services/upsertBranch.server.ts:14-18
Timestamp: 2026-06-23T13:04:21.413Z
Learning: In TypeScript, it’s valid to `import { type X }` and then use `typeof X` in a type-only position, e.g. `type Alias = z.infer<typeof X>`. The `type` modifier suppresses the runtime import, but the type checker still has the full exported type so `z.infer<typeof X>` can resolve correctly. In code reviews, don’t flag this as a TypeScript compile error as long as `typeof X` is used in a type context (e.g., with `z.infer`, `type` aliases, generics), not as a runtime value.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-09T17:58:04.699Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 3879
File: apps/webapp/app/models/vercelIntegration.server.ts:619-630
Timestamp: 2026-06-09T17:58:04.699Z
Learning: In this codebase, outbound raw `fetch` calls should typically rely on Node/undici’s default request timeout (about ~300s) rather than adding a per-call `AbortController` + `setTimeout` wrapper inside individual functions (e.g. in files like `apps/webapp/app/models/vercelIntegration.server.ts`). During code review, do not flag the absence of a per-call timeout on a single `fetch` as an issue; if per-call timeouts are needed, they should be implemented via a codebase-wide convention (e.g., a shared fetch wrapper or documented pattern) rather than ad-hoc per-function changes.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
🪛 ast-grep (0.44.0)
packages/core/src/v3/telnetLogServer.ts
[warning] 15-19: Do not use variable for regular expressions
Context: new RegExp(
"[\u001B\u009B][\#;?](?:(?:(?:[a-zA-Z\d](?:;[-a-zA-Z\d/#&.:=?%@_]))?\u0007)" +]))",
"|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity. Security best practice.
(regexp-non-literal-typescript)
🪛 dotenv-linter (4.0.0)
apps/coordinator/.env.example
[warning] 6-6: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
[warning] 6-6: [UnorderedKey] The COORDINATOR_TELNET_LOGS_PORT key should go before the HTTP_SERVER_PORT key
(UnorderedKey)
apps/supervisor/.env.example
[warning] 20-20: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
🔇 Additional comments (4)
apps/coordinator/.env.example (1)
4-6: 📐 Maintainability & Code Quality | 💤 Low valueFix dotenv-lint warnings: missing trailing newline and key ordering.
dotenv-linterflagsEndingBlankLine(no trailing newline) andUnorderedKey(COORDINATOR_TELNET_LOGS_PORTshould precedeHTTP_SERVER_PORT) on this range.Source: Linters/SAST tools
apps/supervisor/.env.example (1)
17-20: 📐 Maintainability & Code Quality | 💤 Low valueAdd trailing newline.
dotenv-linterstill reportsEndingBlankLinefor this file.Source: Linters/SAST tools
packages/core/src/v3/telnetLogServer.ts (2)
14-24: 🔒 Security & Privacy | ⚖️ Poor tradeoffHand-rolled ANSI-stripping regex re-flagged.
Same backtracking-prone regex as before, still executed on every
patchConsoleToTelnet-mirrored console call. Prior investigation foundstrip-ansiv7+ is ESM-only and would need a dynamic import to use from this CJS/dual-mode package — worth deciding on that tradeoff (dynamic import vs. a simpler/anchored regex) rather than leaving the current pattern.Source: Linters/SAST tools
61-66: LGTM!Also applies to: 93-99
802cc0d to
6535565
Compare
6535565 to
9718aaf
Compare
| DIRECT_URL=${DATABASE_URL} | ||
| REMIX_APP_PORT=3030 | ||
| # Dev-only: stream the webapp's logs over a local telnet/TCP socket (nc localhost 6767). Unset to disable. | ||
| WEBAPP_TELNET_LOGS_PORT=6767 |
There was a problem hiding this comment.
should this be commented out by default?
| TRIGGER_DEQUEUE_INTERVAL_MS=1000 | ||
|
|
||
| # Dev-only: stream this process's logs over a local telnet/TCP socket (nc localhost 6769). Unset to disable. | ||
| SUPERVISOR_TELNET_LOGS_PORT=6769 |
There was a problem hiding this comment.
should this be commented out by default? what if we don't consume it and there's lots of logs
| SECURE_CONNECTION=false No newline at end of file | ||
| SECURE_CONNECTION=false | ||
| # Dev-only: stream this process's logs over a local telnet/TCP socket (nc localhost 6770). Unset to disable. | ||
| COORDINATOR_TELNET_LOGS_PORT=6770 |
There was a problem hiding this comment.
when you get rid of coordinator changes also remove this
Stream dev logs over a local telnet/TCP socket. `trigger dev` mirrors its terminal output on port 6700 by default (override with --telnet-logs-port or TRIGGER_DEV_TELNET_LOGS_PORT, 0 disables). webapp, supervisor, and coordinator each expose an opt-in stream gated on a per-service *_TELNET_LOGS_PORT env var. New @trigger.dev/core/v3/telnetLogServer module (localhost-only, backpressure-safe, plain-text) plus optional static Logger.onLog / SimpleStructuredLogger.onLog sinks.
9718aaf to
fbbdd25
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7f4ab11a-888d-4f9e-a843-3dcc4880d994
📒 Files selected for processing (14)
.changeset/telnet-dev-logs.md.env.example.server-changes/supervisor-telnet-logs.md.server-changes/webapp-telnet-logs.mdapps/supervisor/.env.exampleapps/supervisor/src/env.tsapps/supervisor/src/index.tsapps/webapp/app/env.server.tsapps/webapp/app/services/logger.server.tspackages/core/package.jsonpackages/core/src/logger.tspackages/core/src/v3/telnetLogServer.test.tspackages/core/src/v3/telnetLogServer.tspackages/core/src/v3/utils/structuredLogger.ts
✅ Files skipped from review due to trivial changes (5)
- .server-changes/webapp-telnet-logs.md
- .server-changes/supervisor-telnet-logs.md
- .env.example
- .changeset/telnet-dev-logs.md
- apps/supervisor/.env.example
🚧 Files skipped from review as they are similar to previous changes (8)
- apps/supervisor/src/env.ts
- packages/core/package.json
- apps/webapp/app/env.server.ts
- apps/supervisor/src/index.ts
- packages/core/src/v3/utils/structuredLogger.ts
- packages/core/src/logger.ts
- packages/core/src/v3/telnetLogServer.test.ts
- apps/webapp/app/services/logger.server.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
- GitHub Check: e2e / 🧪 CLI v3 tests (blacksmith-4vcpu-windows-2025 - pnpm)
- GitHub Check: internal / 🧪 Unit Tests: Internal (11, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (1, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (12, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (3, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (9, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (8, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (6, 12)
- GitHub Check: internal / 🧪 Unit Tests: Internal (2, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 10)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 10)
- GitHub Check: packages / 🧪 Unit Tests: Packages (3, 3)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 10)
⚠️ CI failures not shown inline (2)
GitHub Actions: 🤖 PR Checks / 0_All PR Checks.txt: feat(cli,core): add opt-in dev-only telnet log streaming
Conclusion: failure
##[group]Run if [[ "false" == "true" ]]; then
�[36;1mif [[ "false" == "true" ]]; then�[0m
�[36;1m echo "One or more checks failed"�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1mif [[ "true" == "true" ]]; then�[0m
�[36;1m echo "One or more checks were cancelled"�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1mecho "All checks passed or were skipped due to path filters"�[0m
shell: /usr/bin/bash -e {0}
env:
BLACKSMITH_RUNNER_MESSAGE_WAIT_MS: 50822
BLACKSMITH_RUNNER_ACQUIRE_JOB_MS: 1426
GITHUB_REPO_NAME: triggerdotdev/trigger.dev
##[endgroup]
One or more checks were cancelled
##[error]Process completed with exit code 1.
GitHub Actions: 🤖 PR Checks / All PR Checks: feat(cli,core): add opt-in dev-only telnet log streaming
Conclusion: failure
##[group]Run if [[ "false" == "true" ]]; then
�[36;1mif [[ "false" == "true" ]]; then�[0m
�[36;1m echo "One or more checks failed"�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1mif [[ "true" == "true" ]]; then�[0m
�[36;1m echo "One or more checks were cancelled"�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1mecho "All checks passed or were skipped due to path filters"�[0m
shell: /usr/bin/bash -e {0}
env:
BLACKSMITH_RUNNER_MESSAGE_WAIT_MS: 50822
BLACKSMITH_RUNNER_ACQUIRE_JOB_MS: 1426
GITHUB_REPO_NAME: triggerdotdev/trigger.dev
##[endgroup]
One or more checks were cancelled
##[error]Process completed with exit code 1.
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
Files:
packages/core/src/v3/telnetLogServer.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use zod for validation in packages/core and apps/webapp
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries
Files:
packages/core/src/v3/telnetLogServer.ts
packages/core/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (packages/core/CLAUDE.md)
Never import the root package (
@trigger.dev/core). Always use subpath imports such as@trigger.dev/core/v3,@trigger.dev/core/v3/utils,@trigger.dev/core/logger, or@trigger.dev/core/schemas
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}: Usepnpm run typecheckfor changes in apps (apps/*) and internal packages (internal-packages/*), and never usebuildto verify those changes.
Use Vitest for tests, and never mock anything; use testcontainers instead.
Prefer static imports over dynamicimport(), and only use dynamic imports for unresolved circular dependencies, genuine code-splitting needs, or conditional runtime loading.
Files:
packages/core/src/v3/telnetLogServer.ts
packages/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
pnpm run buildto verify changes in public packages (packages/*).
Files:
packages/core/src/v3/telnetLogServer.ts
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,md,mdx}
📄 CodeRabbit inference engine (CLAUDE.md)
Always import from
@trigger.dev/sdkwhen writing Trigger.dev tasks; never use@trigger.dev/sdk/v3or deprecatedclient.defineJob.
Files:
packages/core/src/v3/telnetLogServer.ts
🧠 Learnings (9)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma error P1001 ("Can't reach database server") in TypeScript, don’t assume a single error shape. Prisma can surface P1001 via two different error classes/fields: `PrismaClientKnownRequestError` exposes it as `err.code === "P1001"` (common during mid-query connection drops), while `PrismaClientInitializationError` exposes it as `err.errorCode === "P1001"` (common on client startup failure). Therefore, predicates should use `err.code === "P1001" || err.errorCode === "P1001"`. Do not flag `err.code === "P1001"` as “unreachable/never matches,” as it is expected in production.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma errors for P1001 ("Can't reach database server"), do not assume it only appears under a single property name. Prisma may surface P1001 via either `PrismaClientKnownRequestError` (`err.code === "P1001"`, e.g., mid-query connection drops) or `PrismaClientInitializationError` (`err.errorCode === "P1001"`, e.g., client startup connection failure). To reliably detect the condition, check `err.code === "P1001" || err.errorCode === "P1001"`, and avoid review rules that would incorrectly flag `err.code === "P1001"` as unreachable/never-matching.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-13T19:53:13.759Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3937
File: packages/trigger-sdk/skills/realtime-and-frontend/SKILL.md:258-260
Timestamp: 2026-06-13T19:53:13.759Z
Learning: When reviewing code that uses `trigger.dev/react-hooks`’s `useRealtimeRun`, preserve the call signature where the first argument is the full realtime handle object (not `handle.id`). This is intentional to maintain type-safety and is consistent with the official docs; do not suggest changing the first argument from the handle object to `handle.id`.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-17T17:13:49.929Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3948
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx:48-62
Timestamp: 2026-06-17T17:13:49.929Z
Learning: In triggerdotdev/trigger.dev, within `dashboardLoader`/`dashboardAction` (or similar context resolver code) whenever you resolve an organization ID from an organization slug for RBAC/enterprise authorization scope, always read from the primary Prisma client (`prisma`), not `$replica`. Using `$replica` can hit replica-lag and cause the RBAC lookup/authorization to run without the correct org scope (bypassing intended role enforcement). Implement the slug→org lookup with `prisma.organization.findFirst(...)` (or equivalent primary-client query) and add an inline comment documenting why the primary client is required (replica lag could lead to unscoped RBAC checks).
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-23T13:04:21.413Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4023
File: apps/webapp/app/services/upsertBranch.server.ts:14-18
Timestamp: 2026-06-23T13:04:21.413Z
Learning: In TypeScript, it’s valid to `import { type X }` and then use `typeof X` in a type-only position, e.g. `type Alias = z.infer<typeof X>`. The `type` modifier suppresses the runtime import, but the type checker still has the full exported type so `z.infer<typeof X>` can resolve correctly. In code reviews, don’t flag this as a TypeScript compile error as long as `typeof X` is used in a type context (e.g., with `z.infer`, `type` aliases, generics), not as a runtime value.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
📚 Learning: 2026-06-09T17:58:04.699Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 3879
File: apps/webapp/app/models/vercelIntegration.server.ts:619-630
Timestamp: 2026-06-09T17:58:04.699Z
Learning: In this codebase, outbound raw `fetch` calls should typically rely on Node/undici’s default request timeout (about ~300s) rather than adding a per-call `AbortController` + `setTimeout` wrapper inside individual functions (e.g. in files like `apps/webapp/app/models/vercelIntegration.server.ts`). During code review, do not flag the absence of a per-call timeout on a single `fetch` as an issue; if per-call timeouts are needed, they should be implemented via a codebase-wide convention (e.g., a shared fetch wrapper or documented pattern) rather than ad-hoc per-function changes.
Applied to files:
packages/core/src/v3/telnetLogServer.ts
🪛 ast-grep (0.44.0)
packages/core/src/v3/telnetLogServer.ts
[warning] 18-26: Do not use variable for regular expressions
Context: new RegExp(
[
"[\u001B\u009B][\#;?](?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@_]))?" +]))",
ST +
")",
"(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><
].join("|"),
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity. Security best practice.
(regexp-non-literal-typescript)
🔇 Additional comments (4)
packages/core/src/v3/telnetLogServer.ts (4)
18-27: Existing ANSI-regex review still applies.The static-analysis concern around the hand-rolled
RegExpis already covered by the prior review thread for this range.
57-61: Existing loopback binding review still applies.
hostis still accepted verbatim; the previous review comment about enforcing loopback-only binding remains applicable.
81-93: Existing backpressure cap review still applies.The socket buffer check still excludes the size of the line about to be written; the previous review comment remains applicable.
161-181: Existing CR/LF escaping review still applies.Structured string fields can still split the promised single-line output; the previous review comment for these ranges remains applicable.
Also applies to: 184-187
| const message = typeof log.message === "string" ? log.message : ""; | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Normalize $message alongside message.
$message is reserved on Line 152, but both formatters only read message, so structured logs using the $level/$message shape either lose the message or skip pretty-formatting.
Proposed fix
- const message = typeof log.message === "string" ? log.message : "";
+ const rawMessage = log.message ?? log.$message;
+ const message = typeof rawMessage === "string" ? rawMessage : "";
@@
- if (
+ const record = parsed as Record<string, unknown>;
+ const rawMessage = record.message ?? record.$message;
+ if (
typeof parsed !== "object" ||
parsed === null ||
Array.isArray(parsed) ||
- typeof (parsed as Record<string, unknown>).message !== "string" ||
- ((parsed as Record<string, unknown>).level === undefined &&
- (parsed as Record<string, unknown>).$level === undefined)
+ typeof rawMessage !== "string" ||
+ (record.level === undefined && record.$level === undefined)
) {
return line;
}
- return formatLogLine(parsed as Record<string, unknown>);
+ return formatLogLine(record);Also applies to: 212-222
| start(): this { | ||
| this.#server.listen(this.port, this.host, () => { | ||
| process.stdout.write(`[telnet-logs] ${this.name} streaming on ${this.host}:${this.port}\n`); | ||
| }); | ||
| return this; | ||
| } |
There was a problem hiding this comment.
🚩 TCP server not unref'd — may prevent clean process exit in supervisor
The TelnetLogServer creates a net.Server (telnetLogServer.ts:63) that is never unref()'d. A listening net.Server keeps the Node.js event loop alive. In the supervisor (apps/supervisor/src/index.ts:753-760), the telnet server is created at module scope with no reference stored for later cleanup — ManagedSupervisor.stop() at apps/supervisor/src/index.ts:736-749 has no way to close it. If the supervisor ever attempts a graceful shutdown by draining the event loop (rather than process.exit()), the telnet server would prevent exit. Adding this.#server.unref() in TelnetLogServer.start() after listen() would make the server not keep the process alive, which is the expected behavior for a dev-only logging side-channel. The webapp is unaffected because its SIGTERM handler calls process.exit() directly.
Was this helpful? React with 👍 or 👎 to provide feedback.
Stream dev logs over a local telnet/TCP socket.
trigger devmirrors its terminal output on port 6767 by default (override with --telnet-logs-port or TRIGGER_DEV_TELNET_LOGS_PORT, 0 disables). webapp, supervisor, and coordinator each expose an opt-in stream gated on a per-service *_TELNET_LOGS_PORT env var. New @trigger.dev/core/v3/telnetLogServer module (localhost-only, backpressure-safe, plain-text) plus optional static Logger.onLog / SimpleStructuredLogger.onLog sinks.Then you (or your agent) can use

ncto connect and filter out the stream.