镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(server): t3 theme updates a dev server running in the default home - #34700

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-34693
Nov 12, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-34693

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

resolveThemePaths in apps/server/src/cli/theme.ts always derived paths with no dev URL, so it could never select the dev state dir a default-home dev server uses (config.ts picks dev only when a dev URL is set and the home is implicit). Now, when neither --base-dir nor T3CODE_HOME is given, it uses the dev paths if dev/server-runtime.json records a live process and userdata/server-runtime.json does not. That is the same userdata-then-dev order t3 pair uses. An unreadable or undecodable runtime file counts as no server. With no live server at all the behaviour is unchanged (userdata). The CLI does not probe the server over HTTP, only that the recorded pid is alive, which is all the repro test sets up. No new regex or parser. The repro test used new Date(0).toISOString(), which fails the server typecheck (effect globalDateInEffect); it is replaced with the equivalent ISO string literal and is otherwise unchanged.

Fixes #34693

Reproduction on main

Commit 4ae66e2 (origin/main), after vp i. Ran the reporter's script with a private HOME and T3CODE_HOME unset: node apps/server/src/bin.ts serve --dev-url http://127.0.0.1:5999 --host 127.0.0.1 --port 4888 --no-browser <project>, waited for $HOME/.t3/dev/server-runtime.json, then ran node apps/server/src/bin.ts theme set probe.json. Output: the server's state dir was home/.t3/dev. theme set exited 0 and printed 'Published ... as "probe" and set it as the environment theme.' The dev server's settings.json had no defaultTheme and its themes/ was empty, while home/.t3/userdata/settings.json and userdata/themes/probe.json were written. In the control, with --base-dir passed to both serve and theme set, the server's explicit/userdata/settings.json got defaultTheme: probe and themes/probe.json. Added a CLI test to theme.test.ts that writes a live dev server-runtime.json under /.t3/dev and runs theme set ocean with HostProcess.HomeDirectory= and an empty env. It fails on main because /.t3/userdata/settings.json is written.

Evidence

Run the real dev server with a fresh private HOME and T3CODE_HOME unset. Wait for ~/.t3/dev/server-runtime.json, run theme set probe.json, inspect both state directories, then run theme show.

Before After
4ae66e2e86 fff782729d
Before: success reported but userdata receives the theme After: live dev server directory receives the theme
Exit 0; dev defaultTheme absent and themes empty; userdata contains probe. Exit 0; dev defaultTheme is probe and themes contains probe.json; userdata untouched.
Transcript playback Transcript playback

Shared reproduction driver. Captures render real command output and filesystem observations; videos are transcript playbacks. Environment: Linux, real Node CLI and live server, fresh synthetic state, identical capture dimensions.

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • Connected-client visual theme switching was not exercised; proof covers the reported CLI output and destination files.
  • theme clear, explicit --base-dir control, and simultaneous userdata/dev server precedence were not exercised; this run focused on the reported default-home reproduction.

Tests

vp test run src/cli/theme.test.ts: 1 failed / 7 passed on the repro branch, 8/8 passed after the fix. vp run typecheck (apps/server): exit 2 on the repro test's new Date, exit 0 after replacing it. vp run check:changed: format, lint, knip, graphql and tests (2 files, 10 tests) passed; its typecheck step failed only on that test date error, and the server typecheck passed after the fix. Manual run with a private HOME and T3CODE_HOME unset: serve --dev-url http://127.0.0.1:5999 --port 4888 then theme set ocean exited 0, wrote defaultTheme: ocean to home/.t3/dev/settings.json and created no userdata dir; theme show read from .t3/dev.

Not in this change

  • The theme CLI only checks that the recorded pid is alive and does not probe the server descriptor over HTTP like t3 pair does, so a recycled pid could still select a stale dev state dir.
  • theme.ts and pair.ts each define their own placeholder dev URL to derive dev paths; a shared helper in config.ts could replace both.
  • Inside a linked worktree, t3 pair checks the worktree's .t3 first; t3 theme does not use worktree home resolution, which is unchanged.

AI-assisted; verified with the tests and tools listed above.

Failing reproduction for #34693.

AI-assisted; verified with the tests and tools listed above.
t3 theme always resolved ~/.t3/userdata, so with a main-checkout dev server
(state in ~/.t3/dev) it reported success while the server never saw the theme.
With an implicit home, use the dev state directory when a live dev server
recorded its runtime state there and no userdata server is running, the same
order t3 pair checks.

Fixes #34693

AI-assisted; verified with the tests and tools listed above.
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Baseline: 4ae66e2 · PR result: fff7827 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Theme commands without an explicit home can now target a running dev environment instead of userdata. Human review is needed to confirm this default routing change, which determines where theme settings are updated or cleared.

You can add or adjust custom eligibility rules. Learn more.

@github-actions github-actions Bot added the size:S 10-29 changed lines (additions + deletions). label Nov 12, 2026
@juliusmarminge
juliusmarminge merged commit e304dab into main Nov 12, 2026
35 of 36 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-34693 branch November 12, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: t3 theme set reports success but writes userdata while a main-checkout dev server reads .t3/dev

1 participant