This repository was archived by the owner on Oct 10, 2026. It is now read-only.
Repository navigation
Merge upstream pingdotgg/t3code: 11 commits (tracing, IntelliJ, pagination, bug fixes) #44
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
915a054
Paginate git branch listing and search results (#1691)
juliusmarminge ae3ea39
Clicking logo now navigates to threads (#1617)
waLLxAck d2822a8
fix: use explicit refspec for push in worktrees with slashed branch n…
D3OXY da107f3
Fix websocket closing and reopening connections too eagerly (#1701)
juliusmarminge 48481aa
Fix stale send spinner after completed turns (#1700)
0853405
Fix scroll to bottom button flickering near bottom of the chat (#1692)
vaeho 9013c07
Clean up terminal state when threads are archived (#1702)
juliusmarminge 1b272fd
feat: support IntelliJ IDEA open-in launch (#1673)
cenumi 752f96e
Add server observability tracing and metrics (#1697)
juliusmarminge e8f5b4a
[codex] Revert stale send spinner fix (#1704)
juliusmarminge e9ed849
Persist server OTLP tracing settings across restarts (#1705)
juliusmarminge d4913f1
Merge upstream/main: 11 commits (tracing, IntelliJ support, paginatio…
aaditagrawal db1d3b6
Address CodeRabbit review: security, robustness, and correctness fixes
aaditagrawal 14473d6
Address CodeRabbit re-review: draft state fallback and split limit guard
aaditagrawal b0e22f5
Use per-thread terminal state for drawer visibility in multi-thread m…
aaditagrawal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { NetService } from "@t3tools/shared/Net"; | ||
| import { Config, Effect, LogLevel, Option, Schema } from "effect"; | ||
| import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings"; | ||
| import { Config, Effect, FileSystem, LogLevel, Option, Path, Schema } from "effect"; | ||
| import { Command, Flag, GlobalFlag } from "effect/unstable/cli"; | ||
|
|
||
| import { | ||
|
|
@@ -27,6 +28,8 @@ const BootstrapEnvelopeSchema = Schema.Struct({ | |
| authToken: Schema.optional(Schema.String), | ||
| autoBootstrapProjectFromCwd: Schema.optional(Schema.Boolean), | ||
| logWebSocketEvents: Schema.optional(Schema.Boolean), | ||
| otlpTracesUrl: Schema.optional(Schema.String), | ||
| otlpMetricsUrl: Schema.optional(Schema.String), | ||
| }); | ||
|
|
||
| const modeFlag = Flag.choice("mode", RuntimeMode.literals).pipe( | ||
|
|
@@ -81,6 +84,27 @@ const logWebSocketEventsFlag = Flag.boolean("log-websocket-events").pipe( | |
|
|
||
| const EnvServerConfig = Config.all({ | ||
| logLevel: Config.logLevel("T3CODE_LOG_LEVEL").pipe(Config.withDefault("Info")), | ||
| traceMinLevel: Config.logLevel("T3CODE_TRACE_MIN_LEVEL").pipe(Config.withDefault("Info")), | ||
| traceTimingEnabled: Config.boolean("T3CODE_TRACE_TIMING_ENABLED").pipe(Config.withDefault(true)), | ||
| traceFile: Config.string("T3CODE_TRACE_FILE").pipe( | ||
| Config.option, | ||
| Config.map(Option.getOrUndefined), | ||
| ), | ||
| traceMaxBytes: Config.int("T3CODE_TRACE_MAX_BYTES").pipe(Config.withDefault(10 * 1024 * 1024)), | ||
| traceMaxFiles: Config.int("T3CODE_TRACE_MAX_FILES").pipe(Config.withDefault(10)), | ||
| traceBatchWindowMs: Config.int("T3CODE_TRACE_BATCH_WINDOW_MS").pipe(Config.withDefault(200)), | ||
| otlpTracesUrl: Config.string("T3CODE_OTLP_TRACES_URL").pipe( | ||
| Config.option, | ||
| Config.map(Option.getOrUndefined), | ||
| ), | ||
| otlpMetricsUrl: Config.string("T3CODE_OTLP_METRICS_URL").pipe( | ||
| Config.option, | ||
| Config.map(Option.getOrUndefined), | ||
| ), | ||
| otlpExportIntervalMs: Config.int("T3CODE_OTLP_EXPORT_INTERVAL_MS").pipe( | ||
| Config.withDefault(10_000), | ||
| ), | ||
| otlpServiceName: Config.string("T3CODE_OTLP_SERVICE_NAME").pipe(Config.withDefault("t3-server")), | ||
| mode: Config.schema(RuntimeMode, "T3CODE_MODE").pipe( | ||
| Config.option, | ||
| Config.map(Option.getOrUndefined), | ||
|
|
@@ -131,12 +155,25 @@ const resolveOptionPrecedence = <Value>( | |
| ...values: ReadonlyArray<Option.Option<Value>> | ||
| ): Option.Option<Value> => Option.firstSomeOf(values); | ||
|
|
||
| const loadPersistedObservabilitySettings = Effect.fn(function* (settingsPath: string) { | ||
| const fs = yield* FileSystem.FileSystem; | ||
| const exists = yield* fs.exists(settingsPath).pipe(Effect.orElseSucceed(() => false)); | ||
| if (!exists) { | ||
| return { otlpTracesUrl: undefined, otlpMetricsUrl: undefined }; | ||
| } | ||
|
|
||
| const raw = yield* fs.readFileString(settingsPath).pipe(Effect.orElseSucceed(() => "")); | ||
| return parsePersistedServerObservabilitySettings(raw); | ||
|
Comment on lines
+158
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't silently discard persisted OTLP settings on read failures. After Line 160 confirms the file exists, Line 165 turns every 🤖 Prompt for AI Agents |
||
| }); | ||
|
|
||
| export const resolveServerConfig = ( | ||
| flags: CliServerFlags, | ||
| cliLogLevel: Option.Option<LogLevel.LogLevel>, | ||
| ) => | ||
| Effect.gen(function* () { | ||
| const { findAvailablePort } = yield* NetService; | ||
| const path = yield* Path.Path; | ||
| const fs = yield* FileSystem.FileSystem; | ||
| const env = yield* EnvServerConfig; | ||
| const bootstrapFd = Option.getOrUndefined(flags.bootstrapFd) ?? env.bootstrapFd; | ||
| const bootstrapEnvelope = | ||
|
|
@@ -190,6 +227,11 @@ export const resolveServerConfig = ( | |
| ); | ||
| const derivedPaths = yield* deriveServerPaths(baseDir, devUrl); | ||
| yield* ensureServerDirectories(derivedPaths); | ||
| const persistedObservabilitySettings = yield* loadPersistedObservabilitySettings( | ||
| derivedPaths.settingsPath, | ||
| ); | ||
| const serverTracePath = env.traceFile ?? derivedPaths.serverTracePath; | ||
| yield* fs.makeDirectory(path.dirname(serverTracePath), { recursive: true }); | ||
| const noBrowser = resolveBooleanFlag( | ||
| flags.noBrowser, | ||
| Option.getOrElse( | ||
|
|
@@ -248,11 +290,35 @@ export const resolveServerConfig = ( | |
|
|
||
| const config: ServerConfigShape = { | ||
| logLevel, | ||
| traceMinLevel: env.traceMinLevel, | ||
| traceTimingEnabled: env.traceTimingEnabled, | ||
| traceBatchWindowMs: env.traceBatchWindowMs, | ||
| traceMaxBytes: env.traceMaxBytes, | ||
| traceMaxFiles: env.traceMaxFiles, | ||
| otlpTracesUrl: | ||
| env.otlpTracesUrl ?? | ||
| Option.getOrUndefined( | ||
| Option.flatMap(bootstrapEnvelope, (bootstrap) => | ||
| Option.fromUndefinedOr(bootstrap.otlpTracesUrl), | ||
| ), | ||
| ) ?? | ||
| persistedObservabilitySettings.otlpTracesUrl, | ||
| otlpMetricsUrl: | ||
| env.otlpMetricsUrl ?? | ||
| Option.getOrUndefined( | ||
| Option.flatMap(bootstrapEnvelope, (bootstrap) => | ||
| Option.fromUndefinedOr(bootstrap.otlpMetricsUrl), | ||
| ), | ||
| ) ?? | ||
| persistedObservabilitySettings.otlpMetricsUrl, | ||
| otlpExportIntervalMs: env.otlpExportIntervalMs, | ||
| otlpServiceName: env.otlpServiceName, | ||
| mode, | ||
| port, | ||
| cwd: process.cwd(), | ||
| baseDir, | ||
| ...derivedPaths, | ||
| serverTracePath, | ||
| host, | ||
| staticDir, | ||
| devUrl, | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the new observability settings at the boundary.
otlpTracesUrl/otlpMetricsUrlare accepted as arbitrary strings, and the new sizing/interval knobs have no lower-bound checks. A malformed endpoint or negative interval/rotation value now gets through config resolution and only fails later in the tracer/exporter.Also applies to: 93-107
🤖 Prompt for AI Agents