Skip to content

[Bug]: Disabling Local environment does not persist; Nightly repeatedly conflicts with background service after restart #26144

Closed

Description

@heykerim

Summary

On macOS, T3 Code Nightly repeatedly becomes unusable after normal Dock/restart launches when an installed background service owns the default T3 home. I followed the supported workaround (disable Settings → Connections → Local environment, connect to the existing background server). It worked, but the disabled setting later disappeared from ~/.t3/userdata/desktop-settings.json; the next normal launch again showed "This T3 home is unavailable" and quit.

The only reliable setup I've found is a custom AppleScript launcher that passes T3CODE_HOME=$HOME/.t3-desktop every time. I would like to use the native desktop app normally, with the same existing projects/threads and full local integrations, without managing a separate launcher or "remote" profile for a server on the same machine.

Actual behavior / observed timeline

  1. Installed background service owns ~/.t3 and serves my existing projects/threads on 127.0.0.1:3773. The browser UI can access them normally.
  2. Launching Nightly normally yields This T3 home is unavailable (the dialog suggests t3 update, service uninstall/reinstall, or a separate T3CODE_HOME).
  3. Updated the background service from 0.0.46-nightly.20261015.3158 to 0.1.2 stable using npx t3@latest update. The service restarted successfully, but the desktop error persisted. Uninstalling and reinstalling the service also did not fix it.
  4. Launching Nightly with open -na "T3 Code (Nightly)" --env "T3CODE_HOME=$HOME/.t3-desktop" works. In that independent home, set Local environment OFF and paired with the existing service; original projects/threads became visible again. At the time the Nightly UI reported 0.1.3-nightly.20261023.3579 and the existing service 0.1.2.
  5. On Oct 24, added "localEnvironmentEnabled": false to the default home's ~/.t3/userdata/desktop-settings.json while the desktop was closed, with a backup. Nightly subsequently opened normally and showed "This computer is off" (local backend disabled).
  6. On Oct 27, the same "T3 home is unavailable" error returned after opening Nightly normally. Read-only inspection showed:
    • ~/.t3/userdata/desktop-settings.json: localEnvironmentEnabled MISSING, last modified 2026-10-27 22:27:41 local time.
    • ~/.t3-desktop/userdata/desktop-settings.json: localEnvironmentEnabled: false, last modified 2026-10-23 17:41:31 local time.
    • I have not established which process rewrote the default-home settings file. The observation is that the explicit disabled value did not survive.
  7. A self-created T3 Remote.app AppleScript wrapper calling open -na "T3 Code (Nightly)" --env "T3CODE_HOME=$HOME/.t3-desktop" works, with the original background server and projects/threads. This is a workaround, not a desirable desktop experience.

Expected behavior

  • A selected Local environment OFF state survives updates, restarts, and normal app launches.
  • Nightly launches from the Dock without competing for the installed background service's default home.
  • Ideally, the desktop detects a healthy same-machine background service and offers to attach to it directly, preserving the local desktop experience and integrations (e.g. Open in editor / Reveal in Finder), rather than requiring users to simulate a remote connection via a separate T3 home.
  • If the startup lock is encountered, the dialog offers a recovery action without requiring access to Settings in an app that cannot open.

Environment

  • macOS on Apple Silicon, T3 Code Nightly.
  • Nightly 0.1.3-nightly.20261023.3579 observed during initial troubleshooting; build at the Oct 27 recurrence not verified.
  • Installed launchd T3 background service confirmed 0.1.2 during initial troubleshooting; version at Oct 27 recurrence not independently rechecked.
  • Existing home ~/.t3, background service accessible through localhost port 3773.

Related

Specific new diagnostic evidence here: localEnvironmentEnabled: false was set to recover, but the key later disappeared from the default home's settings file. Please investigate which startup/update/service path rewrites that setting, and how to preserve the user's chosen desktop/server mode. No databases were deleted or migrated.

Activity

  1. juliusmarminge commented on Oct 27, 2026

    @juliusmarminge
    Member

    Tried this on current main (5e9d564) with the Linux desktop app. A separate T3 server owned the T3 home, standing in for the background service.

    • No desktop-settings.json: the desktop shows "This T3 home is unavailable". Matches your step 2. Dismissing it quits without writing the settings file.
    • {"localEnvironmentEnabled": false} written by hand, then the app launched: "This computer is off", no server start. Matches your step 5. Moving or closing the window rewrites the file, and the key stays: {"localEnvironmentEnabled":false,"mainWindowBounds":{…}}.
    • Closed and relaunched with the same file: still off, the key still there.

    On main, the only thing that writes desktop-settings.json is the desktop app. It writes the state it loaded at startup and drops only values equal to the default. So the key disappears only when a desktop process believes the local environment is on. That happens after the Local environment toggle in Settings → Connections, or in a T3 Code desktop process that loaded the file before your edit. To tell which one it was:

    1. The desktop records every settings write in its trace. Could you post the output of this command? It prints only span names, times and the toggle value:
      grep -h '"name":"desktop.settings' ~/.t3/userdata/logs/desktop.trace.ndjson* | python3 -c '
      import sys, json, datetime
      for l in sys.stdin:
          r = json.loads(l)
          print(datetime.datetime.fromtimestamp(int(r["startTimeUnixNano"]) / 1e9), r["name"], r.get("attributes", {}))'
      The interesting lines are a desktop.settings.setLocalEnvironmentEnabled with enabled: true, and the desktop.settings.writeSettings near 2026-10-27 22:27:41. If the trace has already rotated past Oct 24–27, say so.
    2. Between Oct 24 and Oct 27, did any other T3 Code desktop build (stable, or another Nightly copy) start against the default ~/.t3? Did "This computer is off" → Open Environments → the Local environment switch get used in that profile?
    3. The Nightly version at the Oct 27 launch (About T3 Code).

    Attaching the desktop to a same-machine background service, and a recovery action inside the dialog, are separate requests. https://git.cafe/pingdotgg/t3code/issues/22821 tracks the dialog's advice.

  2. juliusmarminge commented on Nov 12, 2026

    @juliusmarminge
    Member

    @heykerim Could you run the trace command from the maintainer's Oct 27 comment (grep the desktop.settings spans in ~/.t3/userdata/logs/desktop.trace.ndjson*) and post the lines around 2026-10-27 22:27:41, especially any desktop.settings.setLocalEnvironmentEnabled with enabled: true, and say whether any other T3 Code desktop build or window was running against the default ~/.t3 between Oct 24 and Oct 27?

  3. heykerim commented on Nov 13, 2026

    @heykerim
    Author

    @juliusmarminge Thanks for investigating and for testing the behavior against current main. Here is a more complete response to your three questions, with the exact observations and the limits of what I can verify.

    1. Requested desktop settings trace (Oct 27, 22:27:41)

    On Nov 13, I inspected the available ~/.t3/userdata/logs/desktop.trace.ndjson* files read-only. The scan parsed JSON spans whose name starts with desktop.settings, converting timestamps to Europe/Bratislava local time and selecting Oct 24–28, 2026.

    Result:

    Matching events: 0; trace files: 11
    

    Therefore I cannot provide the desktop.settings.writeSettings span at 2026-10-27 22:27:41, nor confirm a desktop.settings.setLocalEnvironmentEnabled event with enabled: true. Those events are not in the available traces under that filter. The traces may have rotated, but I haven't independently established that. I don't want to claim that the setting changed spontaneously when we have no record identifying its writer.

    For reference, this was the actual read-only check (showing just timestamps, span names and the enabled attribute rather than full potentially sensitive trace contents):

    import json
    from pathlib import Path
    from datetime import datetime, date
    from zoneinfo import ZoneInfo
    
    files = sorted(Path.home().glob(".t3/userdata/logs/desktop.trace.ndjson*"))
    count = 0
    for path in files:
        with path.open(errors="replace") as f:
            for line in f:
                if '"desktop.settings' not in line:
                    continue
                try:
                    r = json.loads(line)
                    name = r.get("name", "")
                    dt = datetime.fromtimestamp(
                        int(r["startTimeUnixNano"]) / 1e9,
                        ZoneInfo("Europe/Bratislava")
                    )
                except (ValueError, KeyError, TypeError):
                    continue
                if not name.startswith("desktop.settings"):
                    continue
                if not date(2026, 10, 24) <= dt.date() <= date(2026, 10, 28):
                    continue
                attrs = r.get("attributes") or {}
                enabled = attrs.get("enabled", "-") if isinstance(attrs, dict) else "-"
                print(f"{dt:%Y-%m-%d %H:%M:%S} | {name} | enabled={enabled}")
                count += 1
    print(f"Matching events: {count}; trace files: {len(files)}")

    2. Other desktop builds and whether the Local environment switch was used

    I installed T3 Code Beta only after the original Nightly/normal desktop launch had begun failing with "This T3 home is unavailable". I was trying to regain access, not intentionally create two independent local servers. Later, I adopted the separate-home T3 Remote launcher workaround.

    The sequence I can verify from the screenshots and terminal output is:

    • Oct 23: Nightly failed to open because the installed background service was using the default ~/.t3 home. Updated the service from 0.0.46-nightly.20261015.3158 to 0.1.2 stable using npx t3@latest update; the service restarted, but normal desktop launches still failed. Service uninstall/reinstall did not address this ownership conflict.
    • Oct 23: Running open -na "T3 Code (Nightly)" --env "T3CODE_HOME=$HOME/.t3-desktop" opened Nightly successfully with an initially empty project list. In this separate home I disabled Local environment, connected to the existing always-on server at localhost:3773, and could access my original projects and threads again.
    • Oct 24: With Nightly closed, added "localEnvironmentEnabled": false to the default ~/.t3/userdata/desktop-settings.json (backed up beforehand). Normal launch then opened without the ownership dialog and showed "This computer is off", consistent with the local environment being disabled.
    • Oct 27: The ownership dialog recurred after a normal launch. At 22:29 local, I inspected both settings files read-only:
      ~/.t3/userdata/desktop-settings.json
        modified 2026-10-27 22:27:41
        localEnvironmentEnabled: MISSING
      
      ~/.t3-desktop/userdata/desktop-settings.json
        modified 2026-10-23 17:41:31
        localEnvironmentEnabled: False
      
    • Oct 27 onward: A custom AppleScript T3 Remote.app launcher which runs open -na "T3 Code (Nightly)" --env "T3CODE_HOME=$HOME/.t3-desktop" consistently opened Nightly with the original server and projects. Normal Nightly launches had previously continued to hit the ownership dialog.

    On your specific question about another desktop instance using the default ~/.t3: Beta was installed as part of troubleshooting after the first failure, but I cannot reliably reconstruct whether it or another Nightly instance was open against the default home at 22:27:41 on Oct 27. I also have no recorded evidence of deliberately switching Local environment back ON in that default-home profile, but I cannot rule out an accidental toggle or another desktop process loading an older/default settings snapshot. So an older-running or alternate desktop instance rewriting the JSON is still a credible explanation.

    3. Nightly build on Oct 27

    I don't have a screenshot of About T3 Code from that exact launch. The build clearly visible in an earlier Oct 23 Connections screenshot was:

    0.1.3-nightly.20261023.3579
    

    I cannot assert this was still the installed build on Oct 27 after Nightly updates. The background service was verified as 0.1.2 during the Oct 23 recovery; I did not recheck its version at the Oct 27 incident.

    What is established vs. still open

    Established: the background server continued serving the original threads/projects from localhost:3773; the same-machine desktop's default-home launch hit the ownership dialog; separate T3CODE_HOME + Local environment OFF + pairing worked; after a successful default-home recovery, the key was later absent in a newly modified default-home settings file.

    Not established: which process wrote that file on Oct 27, whether a toggle to ON occurred, whether traces have rotated, or a reproducible persistence defect on current main. Your successful reproduction with the key surviving on Linux is useful evidence against assuming a generic write/persistence bug.

    My primary user-facing request remains: please make the supported same-machine desktop + always-on service setup usable without creating a custom macOS launcher, ideally while retaining local editor/Finder integrations. I understand that automatic attachment and error-dialog recovery are distinct improvements and am happy for those to be tracked separately from this settings investigation.

    If the existing traces cannot identify the writer, I'd appreciate guidance on the smallest safe logging/diagnostic setup to capture the responsible desktop process, effective T3CODE_HOME, and toggle state if this happens again, without uploading full logs containing private workspace or account data.

  4. added
    needs more infoInitial triage showed no bug. Awaiting more info
    and removed
    needs more infoInitial triage showed no bug. Awaiting more info
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions