Skip to content

t3code: stage runtime dependencies and skip stripping text files - #582628

Open
iainlane wants to merge 2 commits into
NixOS:masterfrom
iainlane:t3code-runtime-dependencies
Open

iainlane wants to merge 2 commits into
NixOS:masterfrom
iainlane:t3code-runtime-dependencies

Conversation

@iainlane

@iainlane iainlane commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

An unmodified aarch64-darwin build of T3 Code 0.1.2 spent 1 hour 3 minutes 51 seconds in fixup, including approximately 55 minutes running strip. The 0.1.6 package copies all 1,220 pnpm packages from the build workspace into its output, then invokes strip on JavaScript, declarations and metadata among 83,633 candidate files. In an unchanged aarch64-darwin build of 0.1.6, fixup was still stripping text files when I stopped it after 10 minutes 34 seconds. Installing the runtime dependency closure and excluding text files reduces the installed packages to 36 and strip candidates to 398; the modified 0.1.6 build completed fixup in under 30 seconds.

Use upstream's server and desktop runtime selectors to install their transitive pnpm dependency closure. Preserve virtual-store entries so relative dependency links retain distinct versions and peer contexts, and reuse the build's native artefacts. Exclude JavaScript and TypeScript variants, source maps, JSON and Markdown from stripping.

I checked the original addition, its predecessor, and subsequent packaging history. Pruning was proposed in the original discussion, and a later discussion recommends upstream's runtime selectors. I found no recorded decision to reject runtime staging in those discussions. This change applies the selectors to the existing combined CLI/desktop package and keeps the Nixpkgs Electron integration.

Measurements for 0.1.6 on aarch64-darwin, using the same source and eight requested build cores:

Measurement Original installation Modified installation
pnpm packages 1,220 36
Regular files in the unwrapped output 83,638 5,383
Strip candidates without exclusions 83,633 5,378
With *.js, *.mjs, *.ts, *.map, *.json, *.md excluded 14,975 662
Also excluding *.cjs, *.cts, *.mts 8,163 398

The combined changes remove 93.6% of regular files and 99.5% of strip candidates. The three additional extensions still remove 264 strip attempts after pruning, or 40% of the candidates left by the six earlier patterns. Candidate counts come from the installed trees using the strip hook's regular-file selection and extension filters. The two actual build runs were the unchanged and final derivations.

The modified unwrapped output has a NAR size of 423.1 MiB and a runtime closure of 917.1 MiB. Its fixup completed below Nixpkgs' 30-second timing-report threshold. I interrupted the unchanged comparison build after 10 minutes 34 seconds in fixup, once its installed-file counts were captured; it was still stripping text files. The 0.1.6 baseline has no completed NAR-size or total-fixup measurement.

A separate build of unmodified 0.1.2 on the same aarch64-darwin host completed fixup in 1 hour 3 minutes 51 seconds, as recorded in the build log. Live process sampling showed approximately 55 minutes running strip. The completed 0.1.2 timing is separate from the 0.1.6 comparison above. Timings are observations from concurrent builds on this host.

Validation:

  • Built t3code.unwrapped, t3code and t3code.tests.runtime-dependencies on aarch64-darwin.
  • The fixture checks scoped packages, cycles, distinct dependency versions and peer contexts, unused packages, and rejection of runtime roots outside the virtual store.
  • t3 --version reports t3 v0.1.6. An isolated t3 serve --mode web with a temporary home returned HTTP 200 and the bundled HTML; the test server was stopped afterwards.
  • Runtime roots resolve, native fff/keyring/ffi modules load, and a native PTY prints the expected marker.
  • Both t3 and t3code-desktop report version 0.1.6 on aarch64-darwin. The wrapped desktop app starts with an isolated temporary home, starts its local backend, and renders the welcome screen at t3code://app/#/welcome with the local computer connected.
  • The Darwin resource monitor completes its protocol 3 handshake, returns a snapshot containing the requested process, and shuts down cleanly. The desktop and CLI test processes were stopped afterwards.
  • Built t3code (including t3code.unwrapped) and t3code.tests.runtime-dependencies natively on remote builders for both x86_64-linux and aarch64-linux. Both application builds needed an automatic retry with approximately 14 GB of memory after their initial 7 GB allocations ran out during dependency setup; successful runs peaked at approximately 11.4 GB.
  • Linux derivation evaluation, nixfmt, Ruff and git diff --check pass.
  • nixpkgs-vet 0.3.5 passes against the fetched base and committed head in an isolated local store with a temporary NIX_CONF_DIR containing an empty nix-path. The stock CI wrapper fails locally when its child Nix process tries to create /var/empty/.cache/nix; setting only XDG_CACHE_HOME does not help because the verifier clears that variable. The verifier and all checks are unchanged. The CI wrapper's additional import and filename-case checks also pass.

Built outputs:

  • aarch64-darwin, unwrapped: /nix/store/bqlc307f7jndagpyls8dh55q7xi1xymg-t3code-unwrapped-0.1.6.
  • aarch64-darwin, wrapped: /nix/store/g081iw673xzacxni0ij57cxmkn48fcq7-t3code-0.1.6.
  • x86_64-linux, wrapped: /nix/store/17g4vddamcib54lz63plz2p5qivdjdy9-t3code-0.1.6.
  • aarch64-linux, wrapped: /nix/store/1j1kzb7wb3d9i1l854g5xz41lxy9mgsi-t3code-0.1.6.

Prepared with Codex (GPT-6.1 Sol); follow-up validation and PR editing used Codex (GPT-6). Verification used Nix builds, nixpkgs-vet, nixfmt, Ruff, Python unittest, and temporary Python/Node probes for file counts, runtime checks and the CI wrapper's additional static checks.

Things done

The default fixup hook invokes strip on every regular file under
libexec. Most of T3 Code's installed files are JavaScript, type
declarations, source maps or metadata, so those attempts add process
startup cost without changing the files.

Exclude JavaScript and TypeScript variants, source maps, JSON and
Markdown while keeping native modules and executables eligible for
stripping.

Assisted-by: Codex (GPT-6)
build:desktop bundles most JavaScript dependencies, but the install
phase copies the entire workspace node_modules tree. This installs
build tools and packages whose code is already in the bundles, then
runs fixup over all of them.

Use upstream's server and desktop runtime selectors, then copy their
transitive pnpm dependency closure. Preserve virtual-store entries so
relative links retain distinct package versions and peer dependency
contexts. Reuse the build's native artefacts without a second dependency
install.

On aarch64-darwin, this reduces the 0.1.6 output from 83,638 regular
files to 5,383 and from 1,220 pnpm packages to 36. The CLI version,
isolated HTTP server, native module loading and PTY smoke tests pass.

Assisted-by: Codex (GPT-6)
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs labels Nov 3, 2026
@iainlane
iainlane marked this pull request as ready for review November 3, 2026 10:58
@nixpkgs-ci
nixpkgs-ci Bot requested review from 0x4bs3nt, iamanaws and qweered November 3, 2026 11:00
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant