Skip to content
Source
Sign inSign up
pingdotgg/t3code

Reduce idle work and disk churn with native resource diagnostics #2679

Mergedjuliusmarmingemerged 15 commits intomain fromrefs/pull/2679/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Intent

Reduce T3 Code's steady-state resource usage, bound local observability disk churn, and make CPU, memory, power-state, and I/O regressions observable enough to debug.

Before this PR:

  • provider status refreshes, VCS remote refreshes, and other background work followed fixed schedules even when nobody needed the result;
  • process diagnostics repeatedly spawned ps or PowerShell, adding process churn while still missing short-lived work between samples;
  • macOS power state came from recurring shell probes;
  • the diagnostics page could show sampled CPU and memory, but had no process I/O counters, collector health, Electron overhead, or application-level write attribution;
  • native and canonical provider events used independent rotators against the same thread files, retained duplicate streaming deltas, and had no aggregate age or byte budget;
  • high-frequency provider-log and preview debugger operations generated their own Effect trace records.

This PR replaces those paths with a demand-aware background policy plus a persistent, cross-platform telemetry pipeline.

Runtime architecture

Electron main
  ├─ powerMonitor events and state
  ├─ app.getAppMetrics()
  └─ NDJSON over inherited fd 4
                         ┐
                         ▼
Node server ── NDJSON stdio ── persistent Rust resource monitor
     │
     ├─ ResourceTelemetry Effect service
     ├─ bounded in-memory history and I/O attribution
     ├─ HostPowerMonitor → BackgroundPolicy
     └─ typed RPC/subscription → diagnostics UI

The native monitor is intentionally a standalone executable, not an N-API or FFI module. One persistent child process gives the server a supervised crash boundary, avoids Node/Electron ABI coupling, and eliminates recurring process-table subprocesses. The same protocol and binary layout work for desktop and the published CLI.

What changed

Demand-aware background work

  • Adds an Effect BackgroundPolicy service that combines:
    • active client leases and requested scopes;
    • visibility, focus, recent interaction, app state, battery, and low-power hints;
    • host lock, suspend, battery, low-power, and thermal constraints;
    • balanced, performance, and battery-saver profiles with interval overrides.
  • Clients retain scopes for the data they currently need, such as a repository's VCS status or a provider instance's status.
  • Provider refreshes and VCS remote polling consult the policy instead of blindly running on fixed cadences.
  • Settings and reporting flows expose the policy without coupling individual background services to renderer state.

Native and Electron telemetry

  • Adds native/resource-monitor, a Rust sidecar backed by OS APIs through sysinfo.
  • Samples the server, all descendants, provider-spawned grandchildren such as node, tsgo, language servers and shells, Electron roots, Electron descendants, and the monitor itself.
  • Reports process identity (pid, startTimeMs), parent/child relationships, command line, CPU, cumulative CPU time, resident/virtual memory, cumulative I/O counters, and collection cost.
  • Disables Linux task/thread enumeration and avoids repeatedly reloading command lines.
  • Uses Electron powerMonitor and app.getAppMetrics() for battery/AC state, lock/idle, suspend/resume, thermal state, CPU speed limits, Electron CPU/memory, and idle wakeups.
  • Sends Electron-main data directly to the server over fd 4. It does not route telemetry through the renderer WebSocket.

Diagnostics, history, and safety

  • Adds a schema-backed ResourceTelemetry service that merges native and Electron samples, computes rates from cumulative counters, classifies process groups, and publishes live snapshots.
  • Adds bounded, in-memory history for CPU, memory, I/O, process lifecycle, and collector health. Telemetry is not persisted to disk.
  • Expands diagnostics with:
    • backend, Electron, monitor, and total resource groups;
    • live process tree and process lifecycle counters;
    • CPU, memory, and I/O history;
    • power and thermal state;
    • collector status, restart count, scan duration, and explicit retry;
    • logical write attribution for provider event logs and local trace output.
  • Reuses this service for the legacy process diagnostics RPCs, removing the old ps/PowerShell implementations entirely.
  • Validates process signals against both PID and start time and only permits signalable backend descendants; Electron and monitor processes remain visible but protected.

Bounded local observability

  • Replaces the competing native and canonical provider rotators with one shared, thread-aware log store.
  • Keeps full provider-native diagnostics while dropping duplicate transient canonical events such as content, item, task, hook, tool, proposal, and realtime audio deltas before serialization. Final states, warnings, and errors remain available.
  • Flushes provider records in demand-driven 1-second batches with byte and record thresholds; there is no permanent polling timer.
  • Enforces a 512 MiB aggregate provider-log budget and 14-day age limit, pruning oldest files at startup and during sustained writes.
  • Removes trace spans from provider-log writes and per-message Electron preview debugger handlers, which were dominant trace hot paths.
  • Closes adapter-owned log stores consistently, including the Claude adapter path.

Reliability and packaging

  • Models monitor resolution, protocol, transport, and refresh failures as schema-backed tagged error unions with descriptive messages.
  • Supervises the sidecar with version negotiation, bounded restart backoff, a failure circuit, health transitions, and manual retry.
  • Handles sidecar sequence resets across restarts and preserves native rates during Electron-only updates.
  • Builds and packages platform executables in desktop resources and CLI releases for supported macOS, Linux, and Windows targets.
  • Adds CI coverage for Rust formatting/tests and release wiring for per-platform artifacts.

Metric semantics and limits

  • Sampling is once per second, not syscall or process-lifecycle tracing. A process that starts and exits entirely between samples can still be missed.
  • Unix-like and Windows process I/O counters have different OS semantics, and filesystem caches mean they are not guaranteed to equal physical SSD traffic. The UI therefore labels them as I/O reads/writes, not disk reads/writes.
  • Application attribution reports known logical writes from instrumented T3 Code components; it complements rather than replaces process-level OS counters.
  • Headless/web servers still receive native process telemetry. Electron-specific power fields degrade to unknown instead of falling back to shell probes.
  • Collector failures degrade telemetry without taking down the server.

Validation

  • vp check
  • vp run typecheck
  • full server suite: 1,243 passed, 7 skipped
  • focused provider-log regression suite: 9 passed
  • 11 VCS/background-policy merge-integration tests
  • cargo fmt --manifest-path native/resource-monitor/Cargo.toml -- --check
  • cargo test --locked --manifest-path native/resource-monitor/Cargo.toml (6 tests)
  • cargo clippy --manifest-path native/resource-monitor/Cargo.toml -- -D warnings
  • vp run build:desktop
  • Live sidecar smoke test against the local process table, including full command-line and I/O output

Note

High Risk Large cross-cutting change to desktop backend spawn/teardown, release packaging, and new native binaries; incorrect fd/protocol handling or restart races could break backend startup or diagnostics, though coverage is extensive in tests.

Overview Adds a Rust t3-resource-monitor sidecar with CI formatting/tests and release artifacts per platform (mac/linux/win), bundled into the CLI and resolved from packaged resources or dev target/release for the desktop primary backend. WSL backends intentionally omit the monitor path.

Electron main now publishes NDJSON host telemetry (DesktopTelemetryPublisher + ElectronPowerMonitor) over inherited fds 4/5 alongside the fd 3 bootstrap; the backend manager wires control messages, demand-gated app.getAppMetrics(), and cleans up telemetry sources on stop/restart.

Backend child logging no longer writes stdout/stderr continuously: output is buffered (1 MiB / chunk limits) and flushed to server-child.log only on failure or readiness-timeout snapshots; normal shutdown discards the session. Trace batching widens to 1 s and per-chunk output tracing is removed.

Desktop backend process management gains structured tagged errors, post-exit output draining, readiness-timeout context, and safer stop/start/restart behavior (including restart during teardown and timed-out stop).

Mobile reports client activity leases and retains background scopes (e.g. VCS, diagnostics) while subscriptions are active.

Server adds a compile-time RPC_REQUIRED_SCOPES map so every WebSocket RPC (including background policy and resource telemetry) has an explicit auth scope.

Preview forwards debugger screencast frames to recording listeners only while recording is active.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6b8a5163be9bac7c3b8b73d8b59a0d7f4dc6ad48. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add native resource monitor sidecar and background activity policy to reduce idle work and disk churn

  • Introduces a Rust native sidecar (main.rs) that samples system/process metrics via a JSON protocol; the server spawns and communicates with it through NativeTelemetryClient and ResourceMonitorBinary.
  • Adds a BackgroundPolicy service that tracks client activity leases, host power state, and per-scope demand to gate whether periodic background work (provider health refreshes, VCS remote polling) actually runs.
  • Adds ResourceTelemetry pipeline (NativeTelemetryClient → DesktopTelemetryReceiver → ResourceAttribution → ResourceTelemetry) and exposes history, retry, and live-subscription RPCs to clients.
  • Desktop backend now wires ElectronPowerMonitor and DesktopTelemetryPublisher to stream Electron process metrics and power state to the server over dedicated FDs (4/5).
  • Web and mobile clients gain background activity reporters that retain scope leases while subscriptions are active and periodically report visibility/focus/app-state to the server.
  • Provider health refresh loop and VCS remote refresh loop skip work when BackgroundPolicy reports no foreground demand, and the refresh interval is now driven by ServerSettingsService with a new structured backgroundActivity settings model.
  • EventNdjsonLogger is refactored into a shared log store with batched writes, size-bounded rotation, transient-event filtering, and periodic retention enforcement to reduce disk churn.
  • RotatingFileSink no longer triggers an immediate rotation after a write; rotation is deferred to the next write cycle.
  • Risk: LocalApi browser facade no longer exposes server.* methods or shell.openInEditor; callers that previously received a rejected Promise will now see undefined properties.
Macroscope summarized 6b8a516.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: db92ffbb-f25e-4d12-94a9-61f4c23ece27

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `t3code/a55b49df`

      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Cursor Bugbot has reviewed your changes and found 2 potential issues.

      Autofix Details

      Bugbot Autofix prepared fixes for both issues found in the latest run.

      • ✅ Fixed: Legacy patch fields silently override explicit backgroundActivity patch
        • Added a guard to skip computing backgroundActivityPatch when the explicit backgroundActivity field is present in the patch, ensuring new-style patches take precedence over legacy fields.
      • ✅ Fixed: Duplicated utility functions across settings panel files
        • Extracted BackgroundActivityOverridePatch, durationToSeconds, normalizeIntervalSeconds, backgroundActivityOverrideSettings, and BackgroundPolicyTooltip into a shared backgroundActivityUtils.tsx module imported by both SettingsPanels.tsx and SourceControlSettings.tsx.

      Create PR

      Or push these changes by commenting:

      @cursor push 6d184f0660
      Preview (pingdotgg/t3code@6d184f0660)
      diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
      --- a/apps/web/src/components/settings/SettingsPanels.tsx
      +++ b/apps/web/src/components/settings/SettingsPanels.tsx
      @@ -1,7 +1,6 @@
       import {
         ArchiveIcon,
         ArchiveX,
      -  InfoIcon,
         LoaderIcon,
         PlusIcon,
         RefreshCwIcon,
      @@ -106,6 +105,12 @@
         SettingsSection,
         useRelativeTimeTick,
       } from "./settingsLayout";
      +import {
      +  BackgroundPolicyTooltip as PolicyTooltip,
      +  backgroundActivityOverrideSettings,
      +  durationToSeconds,
      +  normalizeIntervalSeconds,
      +} from "./backgroundActivityUtils";
       import { ProjectFavicon } from "../ProjectFavicon";
       import { useServerObservability, useServerProviders } from "../../rpc/serverState";
       
      @@ -137,11 +142,6 @@
       };
       
       type BackgroundActivityProfileOption = BackgroundActivityProfile | "advanced";
      -type BackgroundActivityOverridePatch = Partial<{
      -  [K in keyof BackgroundActivitySettings["overrides"]]:
      -    | BackgroundActivitySettings["overrides"][K]
      -    | undefined;
      -}>;
       
       const BACKGROUND_ACTIVITY_PROFILE_OPTION_LABELS: Record<BackgroundActivityProfileOption, string> = {
         ...BACKGROUND_ACTIVITY_PROFILE_LABELS,
      @@ -174,17 +174,6 @@
         { key: "pauseWhenOnBattery", label: "Pause on battery" },
       ];
       
      -function durationToSeconds(duration: Duration.Duration): number {
      -  return Math.round(Duration.toMillis(duration) / 1_000);
      -}
      -
      -function normalizeIntervalSeconds(value: number | null): number {
      -  if (value === null || !Number.isFinite(value)) {
      -    return 0;
      -  }
      -  return Math.max(0, Math.round(value));
      -}
      -
       function resolveBackgroundActivityProfileOption(settings: {
         readonly backgroundActivity: BackgroundActivitySettings;
       }): BackgroundActivityProfileOption {
      @@ -209,50 +198,6 @@
         };
       }
       
      -function backgroundActivityOverrideSettings(
      -  current: BackgroundActivitySettings,
      -  overrides: BackgroundActivityOverridePatch,
      -) {
      -  const nextOverrides: BackgroundActivityOverridePatch = {
      -    ...current.overrides,
      -    ...overrides,
      -  };
      -  for (const [key, value] of Object.entries(nextOverrides)) {
      -    if (value === undefined) {
      -      delete nextOverrides[key as keyof typeof nextOverrides];
      -    }
      -  }
      -  return {
      -    backgroundActivity: {
      -      schemaVersion: 1 as const,
      -      profile: "custom" as const,
      -      baseProfile: getBackgroundActivityBaseProfile(current),
      -      overrides: nextOverrides as BackgroundActivitySettings["overrides"],
      -    },
      -  };
      -}
      -
      -function PolicyTooltip({ children }: { readonly children: string }) {
      -  return (
      -    <Tooltip>
      -      <TooltipTrigger
      -        render={
      -          <button
      -            type="button"
      -            className="inline-flex size-5 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground"
      -            aria-label="Background policy details"
      -          >
      -            <InfoIcon className="size-3.5" />
      -          </button>
      -        }
      -      />
      -      <TooltipPopup side="top" className="max-w-72">
      -        {children}
      -      </TooltipPopup>
      -    </Tooltip>
      -  );
      -}
      -
       function withoutProviderInstanceKey<V>(
         record: Readonly<Record<ProviderInstanceId, V>> | undefined,
         key: ProviderInstanceId,
      
      diff --git a/apps/web/src/components/settings/SourceControlSettings.tsx b/apps/web/src/components/settings/SourceControlSettings.tsx
      --- a/apps/web/src/components/settings/SourceControlSettings.tsx
      +++ b/apps/web/src/components/settings/SourceControlSettings.tsx
      @@ -1,9 +1,8 @@
      -import { ChevronDownIcon, GitPullRequestIcon, InfoIcon, RefreshCwIcon } from "lucide-react";
      +import { ChevronDownIcon, GitPullRequestIcon, RefreshCwIcon } from "lucide-react";
       import * as Duration from "effect/Duration";
       import * as Option from "effect/Option";
       import { useState, type ReactNode } from "react";
       import type {
      -  BackgroundActivitySettings,
         SourceControlProviderKind,
         SourceControlDiscoveryResult,
         SourceControlProviderAuth,
      @@ -55,6 +54,12 @@
       } from "../Icons";
       import { RedactedSensitiveText } from "./RedactedSensitiveText";
       import { SettingResetButton, SettingsPageContainer, SettingsSection } from "./settingsLayout";
      +import {
      +  BackgroundPolicyTooltip,
      +  backgroundActivityOverrideSettings,
      +  durationToSeconds,
      +  normalizeIntervalSeconds as normalizeFetchIntervalSeconds,
      +} from "./backgroundActivityUtils";
       
       const EMPTY_DISCOVERY_RESULT: SourceControlDiscoveryResult = {
         versionControlSystems: [],
      @@ -75,44 +80,7 @@
       
       const SOURCE_CONTROL_SKELETON_ROWS = ["primary", "secondary"] as const;
       const GIT_FETCH_INTERVAL_STEP_SECONDS = 5;
      -type BackgroundActivityOverridePatch = Partial<{
      -  [K in keyof BackgroundActivitySettings["overrides"]]:
      -    | BackgroundActivitySettings["overrides"][K]
      -    | undefined;
      -}>;
       
      -function durationToSeconds(duration: Duration.Duration): number {
      -  return Math.round(Duration.toMillis(duration) / 1_000);
      -}
      -
      -function normalizeFetchIntervalSeconds(value: number | null): number {
      -  if (value === null || !Number.isFinite(value)) {
      -    return 0;
      -  }
      -  return Math.max(0, Math.round(value));
      -}
      -
      -function BackgroundPolicyTooltip({ children }: { readonly children: string }) {
      -  return (
      -    <Tooltip>
      -      <TooltipTrigger
      -        render={
      -          <button
      -            type="button"
      -            className="inline-flex size-5 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground"
      -            aria-label="Background policy details"
      -          >
      -            <InfoIcon className="size-3.5" />
      -          </button>
      -        }
      -      />
      -      <TooltipPopup side="top" className="max-w-72">
      -        {children}
      -      </TooltipPopup>
      -    </Tooltip>
      -  );
      -}
      -
       function optionLabel(value: Option.Option<string>): string | null {
         return Option.getOrNull(value);
       }
      @@ -335,28 +303,6 @@
         );
         const canResetFetchInterval =
           automaticGitFetchIntervalSeconds !== defaultAutomaticGitFetchIntervalSeconds;
      -  const backgroundActivityOverrideSettings = (
      -    current: BackgroundActivitySettings,
      -    overrides: BackgroundActivityOverridePatch,
      -  ) => {
      -    const nextOverrides: BackgroundActivityOverridePatch = {
      -      ...current.overrides,
      -      ...overrides,
      -    };
      -    for (const [key, value] of Object.entries(nextOverrides)) {
      -      if (value === undefined) {
      -        delete nextOverrides[key as keyof typeof nextOverrides];
      -      }
      -    }
      -    return {
      -      backgroundActivity: {
      -        schemaVersion: 1 as const,
      -        profile: "custom" as const,
      -        baseProfile: getBackgroundActivityBaseProfile(current),
      -        overrides: nextOverrides as BackgroundActivitySettings["overrides"],
      -      },
      -    };
      -  };
       
         return (
           <div className="grid gap-3">
      
      diff --git a/apps/web/src/components/settings/backgroundActivityUtils.tsx b/apps/web/src/components/settings/backgroundActivityUtils.tsx
      new file mode 100644
      --- /dev/null
      +++ b/apps/web/src/components/settings/backgroundActivityUtils.tsx
      @@ -1,0 +1,67 @@
      +import { InfoIcon } from "lucide-react";
      +import * as Duration from "effect/Duration";
      +import type { BackgroundActivitySettings } from "@t3tools/contracts";
      +import { getBackgroundActivityBaseProfile } from "@t3tools/shared/backgroundActivitySettings";
      +
      +import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
      +
      +export type BackgroundActivityOverridePatch = Partial<{
      +  [K in keyof BackgroundActivitySettings["overrides"]]:
      +    | BackgroundActivitySettings["overrides"][K]
      +    | undefined;
      +}>;
      +
      +export function durationToSeconds(duration: Duration.Duration): number {
      +  return Math.round(Duration.toMillis(duration) / 1_000);
      +}
      +
      +export function normalizeIntervalSeconds(value: number | null): number {
      +  if (value === null || !Number.isFinite(value)) {
      +    return 0;
      +  }
      +  return Math.max(0, Math.round(value));
      +}
      +
      +export function backgroundActivityOverrideSettings(
      +  current: BackgroundActivitySettings,
      +  overrides: BackgroundActivityOverridePatch,
      +) {
      +  const nextOverrides: BackgroundActivityOverridePatch = {
      +    ...current.overrides,
      +    ...overrides,
      +  };
      +  for (const [key, value] of Object.entries(nextOverrides)) {
      +    if (value === undefined) {
      +      delete nextOverrides[key as keyof typeof nextOverrides];
      +    }
      +  }
      +  return {
      +    backgroundActivity: {
      +      schemaVersion: 1 as const,
      +      profile: "custom" as const,
      +      baseProfile: getBackgroundActivityBaseProfile(current),
      +      overrides: nextOverrides as BackgroundActivitySettings["overrides"],
      +    },
      +  };
      +}
      +
      +export function BackgroundPolicyTooltip({ children }: { readonly children: string }) {
      +  return (
      +    <Tooltip>
      +      <TooltipTrigger
      +        render={
      +          <button
      +            type="button"
      +            className="inline-flex size-5 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground"
      +            aria-label="Background policy details"
      +          >
      +            <InfoIcon className="size-3.5" />
      +          </button>
      +        }
      +      />
      +      <TooltipPopup side="top" className="max-w-72">
      +        {children}
      +      </TooltipPopup>
      +    </Tooltip>
      +  );
      +}
      
      diff --git a/packages/shared/src/serverSettings.ts b/packages/shared/src/serverSettings.ts
      --- a/packages/shared/src/serverSettings.ts
      +++ b/packages/shared/src/serverSettings.ts
      @@ -89,26 +89,28 @@
           ...patchForMerge
         } = patch;
         const backgroundActivityPatch =
      -    backgroundActivityProfile !== undefined
      -      ? {
      -          schemaVersion: 1 as const,
      -          profile: backgroundActivityProfile,
      -          overrides: {},
      -        }
      -      : automaticGitFetchInterval !== undefined || providerHealthRefreshInterval !== undefined
      +    backgroundActivity !== undefined
      +      ? undefined
      +      : backgroundActivityProfile !== undefined
               ? {
                   schemaVersion: 1 as const,
      -            profile: "custom" as const,
      -            baseProfile: getBackgroundActivityBaseProfile(current.backgroundActivity),
      -            overrides: {
      -              ...current.backgroundActivity.overrides,
      -              ...(automaticGitFetchInterval !== undefined ? { automaticGitFetchInterval } : {}),
      -              ...(providerHealthRefreshInterval !== undefined
      -                ? { providerHealthRefreshInterval }
      -                : {}),
      -            },
      +            profile: backgroundActivityProfile,
      +            overrides: {},
                 }
      -        : undefined;
      +        : automaticGitFetchInterval !== undefined || providerHealthRefreshInterval !== undefined
      +          ? {
      +              schemaVersion: 1 as const,
      +              profile: "custom" as const,
      +              baseProfile: getBackgroundActivityBaseProfile(current.backgroundActivity),
      +              overrides: {
      +                ...current.backgroundActivity.overrides,
      +                ...(automaticGitFetchInterval !== undefined ? { automaticGitFetchInterval } : {}),
      +                ...(providerHealthRefreshInterval !== undefined
      +                  ? { providerHealthRefreshInterval }
      +                  : {}),
      +              },
      +            }
      +          : undefined;
         const next = deepMerge(current, patchForMerge);
         const nextWithReplacementsBase = {
           ...next,
      You can send follow-ups to the cloud agent here.
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/8da08596ca6d3ee2b5e6ae44164ee396a48bcf3f/apps/web/src/components/settings/SettingsPanels.tsx#L181-L186

      When a user clears the NumberField for host power monitor intervals, onValueChange receives null. normalizeIntervalSeconds(null) returns 0, bypassing the min={5} constraint and saving Duration.seconds(0) to settings. This violates the minimum interval requirement, which could cause excessive background polling.

      Consider enforcing the minimum in normalizeIntervalSeconds or handling the null case explicitly to ensure the saved value respects the min constraint.

      function normalizeIntervalSeconds(value: number | null): number {
         if (value === null || !Number.isFinite(value)) {
      -    return 0;
      +    return NaN;
         }
      -  return Math.max(0, Math.round(value));
      +  return Math.max(5, Math.round(value));
       }
      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file apps/web/src/components/settings/SettingsPanels.tsx around lines 181-186:
      
      When a user clears the `NumberField` for host power monitor intervals, `onValueChange` receives `null`. `normalizeIntervalSeconds(null)` returns `0`, bypassing the `min={5}` constraint and saving `Duration.seconds(0)` to settings. This violates the minimum interval requirement, which could cause excessive background polling.
      
      Consider enforcing the minimum in `normalizeIntervalSeconds` or handling the `null` case explicitly to ensure the saved value respects the `min` constraint.
      
      Evidence trail:
      SettingsPanels.tsx lines 181-186: normalizeIntervalSeconds returns 0 for null. Lines 778-801: Host power monitor active interval NumberField with min={5} and onValueChange at line 784 that saves Duration.seconds(normalizeIntervalSeconds(value)). Lines 804-835: Idle host power monitor NumberField also min={5}. Lines 212-233: backgroundActivityOverrideSettings performs no validation on the duration value. apps/web/package.json line 16: @base-ui/react ^1.4.1. apps/web/src/components/ui/number-field.tsx: NumberField wraps @base-ui/react NumberFieldPrimitive.Root with props passthrough.
    6. Cursor Bugbot has reviewed your changes and found 3 potential issues.

      Autofix Details

      Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

      • ✅ Fixed: VCS scope cwd mismatch
        • Added a scopeCwd parameter to makeRemoteRefreshLoop and retainRemotePoller that passes the raw (un-normalized) input.cwd to shouldRunScopeWork, ensuring scope keys match the client's lease scopes.
      • ✅ Fixed: Disconnect never clears leases
        • Added removeSession method to BackgroundPolicy that removes leases by sessionId, and wired it into the WebSocket disconnect handler's acquireUseRelease release function.
      • ✅ Fixed: Advanced dialog clears overrides
        • Changed the Advanced dialog's shared policy Select to update baseProfile while keeping profile as 'custom' and preserving existing overrides, instead of calling backgroundActivityProfileSettings which resets everything.

      Create PR

      Or push these changes by commenting:

      @cursor push 44ee7a6c3a
      Preview (pingdotgg/t3code@44ee7a6c3a)
      diff --git a/apps/server/src/background/BackgroundPolicy.ts b/apps/server/src/background/BackgroundPolicy.ts
      --- a/apps/server/src/background/BackgroundPolicy.ts
      +++ b/apps/server/src/background/BackgroundPolicy.ts
      @@ -30,6 +30,7 @@
           input: ClientActivityReportInput,
         ) => Effect.Effect<void>;
         readonly removeRpcClient: (rpcClientId: RpcClientId) => Effect.Effect<void>;
      +  readonly removeSession: (sessionId: AuthSessionId) => Effect.Effect<void>;
         readonly reportHostPowerState: (snapshot: HostPowerSnapshot) => Effect.Effect<void>;
         readonly snapshot: Effect.Effect<BackgroundPolicySnapshot>;
         readonly streamChanges: Stream.Stream<BackgroundPolicySnapshot>;
      @@ -218,6 +219,17 @@
             return next;
           }).pipe(Effect.andThen(publishSnapshot), Effect.asVoid);
       
      +  const removeSession: BackgroundPolicyShape["removeSession"] = (sessionId) =>
      +    Ref.update(leasesRef, (leases) => {
      +      const next = new Map(leases);
      +      for (const [key, lease] of next) {
      +        if (lease.sessionId === sessionId) {
      +          next.delete(key);
      +        }
      +      }
      +      return next;
      +    }).pipe(Effect.andThen(publishSnapshot), Effect.asVoid);
      +
         const hasDemand: BackgroundPolicyShape["hasDemand"] = (scope) =>
           Effect.map(snapshot, (current) => current.activeScopeKeys.includes(scopeKey(scope)));
       
      @@ -264,6 +276,7 @@
         return BackgroundPolicy.of({
           reportClientActivity,
           removeRpcClient,
      +    removeSession,
           reportHostPowerState: hostPowerMonitor.report,
           snapshot,
           streamChanges: Stream.fromPubSub(changes),
      
      diff --git a/apps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.ts b/apps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.ts
      --- a/apps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.ts
      +++ b/apps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.ts
      @@ -64,6 +64,7 @@
       const BackgroundPolicyAlwaysRunLayer = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
         reportClientActivity: () => Effect.void,
         removeRpcClient: () => Effect.void,
      +  removeSession: () => Effect.void,
         reportHostPowerState: () => Effect.void,
         snapshot: Effect.succeed({
           hostPower: {
      
      diff --git a/apps/server/src/provider/Layers/ProviderRegistry.test.ts b/apps/server/src/provider/Layers/ProviderRegistry.test.ts
      --- a/apps/server/src/provider/Layers/ProviderRegistry.test.ts
      +++ b/apps/server/src/provider/Layers/ProviderRegistry.test.ts
      @@ -78,6 +78,7 @@
       const BackgroundPolicyAlwaysRunLayer = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
         reportClientActivity: () => Effect.void,
         removeRpcClient: () => Effect.void,
      +  removeSession: () => Effect.void,
         reportHostPowerState: () => Effect.void,
         snapshot: Effect.succeed({
           hostPower: {
      
      diff --git a/apps/server/src/provider/makeManagedServerProvider.test.ts b/apps/server/src/provider/makeManagedServerProvider.test.ts
      --- a/apps/server/src/provider/makeManagedServerProvider.test.ts
      +++ b/apps/server/src/provider/makeManagedServerProvider.test.ts
      @@ -97,6 +97,7 @@
         return Layer.mock(BackgroundPolicy.BackgroundPolicy)({
           reportClientActivity: () => Effect.void,
           removeRpcClient: () => Effect.void,
      +    removeSession: () => Effect.void,
           reportHostPowerState: () => Effect.void,
           snapshot: Effect.succeed({
             hostPower: {
      
      diff --git a/apps/server/src/server.test.ts b/apps/server/src/server.test.ts
      --- a/apps/server/src/server.test.ts
      +++ b/apps/server/src/server.test.ts
      @@ -777,6 +777,7 @@
               Layer.mock(BackgroundPolicy.BackgroundPolicy)({
                 reportClientActivity: () => Effect.void,
                 removeRpcClient: () => Effect.void,
      +          removeSession: () => Effect.void,
                 reportHostPowerState: () => Effect.void,
                 snapshot: Effect.succeed({
                   hostPower: {
      
      diff --git a/apps/server/src/vcs/VcsStatusBroadcaster.test.ts b/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
      --- a/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
      +++ b/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
      @@ -92,6 +92,7 @@
         return Layer.mock(BackgroundPolicy.BackgroundPolicy)({
           reportClientActivity: () => Effect.void,
           removeRpcClient: () => Effect.void,
      +    removeSession: () => Effect.void,
           reportHostPowerState: () => Effect.void,
           snapshot: Effect.succeed({
             hostPower: {
      
      diff --git a/apps/server/src/vcs/VcsStatusBroadcaster.ts b/apps/server/src/vcs/VcsStatusBroadcaster.ts
      --- a/apps/server/src/vcs/VcsStatusBroadcaster.ts
      +++ b/apps/server/src/vcs/VcsStatusBroadcaster.ts
      @@ -258,6 +258,7 @@
       
           const makeRemoteRefreshLoop = (
             cwd: string,
      +      scopeCwd: string,
             automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
             refreshImmediately: boolean,
           ) => {
      @@ -274,7 +275,7 @@
       
                 const shouldRun = yield* backgroundPolicy.shouldRunScopeWork({
                   type: "vcs-status",
      -            cwd,
      +            cwd: scopeCwd,
                 });
                 if (!shouldRun) {
                   return activeInterval;
      @@ -322,6 +323,7 @@
       
           const retainRemotePoller = Effect.fn("VcsStatusBroadcaster.retainRemotePoller")(function* (
             cwd: string,
      +      scopeCwd: string,
             automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
             refreshImmediately: boolean,
           ) {
      @@ -336,7 +338,12 @@
                 return Effect.succeed([undefined, nextPollers] as const);
               }
       
      -        return makeRemoteRefreshLoop(cwd, automaticRemoteRefreshInterval, refreshImmediately).pipe(
      +        return makeRemoteRefreshLoop(
      +          cwd,
      +          scopeCwd,
      +          automaticRemoteRefreshInterval,
      +          refreshImmediately,
      +        ).pipe(
                 Effect.forkIn(broadcasterScope),
                 Effect.map((fiber) => {
                   const nextPollers = new Map(activePollers);
      @@ -388,6 +395,7 @@
                 const initialRemote = cachedStatus?.remote?.value ?? null;
                 yield* retainRemotePoller(
                   cwd,
      +            input.cwd,
                   options?.automaticRemoteRefreshInterval ??
                     Effect.succeed(DEFAULT_VCS_STATUS_REFRESH_INTERVAL),
                   cachedStatus?.remote === null || cachedStatus?.remote === undefined,
      
      diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts
      --- a/apps/server/src/ws.ts
      +++ b/apps/server/src/ws.ts
      @@ -1669,6 +1669,7 @@
               const request = yield* HttpServerRequest.HttpServerRequest;
               const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
               const sessions = yield* SessionStore.SessionStore;
      +        const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
               const session = yield* serverAuth.authenticateWebSocketUpgrade(request).pipe(
                 Effect.catchTags({
                   ServerAuthInvalidCredentialError: (error) => failEnvironmentAuthInvalid(error.reason),
      @@ -1710,7 +1711,11 @@
               return yield* Effect.acquireUseRelease(
                 sessions.markConnected(session.sessionId),
                 () => rpcWebSocketHttpEffect,
      -          () => sessions.markDisconnected(session.sessionId),
      +          () =>
      +            Effect.all([
      +              sessions.markDisconnected(session.sessionId),
      +              backgroundPolicy.removeSession(session.sessionId),
      +            ]).pipe(Effect.asVoid),
               );
             }).pipe(
               Effect.catchTags({
      
      diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
      --- a/apps/web/src/components/settings/SettingsPanels.tsx
      +++ b/apps/web/src/components/settings/SettingsPanels.tsx
      @@ -680,7 +680,14 @@
                           value === "performance" ||
                           value === "battery-saver"
                         ) {
      -                    updateSettings(backgroundActivityProfileSettings(value));
      +                    updateSettings({
      +                      backgroundActivity: {
      +                        schemaVersion: 1 as const,
      +                        profile: "custom" as const,
      +                        baseProfile: value,
      +                        overrides: settings.backgroundActivity.overrides,
      +                      },
      +                    });
                         }
                       }}
                     >
      You can send follow-ups to the cloud agent here.
    7. github-actions[bot](GitHub profile, opens in a new tab)commented

      🚀 Expo continuous deployment is ready!

      • Project → t3-code
      • Platforms → android, ios
      • Scheme → t3code-preview
      &nbsp;🤖 Android🍎 iOS
      Fingerprint27e228668e373d1941548dc669856ecf3fd6261ffa880122b8876ecaafbb21281d21e292d7b09484
      Build DetailsBuild Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: 27e228668e373d1941548dc669856ecf3fd6261f
      App version: 0.1.0
      Git commit: 47234257cf10fea3f507f57916355a6ae1cde29c
      Build Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: fa880122b8876ecaafbb21281d21e292d7b09484
      App version: 0.1.0
      Git commit: 8ef95c479ae1c01cbd33365fe792b762398ffd5d
      Update DetailsUpdate Permalink
      DetailsBranch: pr-2679
      Runtime version: 27e228668e373d1941548dc669856ecf3fd6261f
      Git commit: 47234257cf10fea3f507f57916355a6ae1cde29c
      Update Permalink
      DetailsBranch: pr-2679
      Runtime version: fa880122b8876ecaafbb21281d21e292d7b09484
      Git commit: 47234257cf10fea3f507f57916355a6ae1cde29c
      Update QR
    8. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🔴 Critical

      https://github.com/pingdotgg/t3code/blob/79ad07118493b7dfdc96c9205a913b356547f5bb/apps/server/src/ws.ts#L210

      The new RPC handlers serverReportClientActivity, serverReportHostPowerState, serverGetBackgroundPolicy, and subscribeBackgroundPolicy are missing entries in RPC_REQUIRED_SCOPE, so requiredScopeForMethod() throws Error: RPC method X has no declared authorization scope. when any of these methods are invoked.

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/server/src/ws.ts around line 210:
      
      The new RPC handlers `serverReportClientActivity`, `serverReportHostPowerState`, `serverGetBackgroundPolicy`, and `subscribeBackgroundPolicy` are missing entries in `RPC_REQUIRED_SCOPE`, so `requiredScopeForMethod()` throws `Error: RPC method X has no declared authorization scope.` when any of these methods are invoked.
      
      Evidence trail:
      apps/server/src/ws.ts lines 143-212 (RPC_REQUIRED_SCOPE map — none of the four methods listed); apps/server/src/ws.ts lines 321-327 (requiredScopeForMethod throws if method not in map); apps/server/src/ws.ts lines 1112-1131 (serverReportClientActivity, serverReportHostPowerState, serverGetBackgroundPolicy handlers using observeRpcEffect); apps/server/src/ws.ts lines 1650-1658 (subscribeBackgroundPolicy handler using observeRpcStream); apps/server/src/ws.ts lines 333-345 (observeRpcEffect and observeRpcStream call requiredScopeForMethod).
    9. t3dotgg(GitHub profile, opens in a new tab) changed the title

    10. t3dotgg(GitHub profile, opens in a new tab) changed the title

    11. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Output drain timeout drops logs
        • Added Fiber.interrupt for all output fibers after the 250ms drain timeout so that still-running fibers are stopped before persistFailure snapshots and clears the session buffer, preventing late chunks from being lost.

      Create PR

      Or push these changes by commenting:

      @cursor push 3c6ed7cfa6
      Preview (pingdotgg/t3code@3c6ed7cfa6)
      diff --git a/apps/desktop/src/backend/DesktopBackendManager.ts b/apps/desktop/src/backend/DesktopBackendManager.ts
      --- a/apps/desktop/src/backend/DesktopBackendManager.ts
      +++ b/apps/desktop/src/backend/DesktopBackendManager.ts
      @@ -330,6 +330,10 @@
           concurrency: "unbounded",
           discard: true,
         }).pipe(Effect.timeout(DEFAULT_BACKEND_OUTPUT_DRAIN_TIMEOUT), Effect.ignore);
      +  yield* Effect.forEach(outputFibers, Fiber.interrupt, {
      +    concurrency: "unbounded",
      +    discard: true,
      +  }).pipe(Effect.ignore);
         return exit;
       });
      You can send follow-ups to the cloud agent here.
    12. Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

      There are 3 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared fixes for both issues found in the latest run.

      • ✅ Fixed: Readiness timeout writes failure logs
        • Removed the persistFailure call from onReadinessFailure since the backend process is still running during a readiness timeout and failure logs should only be persisted on actual process exit via finalizeRun.
      • ✅ Fixed: Host suspend does not gate work
        • Added an early return of true in isHostConstrained when hostPower.suspended is true, so background work is paused during host suspend.

      Create PR

      Or push these changes by commenting:

      @cursor push 54bbd4877a
      Preview (pingdotgg/t3code@54bbd4877a)
      diff --git a/apps/desktop/src/backend/DesktopBackendManager.ts b/apps/desktop/src/backend/DesktopBackendManager.ts
      --- a/apps/desktop/src/backend/DesktopBackendManager.ts
      +++ b/apps/desktop/src/backend/DesktopBackendManager.ts
      @@ -541,9 +541,6 @@
                     yield* logBackendManagerWarning("backend readiness check failed during bootstrap", {
                       error: error.message,
                     });
      -              yield* backendOutputLog.persistFailure({
      -                details: error.message,
      -              });
                   },
                 ),
                 onOutput: (streamName, chunk) => backendOutputLog.writeOutputChunk(streamName, chunk),
      
      diff --git a/apps/server/src/background/BackgroundPolicy.ts b/apps/server/src/background/BackgroundPolicy.ts
      --- a/apps/server/src/background/BackgroundPolicy.ts
      +++ b/apps/server/src/background/BackgroundPolicy.ts
      @@ -82,6 +82,7 @@
         settings: ResolvedBackgroundActivitySettings,
       ): boolean {
         if (hostPower.stale) return false;
      +  if (hostPower.suspended) return true;
         if (
           (settings.pauseWhenHostLocked && hostPower.locked === "true") ||
           hasThermalPressure(hostPower)
      You can send follow-ups to the cloud agent here.
    13. juliusmarminge changed the title

    14. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      There are 5 total unresolved issues (including 3 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared fixes for both issues found in the latest run.

      • ✅ Fixed: Stuck flush flag drops batched logs
        • Changed drainPending to always clear flushScheduled to false after any flush (not just timer-fired), and added catchCause on scheduleFlush to reset the flag if the fork fails, preventing the flag from getting stuck.
      • ✅ Fixed: Flush failure disables thread logging
        • Changed drainPending to initialize failedSegments as a fresh empty set each drain instead of carrying over from state, so transient I/O errors no longer permanently block logging for a thread segment.

      Create PR

      Or push these changes by commenting:

      @cursor push b5ebfe1577
      Preview (pingdotgg/t3code@b5ebfe1577)
      diff --git a/apps/server/src/provider/Layers/EventNdjsonLogger.ts b/apps/server/src/provider/Layers/EventNdjsonLogger.ts
      --- a/apps/server/src/provider/Layers/EventNdjsonLogger.ts
      +++ b/apps/server/src/provider/Layers/EventNdjsonLogger.ts
      @@ -318,7 +318,7 @@
         }
       
         const sinks = new Map(input.state.sinks);
      -  const failedSegments = new Set(input.state.failedSegments);
      +  const failedSegments = new Set<string>();
         const failures: Array<FileOperationFailure> = [];
         const attributionByStream = new Map<
           EventNdjsonStream,
      @@ -399,7 +399,7 @@
             pendingBytes: 0,
             sinks,
             failedSegments,
      -      flushScheduled: input.timerFired ? false : input.state.flushScheduled,
      +      flushScheduled: false,
             closed: input.close,
             lastRetentionAt: retentionDue ? input.now : input.state.lastRetentionAt,
           },
      @@ -557,7 +557,14 @@
             if (action.flush) {
               yield* flush(false, false);
             } else if (action.schedule) {
      -        yield* scheduleFlush();
      +        yield* scheduleFlush().pipe(
      +          Effect.catchCause(() =>
      +            SynchronizedRef.update(stateRef, (state) => ({
      +              ...state,
      +              flushScheduled: false,
      +            })),
      +          ),
      +        );
             }
           });
      You can send follow-ups to the cloud agent here.
    15. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      There are 3 total unresolved issues (including 2 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Process diagnostics use stale cache
        • ProcessDiagnostics.read now attempts telemetry.refresh before mapping the snapshot, falling back to the cached latest on failure, ensuring on-demand reads always trigger a fresh sample from the native sidecar.

      Create PR

      Or push these changes by commenting:

      @cursor push 8e66c61cc5
      Preview (pingdotgg/t3code@8e66c61cc5)
      diff --git a/apps/server/src/diagnostics/ProcessDiagnostics.test.ts b/apps/server/src/diagnostics/ProcessDiagnostics.test.ts
      --- a/apps/server/src/diagnostics/ProcessDiagnostics.test.ts
      +++ b/apps/server/src/diagnostics/ProcessDiagnostics.test.ts
      @@ -101,9 +101,7 @@
             const layer = ProcessDiagnostics.layer.pipe(Layer.provideMerge(telemetryLayer));
       
             const diagnostics = yield* Effect.gen(function* () {
      -        const telemetry = yield* ResourceTelemetry.ResourceTelemetry;
               const processDiagnostics = yield* ProcessDiagnostics.ProcessDiagnostics;
      -        yield* telemetry.refresh;
               return yield* processDiagnostics.read;
             }).pipe(Effect.provide(layer));
       
      
      diff --git a/apps/server/src/diagnostics/ProcessDiagnostics.ts b/apps/server/src/diagnostics/ProcessDiagnostics.ts
      --- a/apps/server/src/diagnostics/ProcessDiagnostics.ts
      +++ b/apps/server/src/diagnostics/ProcessDiagnostics.ts
      @@ -72,7 +72,8 @@
       
       export const make = Effect.fn("makeProcessDiagnostics")(function* () {
         const telemetry = yield* ResourceTelemetry.ResourceTelemetry;
      -  const read: ProcessDiagnosticsShape["read"] = telemetry.latest.pipe(
      +  const read: ProcessDiagnosticsShape["read"] = telemetry.refresh.pipe(
      +    Effect.catch(() => telemetry.latest),
           Effect.map((snapshot) => {
             const processes = snapshot.processes
               .filter((entry) => entry.identity.pid !== process.pid)
      You can send follow-ups to the cloud agent here.
    16. apps/server/src/ws.ts line 1468Resolvedby juliusmarminge
    17. native/resource-monitor/src/main.rs line 592OutdatedResolvedby juliusmarminge
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/8f3849bcf0d1db5b439017f24840a6131f66e486/apps/desktop/src/backend/DesktopBackendManager.ts#L506

      Every backend instance routes its telemetry control stream into the same desktopTelemetryPublisher.handleControl, and each stream's Effect.ensuring unconditionally sends enabled: false when it closes. When two instances are running, stopping or restarting either one sends enabled: false to the shared publisher and clears diagnostics demand for the other live backend, so Electron telemetry sampling stops for a backend that is still running. Demand needs to be tracked per instance or aggregated across subscribers rather than funneled into one global boolean.

      ✅ Resolved in 56b763edb5f03ea538e7b72ee9699b19e44424cb

    18. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/deb3d48317e7f69bbc7c37fccda09d6e075e6218/packages/shared/src/observability.ts#L282

      flushUnsafe calls sink.write(chunk) but RotatingFileSink is constructed without throwOnError: true, so write and rotation failures are silently swallowed by the sink. On disk-full, permission, or other filesystem errors, buffer is cleared, pendingFlushStats is incremented as if all records were written, and the catch block that restores records to the buffer never runs. As a result, records are silently lost and onFlush reports inaccurate logical-write diagnostics. Construct the RotatingFileSink with throwOnError: true so that write failures propagate to the catch block, allowing the records to be restored to the buffer.

      ✅ Resolved in 24e6ccd40459d6e4e7f334d682d0f63c3cdcd374

    19. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/deb3d48317e7f69bbc7c37fccda09d6e075e6218/packages/shared/src/observability.ts#L432

      makeLocalFileTracer drops the onFlush callback when it creates a TraceSink internally: it forwards filePath, maxBytes, maxFiles, and batchWindowMs to makeTraceSink but omits onFlush, so callers using the LocalFileTracerOptions API never receive flush statistics. Spread the remaining options (or pass onFlush explicitly) so the callback is honored.

      ✅ Resolved in 24e6ccd40459d6e4e7f334d682d0f63c3cdcd374

    20. Fixed in 24e6ccd404. Host power NumberFields now normalize null and non-finite values to their declared five-second minimum; the integrated UI check cleared the field, reopened the dialog, and verified it persisted as 5 rather than 0.

    21. Fixed in the rebased stack. The activity and resource telemetry RPC methods now declare authorization scopes in RpcAuthorization.ts, with focused authorization coverage. The integrated diagnostics page no longer reports undeclared-scope errors.

    22. Fixed in 24e6ccd404. The local file tracer forwards the caller's onFlush callback rather than dropping it, preserving flush completion/error signaling.

Sign in to join this conversation.