Repository navigation
feat(nix): merge the chosen T3 settings at activation - #496
Conversation
T3 Code rewrites its settings files from the UI, so a Home Manager activation merges only the chosen keys into them with jq and replaces each file atomically: keybindings and client settings on both hosts, server settings and localEnvironmentEnabled only where the T3 server runs. A file that does not parse stays unchanged. Refs #489 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refs #489 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review summaryBlocking findings (P0/P1): 0 The merge design looks correct to me. The deep merge with Findings
No other correctness or security problems found. The race where the desktop app overwrites 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Forcing 0644 made a file the user kept owner-only readable by others. Keep an existing file's mode and leave new files owner-only. Refs #489 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
Review summary (read-only) I found no blocking or minor issues in this PR. What I checked:
Known behaviour, not a bug: the desktop app writes its in-memory settings back over the merged file. The ADR and the PR steps both document this. 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ADR-0046 was taken by #496. Refs #494 Co-Authored-By: Claude Opus 5.5 <[email protected]>
T3 Code desktop app が Dock・Cmd+Tab・メニューバーで "Electron" と表示される問題を直す.macOS は実行中バイナリを含む bundle の名前を表示するため,llm-agents の launcher が nixpkgs の `Electron.app` 内のバイナリを exec すると Electron と表示される.dotfiles 側で T3 の bundle を組み立て,その bundle 自身の Electron を起動する. | 項目 | 変更前 | 変更後 | | --- | --- | --- | | `t3codeDesktopPackage` | llm-agents の `t3code-desktop` | `nix/packages/t3code_desktop.nix` | | 実行される Electron | nixpkgs の `Electron.app/Contents/MacOS/Electron` | `T3 Code (Beta).app/Contents/MacOS/Electron`(同じ electron 44.9.3 のコピー) | | `CFBundleName` / `CFBundleDisplayName` / アイコン | Electron / Electron / `electron.icns`(実行時の表示) | `T3 Code (Beta)` / `T3 Code (Beta)` / `t3code.icns` | | `CFBundleIdentifier` | `com.github.Electron`(実行時) | `org.nixos.t3code-desktop`(llm-agents の `org.nixos.T3 Code (Beta)` は空白と括弧を含み Apple の規則に反するため変更) | | 署名 | nixpkgs の Electron.app | 変更後の bundle を `codesign --force --deep --sign -` で ad-hoc 再署名 | | PATH と引数 | llm-agents の 2 段 wrapper | 同じ PATH(signed Codex を含む)と app directory を 1 つの launcher に集約 | - [x] Red:追加した check `t3-desktop-app-bundle` が既存 package で失敗(`CFBundleDisplayName` なし) - [x] Green:`nix build .#checks.aarch64-darwin.t3-desktop-app-bundle` が pass - [x] `plutil -p` で名前・identifier・アイコン・`CFBundleExecutable` を確認,`codesign --verify --deep --strict` は valid on disk かつ Designated Requirement を満たす - [x] launcher の PATH が llm-agents の desktop wrapper と一致し,dotfiles の signed Codex(`codex-0.170.0`,ADR-0041)を含む - [x] `nix flake check`:all checks passed.`nix build` で `t3-desktop-app-bundle`,`t3-settings-merge`,`home-configuration`,`host-configuration` も pass(#496 の merge 後の main に rebase した状態) - [x] レビュー:claude-review の P2(identifier の文字種)を修正し,check で文字種を検査.codex-review は指摘なし - [ ] 起動確認:未実施.store path から起動すると稼働中の desktop app と single-instance lock や `~/.t3` を共有する恐れがあるため,Dock 表示の確認は下の手順で利用者が行う ## 利用者の手順 1. この PR を merge する 2. mbp で lane が動いていないときに `darwin-rebuild switch` を実行する 3. T3 Code を開き直し,Dock と Cmd+Tab の名前とアイコンが T3 Code (Beta) になっていることを確認する 4. 通知の許可を求められたら再度許可する(identifier と署名が変わるため) 5. 問題なければ mba でも `darwin-rebuild switch` を実行して同じ確認をする <details> <summary>根拠と範囲</summary> - 起動経路:`t3code.desktop/bin/t3code-desktop`(`--prefix PATH`,`--inherit-argv0`)→ `t3code.unwrapped.desktop/bin/t3code-desktop`(`--add-flags .../libexec/t3code/apps/desktop`)→ `electron-44.9.3/bin/electron`(`Electron.app/Contents/MacOS/Electron` を exec).Darwin で設定される環境変数は PATH のみ - Electron は llm-agents の nixpkgs input の `electron_44` を使う(dotfiles の nixpkgs は 44.10.2 で異なる).store path が llm-agents の wrapper のものと一致することを確認済み.check が Electron の version,PATH,app directory のずれを検出する - helper は `Electron Helper*.app` の名前のまま残す - `bin/t3code-desktop` は bundle 内の launcher への symlink として残す - ADR-0047(`proposed`,#496 が 0046 を使ったため 0047):`.app` を dotfiles で組み立てる判断.実機確認後に `accepted` にする - 範囲外:llm-agents upstream,T3 の設定管理(#489 step 5),launchd server(`t3codePackage` は変更なし),Moshi - plan:#494 (comment) - 計画からの逸脱:なし </details> Refs #494 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
概要
t3Settings)で~/.t3/userdata/の JSON に merge する.選んだ key だけを書き,ほかの key はそのまま残す.ファイルはjqで作った一時ファイルをmvで置き換える(atomic).symlink にはしない(T3 が UI から書き込むため).settings.jsonとdesktop-settings.jsonはenableT3Serviceの host(mbp)だけ.keybindings.jsonと画面側のclient-settings.jsonは mbp・mba の両方.proposed):UI が書く vendor app の JSON を merge で管理する判断.Refs #489(plan:#489 (comment) の step 5)
管理する key
~/.t3/userdata/)keybindings.json(rule の配列){"key":"ctrl+c","command":"thread.stop","when":"turnRunning && !terminalFocus"}をちょうど 1 つ.ほかのthread.stoprule は消し,それ以外の rule は残すclient-settings.json(desktop app の画面側)notificationMode: "notifications-and-sound",inAppNotificationsEnabled: true,confirmThreadUnpin・confirmThreadArchive・confirmThreadDelete: true,confirmQuit: "double-click",language: "ja",threadDetailsItems: {openIn: false, scripts: false, servers: false, automations: false, usage: true, context: true},fontFamilyCode: "JetBrains Mono",mathRenderingEnabled: true,composerRichTextEnabled: false,diffLayout: "split",browserAutoShowFloatingPreview: falsesettings.json(server)enableAgentBrowserAccess: false,defaultAutoPull: true,defaultModelSelection: {instanceId: "claudeAgent", model: "claude-opus-5-5", options: [{id: "effort", value: "medium"}]},fallbackModelSelection: {instanceId: "codex", model: "gpt-6.2-sol", options: [{id: "reasoningEffort", value: "medium"}]},defaultRuntimeMode: "auto",snoozeLimitedThreads: true,autoResumeLimitedThreads: true,addProjectBaseDirectory: "~/ghq",ghqCloneLayout: true,removeAgentCreditsOnMerge: true,pullRequestMergeMethod: "squash",storageCleanup: {worktreeOnMerge: true, worktreeOnDelete: true}desktop-settings.jsonlocalEnvironmentEnabled: falsejqの*).storageCleanupやthreadDetailsItemsの中の,選んでいない key(worktreeOnArchive,branchなど)は残る.配列(options)は置き換える.optionsの{id, value}(T3 0.1.10 のModelSelection).id は provider ごとに違い,Claude はeffort,Codex はreasoningEffort.どちらの model も既定は medium で,今のsettings.jsonには書かれていないが,既定が変わっても medium に固定するため明示した(server は既定と同じ値を次の保存で省くことがある.意味は変わらない).languageの値はja(T3 の言語一覧{en, de, es, fr, ja, ko, pt-BR, ru, zh}).管理しないもの
Iris)t3code:theme,~/Library/Application Support/t3code-v2/Local Storage)にあり,ファイルの merge では安全に書けない.UI で選ぶt3code:client-settings:v1)にある.desktop app だけがclient-settings.jsonを使うproviderInstances,project,thread(statev2.sqlite),pairing,secrets/,clerk/,Tailscale Serveseparate fontsなど)調査結果(T3 0.1.10 の source map と mbp のファイルを読んで確認)
<T3CODE_HOME>/userdata/client-settings.json(DesktopEnvironment.clientSettingsPath)に保存する.browser は Local Storageclient-settings.jsonが古い理由desktop.trace.ndjsonとt3code-v2の最終更新が 15:36).UI での変更は別の client(mba の desktop か browser)で行われ,その client 側に保存されたと考えられる.server 側の値は 22:27 にsettings.jsonへ届いているsettings.jsonとkeybindings.jsonを監視していて,変われば読み直す.desktop app はclient-settings.jsonとdesktop-settings.jsonを起動時に読み,設定を変えるたびにメモリ上の全体を書き戻すthread.stopの既定 rule はないので,ファイルが rule 1 つだけでも既定は失われない利用者の手順
sudo darwin-rebuild switch --flake "$HOME/ghq/github.com/furedea/dotfiles/#mbp"Irisを選ぶ(管理外)git pullして,desktop app を終了してからsudo darwin-rebuild switch --flake "$HOME/ghq/github.com/furedea/dotfiles/#mba",開き直して同じく確かめる(server 側の値は mbp の server から来る)検証
nix build .#checks.aarch64-darwin.t3-settings-mergeがattribute 't3Settings' missingで失敗(module 追加前)providerInstances,idleCompaction,fontSizeCode,storageCleanup.worktreeOnArchive,threadDetailsItems.branch)を残し,管理する key を決めた値にする.文書全体を期待値と比べるthread.stoprule がちょうど 1 つ(escapeのthread.stopは消え,mod+bの rule は残る)desktop-settings.jsonを管理する key だけで作るkeybindings.jsonは通常ファイルになり,link 先は変わらないsettings.jsonは 0600 のまま,新しいdesktop-settings.jsonは 0600(review 指摘への対応.旧実装のchmod 0644でこの検証が失敗することを確認)settings.jsonは 1 byte も変わらず,desktop-settings.jsonは作られない.壊れたclient-settings.jsonは変えず,そのあとのkeybindings.jsonは作られる+)に変えると check が失敗することを確認して戻したnix flake check:all checks passed(aarch64-darwin)~/.t3への適用(brief で禁止.利用者の手順 2〜5 で確かめる).実ファイルのコピーに activation を当てる試行は権限で許可されなかったReview
chmod 0644で mode が広がる → 修正(5cc64b2).返信して thread を resolveplan との差
🤖 Generated with Claude Code