Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

docs(ci): tighten the arm64 comments

Minh14112022314944ee8e
diff --git a/.github/workflows/jan-tauri-build-agent-nightly.yaml b/.github/workflows/jan-tauri-build-agent-nightly.yaml
index 4c4ebe7e3..58b263b1f 100644
--- a/.github/workflows/jan-tauri-build-agent-nightly.yaml
+++ b/.github/workflows/jan-tauri-build-agent-nightly.yaml
@@ -84,9 +84,7 @@ jobs:
runs-on: ubuntu-22.04
# build-windows-arm64 is here for its outputs, not as a gate -- see the
# ARM_SHA branch below. Every other dependency is re-asserted by hand: a
- # status function anywhere in `if` drops the implicit success() gate for the
- # whole `needs` set, so without get-update-version a failed version job
- # would publish a manifest with an empty version and empty urls.
+ # status function in `if` drops the implicit success() gate for all of `needs`.
if: >-
!cancelled()
&& needs.get-update-version.result == 'success'
@@ -130,9 +128,8 @@ jobs:
}
MANIFEST
- # Appended rather than inlined above: empty when the ARM64 leg failed
- # or was skipped, and an entry with a blank url is one the CLI finds
- # and then fails to download.
+ # Appended, not inlined: empty when the ARM64 leg failed, and a blank url
+ # is one the CLI finds and then fails to download.
ARM_SHA="${{ needs.build-windows-arm64.outputs.SHA256 }}"
if [ -n "$ARM_SHA" ]; then
jq --arg url "https://delta.jan.ai/agent-nightly/${{ needs.build-windows-arm64.outputs.FILE_NAME }}" \
diff --git a/.github/workflows/jan-tauri-build-nightly.yaml b/.github/workflows/jan-tauri-build-nightly.yaml
index d78a71903..8fe76e32b 100644
--- a/.github/workflows/jan-tauri-build-nightly.yaml
+++ b/.github/workflows/jan-tauri-build-nightly.yaml
@@ -139,21 +139,14 @@ jobs:
build-macos,
]
runs-on: ubuntu-22.04
- # build-windows-arm64 does not gate *success*: while ARM64 is being
- # stabilised, a failed leg still publishes a manifest for x64, linux and
- # macOS rather than withholding it.
+ # build-windows-arm64 does not gate success: a failed ARM leg still publishes
+ # for x64, linux and macOS. It does still gate *scheduling* -- `needs` waits
+ # regardless of `if` -- so a hung ARM build delays the manifest by its 180m
+ # timeout.
#
- # It does still gate *scheduling* -- `needs` waits for the job to reach a
- # terminal state whatever `if` says -- so a hung ARM build can delay the
- # manifest by up to its 180-minute timeout. Accepted for now: the fix is a
- # follow-up job that patches the key in after publishing, and that is only
- # worth its second S3 sync once ARM64 runs on every nightly.
- #
- # Every other dependency is then re-asserted by hand, because a status
- # function anywhere in `if` drops the implicit success() gate for the whole
- # `needs` set, not just for the job being excused. Without the first two a
- # failed get-update-version would publish latest.json with an empty version
- # and empty urls -- which every platform's updater then fails to parse.
+ # Every other dependency is re-asserted by hand: a status function anywhere in
+ # `if` drops the implicit success() gate for the whole `needs` set, not just
+ # for the job being excused.
if: >-
!cancelled()
&& needs.get-update-version.result == 'success'
@@ -176,9 +169,8 @@ jobs:
LINUX_URL="https://delta.jan.ai/nightly/${{ needs.build-linux-x64.outputs.APPIMAGE_FILE_NAME }}"
WINDOWS_SIGNATURE="${{ needs.build-windows-x64.outputs.WIN_SIG }}"
WINDOWS_URL="https://delta.jan.ai/nightly/${{ needs.build-windows-x64.outputs.FILE_NAME }}"
- # Empty when that leg failed or was skipped. The key is then left out
- # of the manifest rather than written empty: an entry with a blank url
- # is one the updater finds and then fails to download.
+ # Empty when that leg failed or was skipped; the key is then left out
+ # rather than written blank, which the updater would find and fail on.
WINDOWS_ARM_SIGNATURE="${{ needs.build-windows-arm64.outputs.WIN_SIG }}"
WINDOWS_ARM_URL="https://delta.jan.ai/nightly/${{ needs.build-windows-arm64.outputs.FILE_NAME }}"
[ -n "$WINDOWS_ARM_SIGNATURE" ] || echo "::warning::no ARM64 build this run -- publishing latest.json without windows-aarch64"
diff --git a/.github/workflows/template-tauri-build-windows-arm64.yml b/.github/workflows/template-tauri-build-windows-arm64.yml
index 7583bd48a..4840c4167 100644
--- a/.github/workflows/template-tauri-build-windows-arm64.yml
+++ b/.github/workflows/template-tauri-build-windows-arm64.yml
@@ -1,12 +1,10 @@
# Windows ARM64 desktop build.
#
-# Separate from the x64 template on purpose: the arm64 CUDA pool, the vswhere
-# MSVC resolution and the NSIS retarget below are ~200 lines x64 has no use for,
-# so folding the two behind an `arch` input would buy a conditional maze. That
-# merge waits until ARM64 has a few green releases behind it.
+# Kept separate from the x64 template: the CUDA pool, MSVC resolution and NSIS
+# retarget below are ~200 lines x64 has no use for. Merge once ARM64 is green.
#
-# Publishes the same way x64 does -- release asset, S3, and the `windows-aarch64`
-# key its FILE_NAME/WIN_SIG outputs feed into latest.json.
+# Publishes like x64 -- release asset, S3, and the windows-aarch64 key its
+# FILE_NAME/WIN_SIG outputs feed into latest.json.
name: tauri-build-windows-arm64
on:
@@ -84,9 +82,8 @@ on:
FILE_NAME:
value: ${{ jobs.build-windows-arm64.outputs.FILE_NAME }}
- # Standalone entry point, kept because a 3-hour build wants an iteration loop
- # that is not a full nightly. `ref` and `public_provider` are deliberately not
- # declared here: unset, checkout takes the dispatched branch and every publish
+ # Standalone loop for a 3-hour build. `ref` and `public_provider` are left
+ # undeclared: unset, checkout takes the dispatched branch and every publish
# step's `if:` is false, so a manual run builds without publishing.
workflow_dispatch:
inputs:
@@ -122,12 +119,9 @@ on:
push:
branches: ['feat/windows-arm64']
-# Superseding a run supersedes its build: three hours of ARM runner is not worth
-# spending on a commit that has already been replaced, and two runs pulling the
-# CUDA pool at once is what got them throttled. Keyed on the caller's ref, so a
-# nightly on main and a push on a feature branch do not evict each other. The
-# x64 template has none of this because its caller already serialises it; this
-# one is also reachable by push.
+# Don't spend 3h of ARM runner on a superseded commit, and concurrent CUDA pulls
+# get throttled. Keyed on the caller's ref so nightly and a feature branch don't
+# evict each other. x64 needs none of this; only this one takes pushes.
concurrency:
group: tauri-win-arm64-${{ github.ref }}
cancel-in-progress: true
@@ -259,14 +253,10 @@ jobs:
'cuda_profiler_api-windows-arm64-13.4.46-archive'
)
- # curl.exe rather than Invoke-WebRequest, which has neither retry nor
- # resume: three runs inside nine minutes saw two of them cut off about
- # two seconds into the first archive with "the response ended
- # prematurely", the pool throttling concurrent pulls. IWR turns that
- # into a hard failure three minutes into a three-hour job. curl ships
- # in System32, so this adds no dependency -- checked once here anyway,
- # because a missing one would otherwise surface as a parse-time
- # "command not found" rather than something legible.
+ # curl.exe over Invoke-WebRequest, which has no retry or resume: the pool
+ # throttles concurrent pulls and drops the connection mid-body, killing a
+ # 3h job at minute 3. curl is in System32; checked anyway so a missing one
+ # fails legibly.
if (-not (Get-Command curl.exe -ErrorAction SilentlyContinue)) {
throw 'curl.exe not found; it is expected in System32 on this image'
}
@@ -277,8 +267,7 @@ jobs:
$total = 0
foreach ($a in $archives) {
$zip = Join-Path $tmp "$a.zip"
- # --retry-all-errors is what covers this: plain --retry ignores a
- # connection dropped mid-body, which is the failure seen here.
+ # --retry-all-errors: plain --retry ignores a mid-body drop.
curl.exe -sS --fail --location --retry 5 --retry-all-errors `
--retry-delay 5 --connect-timeout 30 --max-time 900 `
-o $zip "$env:CUDA_POOL/$a.zip"
@@ -349,10 +338,9 @@ jobs:
}
echo "signtool -> $TAURI_WINDOWS_SIGNTOOL_PATH"
- # scripts/download-bin.mjs names the bun/uv sidecars from node's
- # os.arch(), while the NSIS retarget below rewrites them to aarch64
- # unconditionally. An emulated x64 node would name them x86_64-* and
- # the mismatch would not surface until bundling, after the engine.
+ # download-bin.mjs names the sidecars from node's os.arch() while the NSIS
+ # retarget below assumes aarch64. An x64 node would mismatch, and not
+ # surface until bundling -- after the engine.
node_arch=$(node -p 'process.arch')
echo "node -> $node_arch"
[ "$node_arch" = "arm64" ] || {
@@ -385,8 +373,8 @@ jobs:
ctoml ./src-tauri/Cargo.toml package.version "$NEW_VERSION"
if [ "$CHANNEL" != "stable" ]; then
- # Without this an arm64 nightly keeps the stable endpoints baked into
- # tauri.conf.json and checks the wrong manifest.
+ # Without this an arm64 nightly keeps tauri.conf.json's stable
+ # endpoints and checks the wrong manifest.
if [ "$CHANNEL" = "nightly" ]; then
jq --arg fallback "https://delta.jan.ai/$CHANNEL/latest.json" \
'.plugins.updater.endpoints = ["https://apps-nightly.jan.ai/update-check", $fallback]' \
@@ -428,13 +416,10 @@ jobs:
# Left unpatched, an ARM64 install fetches and runs the x64 redist.
$c = $c.Replace('vc_redist.x64.exe', 'vc_redist.arm64.exe')
- # And the matching detection, which is the half that actually bites:
- # the VC runtime registers per architecture, and an ARM64 machine
- # almost always carries the x64 redist for emulated apps. Probing the
- # x64 keys therefore finds it, concludes the runtime is present, and
- # skips installing the ARM64 one the app links against. Guessing wrong
- # the other way merely re-runs an idempotent installer -- it exits 1638
- # and the script already treats that as success.
+ # And the detection, the half that bites: an ARM64 machine usually has
+ # the x64 redist, so probing x64 keys skips installing the ARM64 one the
+ # app links against. Guessing wrong the other way just re-runs an
+ # idempotent installer (exit 1638, already handled).
$c = $c.Replace('\VC\Runtimes\x64', '\VC\Runtimes\arm64')
$c = $c.Replace('VC_RuntimeMinimumVSU_amd64', 'VC_RuntimeMinimumVSU_arm64')
diff --git a/scripts/download-bin.mjs b/scripts/download-bin.mjs
index 9cceae490..171967d34 100644
--- a/scripts/download-bin.mjs
+++ b/scripts/download-bin.mjs
@@ -96,10 +96,8 @@ function matchSqliteVecAsset(assets, platform, arch) {
: ['linux']
const archHints = arch === 'arm64' ? ['arm64', 'aarch64'] : ['x86_64', 'x64', 'amd64']
- // The two fallbacks below drop the arch hint, so without this an arch with no
- // asset takes another one's: windows-arm64 has no sqlite-vec build, and would
- // otherwise land the windows-x86_64 dll, which then fails to load at runtime
- // and silently costs ANN acceleration. Skipping the extension entirely is the
+ // The fallbacks below drop the arch hint: windows-arm64 has no sqlite-vec
+ // build and would take the x86_64 dll, which cannot load. Skipping is the
// supported outcome -- the caller falls back to linear search.
const foreignArchHints =
arch === 'arm64'
@@ -116,13 +114,12 @@ function matchSqliteVecAsset(assets, platform, arch) {
// Prefer exact OS + arch matches
let matches = candidates.filter((c) => osHints.some((o) => c.name.includes(o)) && archHints.some((h) => c.name.includes(h)) && extHints.some((e) => c.name.endsWith(e)))
if (matches.length) return matches[0].url
- // Fallback: OS only. Safe because foreign architectures are already filtered
- // out above, so this can only relax the arch *spelling*, not the arch.
+ // OS only. Safe: foreign arches are filtered above, so this relaxes the arch
+ // spelling, not the arch.
matches = candidates.filter((c) => osHints.some((o) => c.name.includes(o)) && extHints.some((e) => c.name.endsWith(e)))
if (matches.length) return matches[0].url
- // No OS-only-last-resort: it could fire solely when nothing matches this OS,
- // which means there is no build for the platform, and any archive it picked
- // would be for a different one. Returning null skips the optional extension.
+ // No last resort: it would fire only when nothing matches this OS, so any
+ // archive it picked would be for another platform.
return null
}
@@ -263,9 +260,8 @@ async function main() {
if (platform === 'win32') {
copyFile(
path.join(binDir, 'bun.exe'),
- // uvPlatform, not bunPlatform: tauri resolves an externalBin by rust
- // target triple, which is the spelling uv happens to use and bun does
- // not (bun ships windows-aarch64, tauri wants aarch64-pc-windows-msvc).
+ // uvPlatform, not bunPlatform: tauri names externalBin by rust target
+ // triple, which is uv's spelling and not bun's.
path.join(binDir, `bun-${uvPlatform}.exe`),
(err) => {
if (err) {
diff --git a/scripts/install-jan-agent.ps1 b/scripts/install-jan-agent.ps1
index 76486a18c..afe91e63b 100644
--- a/scripts/install-jan-agent.ps1
+++ b/scripts/install-jan-agent.ps1
@@ -36,10 +36,8 @@ $BinaryName = 'jan.exe'
# ARCHITEW6432 is what an emulated process sees; PROCESSOR_ARCHITECTURE alone
# would report AMD64 for an x64 PowerShell on an ARM64 machine.
$NativeArch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }
-# Native first, then x86_64 under emulation. ARM64 Windows runs the x64 build
-# fine, and it is all that any version predating ARM64 -- or any nightly whose
-# ARM leg failed -- has to offer. Hard-failing there would be a downgrade from
-# the emulated install these users already had.
+# Native first, then x86_64 under emulation: it is all that pre-ARM64 versions,
+# or a nightly whose ARM leg failed, have to offer.
$PlatformKeys = if ($NativeArch -eq 'ARM64') { @('windows-aarch64', 'windows-x86_64') }
else { @('windows-x86_64') }