From 6334976e4832deb6d454b7d0f176a0f47d87fc7f Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:34:05 +0000 Subject: [PATCH 1/3] perf(ci): run the ARC voice and inbox check as parallel cached jobs The single Voice + founder inbox job ran every typecheck, test and both builds on one runner with caching off, so each run took 11-15 minutes and queued behind itself. Split it into core, web and mobile workers that run together, and keep the required check name on a small aggregator that fails unless all three succeeded. Dependencies now install through the shared cache action, the Playwright browser is cached, and a release-branch push or pull request can save the pnpm store instead of only the stale default branch. Model: grok/grok-4.7 Task: implementation Agent: Builder Lane: magpie Harness: t3 --- .../actions/provide-chromium-libs/action.yml | 26 ++ .github/actions/provide-libatomic/action.yml | 30 ++ .github/actions/setup-ci-deps/action.yml | 10 +- .github/scripts/arc-ci-coverage.cjs | 183 ++++++++++++ .github/scripts/arc-ci-coverage.test.cjs | 26 ++ .github/workflows/closura-arc-ci.yml | 275 +++++++++++++----- 6 files changed, 472 insertions(+), 78 deletions(-) create mode 100644 .github/actions/provide-chromium-libs/action.yml create mode 100644 .github/actions/provide-libatomic/action.yml create mode 100644 .github/scripts/arc-ci-coverage.cjs create mode 100644 .github/scripts/arc-ci-coverage.test.cjs diff --git a/.github/actions/provide-chromium-libs/action.yml b/.github/actions/provide-chromium-libs/action.yml new file mode 100644 index 0000000000000..b9fef1c3ce27f --- /dev/null +++ b/.github/actions/provide-chromium-libs/action.yml @@ -0,0 +1,26 @@ +name: Provide Chromium libraries +description: Make the shared libraries Playwright's Chromium shell needs available without root. +runs: + using: composite + steps: + - name: Provide Chromium libraries for the voice latency browser test + shell: bash + run: | + set -euo pipefail + if test -e /usr/lib/x86_64-linux-gnu/libnspr4.so; then + printf 'Chromium libraries present\n' + exit 0 + fi + dir="$RUNNER_TEMP/chromium-libs" + mkdir -p "$dir/lists/partial" "$dir/cache/archives/partial" "$dir/root" + apt_opts=(-o Debug::NoLocking=1 -o Dir::State::Lists="$dir/lists" -o Dir::Cache="$dir/cache") + apt-get "${apt_opts[@]}" -qq update + apt-get "${apt_opts[@]}" -qq install --download-only --no-install-recommends -y \ + libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 libcairo2 \ + libcups2t64 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0t64 libnspr4 libnss3 \ + libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 \ + libxkbcommon0 libxrandr2 + for deb in "$dir"/cache/archives/*.deb; do dpkg-deb -x "$deb" "$dir/root"; done + lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" + test -f "$lib_dir/libnspr4.so" + printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" diff --git a/.github/actions/provide-libatomic/action.yml b/.github/actions/provide-libatomic/action.yml new file mode 100644 index 0000000000000..196e7e019e8d4 --- /dev/null +++ b/.github/actions/provide-libatomic/action.yml @@ -0,0 +1,30 @@ +name: Provide libatomic +description: Make libatomic.so.1 available to official Node binaries without root. +runs: + using: composite + steps: + - name: Provide libatomic for official Node binaries + shell: bash + run: | + set -euo pipefail + # Official Node 26 linux-x64 binaries link libatomic.so.1. The pinned + # actions-runner image (dotnet runtime-deps:8.0-noble) lacks it, and + # the ARC pod cannot use sudo/apt (no privilege escalation). Without + # it, Vite+ self-setup fails with exit 127. Use Ubuntu noble's + # immutable release-pocket package, pinned by SHA-256. + lib_system=/usr/lib/x86_64-linux-gnu/libatomic.so.1 + if test -e "$lib_system"; then + printf 'libatomic present at %s\n' "$lib_system" + exit 0 + fi + test "$(uname -m)" = x86_64 + deb_url='https://archive.ubuntu.com/ubuntu/pool/main/g/gcc-14/libatomic1_14-20240412-0ubuntu1_amd64.deb' + deb_sha256='f496d80626e1512456273965d44f47b281edf53fa26d0d8bd0defc5be7e4601c' + dir="$RUNNER_TEMP/libatomic" + mkdir -p "$dir" + curl -fsSL --connect-timeout 10 --max-time 120 -o "$dir/libatomic1.deb" "$deb_url" + printf '%s %s\n' "$deb_sha256" "$dir/libatomic1.deb" | sha256sum -c - + dpkg-deb -x "$dir/libatomic1.deb" "$dir/root" + lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" + test -f "$lib_dir/libatomic.so.1" + printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" diff --git a/.github/actions/setup-ci-deps/action.yml b/.github/actions/setup-ci-deps/action.yml index cc6dc80511aca..9db8f531c7394 100644 --- a/.github/actions/setup-ci-deps/action.yml +++ b/.github/actions/setup-ci-deps/action.yml @@ -131,10 +131,18 @@ runs: # default, saves a ~1 GB store only its own reruns can read, so it only restores. # Concurrent jobs with the same install args reserve one key, so the losers # compress the store for nothing; all but one pass save-pnpm-store: false. + # + # This fork's default branch is the stale `main` line, while every release PR + # targets `release/native-0.1.10`. Gating the save on the default branch alone + # would leave the release line restoring forever and never writing a store, so + # a push to either release branch, and a PR into one, also saves. - name: Save pnpm store if: >- inputs.install == 'true' && inputs.save-pnpm-store == 'true' && - (github.event_name != 'pull_request' || github.base_ref == github.event.repository.default_branch) && + (github.event_name != 'pull_request' || + github.base_ref == github.event.repository.default_branch || + github.base_ref == 'release/native-0.1.10' || + github.base_ref == 'feat/assemblyai-current') && steps.pnpm_cache.outputs.cache-hit != 'true' && (steps.pnpm_store.outputs.namespace == 'full' || steps.pnpm_cache.outputs.cache-matched-key != format('pnpm-full-v1-{0}-{1}-{2}', runner.os, runner.arch, hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json'))) diff --git a/.github/scripts/arc-ci-coverage.cjs b/.github/scripts/arc-ci-coverage.cjs new file mode 100644 index 0000000000000..e0de8116c163d --- /dev/null +++ b/.github/scripts/arc-ci-coverage.cjs @@ -0,0 +1,183 @@ +const fs = require("node:fs"); +const path = require("node:path"); + +const WORKFLOW = ".github/workflows/closura-arc-ci.yml"; +const REQUIRED_CHECK = "Voice + founder inbox (Linux ARC)"; +const WORKERS = ["voice-and-inbox-core", "voice-and-inbox-web", "voice-and-inbox-mobile"]; + +// Every test the single serial job ran before the split. A parallel job that +// drops one of these makes the required check pass without running it. +const REQUIRED_TESTS = [ + "apps/server/src/speech/CloudSpeech.test.ts", + "apps/server/src/speech/GroqSpeechStream.test.ts", + "apps/server/src/speech/stream.test.ts", + "packages/contracts/src/threadInbox.test.ts", + "packages/contracts/src/threadInbox.invariants.test.ts", + "packages/contracts/src/threadInbox.upgrade.test.ts", + "packages/contracts/src/threadMetadataMcp.test.ts", + "apps/web/src/components/threadActionMenu.logic.test.ts", + "apps/web/src/components/sidebar/threadListFilter.logic.test.ts", + "packages/client-runtime/src/state/threadAttribution.test.ts", + "apps/server/src/orchestration-v2/ThreadLaunchService.test.ts", + "apps/server/src/orchestration-v2/SubagentProjection.test.ts", + "apps/server/src/orchestration-v2/ModelAlertReactor.test.ts", + "apps/server/src/orchestration-v2/ThreadEventAlerts.test.ts", + "apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts", + "packages/shared/src/threadPlacement.test.ts", + "apps/server/src/peer/RemoteDelegation.test.ts", + "apps/server/src/mcp/OrchestratorMcpService.test.ts", + "apps/server/src/cli/thread.test.ts", + "apps/web/src/composerDraftStore.test.ts", + "packages/client-runtime/src/voice-input/controller.test.ts", + "apps/web/src/components/chat/composerSend.logic.test.ts", + "apps/web/src/components/chat/chatViewSend.test.ts", + "apps/web/src/components/chat/composerImagePersistence.test.ts", + "apps/web/src/components/chat/draftPlacement.test.ts", + "apps/web/src/components/chat/draftAttachmentUploads.test.ts", + "apps/web/src/components/chat/draftUploadReconcile.test.ts", + "apps/web/src/lib/attachmentUploadQueue.test.ts", + "apps/server/src/ws.test.ts", + "packages/contracts/src/environment.test.ts", + "scripts/feature-map.test.ts", + "apps/mobile/src/state/thread-placement.model.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.placement.test.ts", + "apps/mobile/src/state/composer-attachment-uploads.test.ts", + "apps/mobile/src/lib/composerAttachmentUploadQueue.test.ts", + "apps/mobile/src/lib/attachmentUpload.test.ts", + "apps/mobile/src/state/use-composer-drafts.test.ts", + "apps/mobile/src/state/thread-outbox.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.permissions.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.test.ts", + "apps/mobile/src/state/pending-thread-creation.test.ts", + "apps/mobile/src/lib/projectThreadStartTurn.test.ts", + "apps/mobile/src/features/threads/thread-route-state.test.ts", + "apps/mobile/src/features/threads/new-task-flow-provider.test.tsx", + "apps/mobile/src/features/home/pendingTaskRoute.test.tsx", + "apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx", + "apps/web/src/speech/voiceInputLatency.browser.test.ts", + "apps/web/src/speech/useEnvironmentSpeechInput.browser.test.tsx", +]; + +function unquote(value) { + const trimmed = value.trim(); + if ( + (trimmed.startsWith('"') && trimmed.endsWith('"')) || + (trimmed.startsWith("'") && trimmed.endsWith("'")) + ) { + return trimmed.slice(1, -1); + } + return trimmed; +} + +// Workflow files are small and this only needs the step structure, so a flat +// scan beats pulling in a YAML parser. It tracks job ids, job names, `needs`, +// and the `run` / `working-directory` pairs inside each job's steps. +function parseWorkflow(source) { + const jobs = {}; + let current = null; + let inRun = false; + let runIndent = 0; + const lines = source.split("\n"); + for (const line of lines) { + if (inRun) { + const indent = line.match(/^\s*/)[0].length; + if (line.trim() !== "" && indent <= runIndent) inRun = false; + else { + current.run.push(line.trim().replace(/\\$/, "").trim()); + continue; + } + } + const job = line.match(/^ {2}([\w-]+):\s*$/); + if (job && !line.startsWith(" ")) { + current = { id: job[1], name: null, needs: [], steps: [] }; + jobs[current.id] = current; + continue; + } + if (!current) continue; + const name = line.match(/^ {4}name:\s*(.+)$/); + if (name) { + current.name = unquote(name[1]); + continue; + } + const needs = line.match(/^ {4}needs:\s*\[([^\]]*)\]/); + if (needs) { + current.needs = needs[1] + .split(",") + .map((item) => unquote(item)) + .filter(Boolean); + continue; + } + const directory = line.match(/^ {8}working-directory:\s*(.+)$/); + if (directory) { + current.directory = unquote(directory[1]); + continue; + } + const run = line.match(/^ {8}run:\s*(\||>)?\s*$/); + if (run) { + const step = { directory: current.directory ?? "", run: [] }; + current.steps.push(step); + current.run = step.run; + current.directory = ""; + inRun = true; + runIndent = 8; + } + } + return jobs; +} + +function testsIn(job) { + const found = []; + for (const step of job.steps) { + const prefix = step.directory ? `${step.directory}/` : ""; + for (const line of step.run) { + if (/^[\w./-]+\.(ts|tsx)$/.test(line)) found.push(prefix + line); + } + } + return found; +} + +function checkCoverage(source) { + const jobs = parseWorkflow(source); + const problems = []; + const aggregator = jobs["voice-and-inbox"]; + if (!aggregator) problems.push("missing voice-and-inbox job"); + else { + if (aggregator.name !== REQUIRED_CHECK) { + problems.push(`required check is named ${JSON.stringify(aggregator.name)}`); + } + const needs = [...aggregator.needs].sort(); + if (needs.join() !== [...WORKERS].sort().join()) { + problems.push(`aggregator needs ${needs.join(", ") || "nothing"}`); + } + } + const ran = []; + for (const id of WORKERS) { + if (!jobs[id]) { + problems.push(`missing worker ${id}`); + continue; + } + ran.push(...testsIn(jobs[id])); + } + const ranSet = new Set(ran); + for (const test of REQUIRED_TESTS) { + if (!ranSet.has(test)) problems.push(`no worker runs ${test}`); + } + const duplicates = ran.filter((test, index) => ran.indexOf(test) !== index); + for (const test of new Set(duplicates)) problems.push(`run twice: ${test}`); + return problems; +} + +module.exports = { REQUIRED_CHECK, REQUIRED_TESTS, WORKERS, checkCoverage, parseWorkflow }; + +if (require.main === module) { + const root = process.argv[2] ?? process.cwd(); + const source = fs.readFileSync(path.join(root, WORKFLOW), "utf8"); + const problems = checkCoverage(source); + if (problems.length > 0) { + for (const problem of problems) process.stderr.write(`${problem}\n`); + process.exit(1); + } + process.stdout.write( + `${REQUIRED_CHECK} covers ${REQUIRED_TESTS.length} tests across ${WORKERS.length} workers\n`, + ); +} diff --git a/.github/scripts/arc-ci-coverage.test.cjs b/.github/scripts/arc-ci-coverage.test.cjs new file mode 100644 index 0000000000000..dfa0a4c351fc3 --- /dev/null +++ b/.github/scripts/arc-ci-coverage.test.cjs @@ -0,0 +1,26 @@ +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const path = require("node:path"); +const test = require("node:test"); +const { REQUIRED_TESTS, checkCoverage } = require("./arc-ci-coverage.cjs"); + +const root = path.resolve(__dirname, "../.."); +const workflow = fs.readFileSync( + path.join(root, ".github/workflows/closura-arc-ci.yml"), + "utf8", +); + +test("the parallel workers cover every test the serial job ran", () => { + assert.deepEqual(checkCoverage(workflow), []); +}); + +test("renaming the aggregator or dropping a test fails the check", () => { + const renamed = workflow.replace( + "name: Voice + founder inbox (Linux ARC)", + "name: Voice and inbox", + ); + assert.ok(checkCoverage(renamed).some((problem) => problem.startsWith("required check"))); + + const dropped = workflow.replace(` ${REQUIRED_TESTS[0]} \\\n`, ""); + assert.ok(checkCoverage(dropped).some((problem) => problem.includes(REQUIRED_TESTS[0]))); +}); diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index d4587a14cd78e..d8114658f50eb 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -29,7 +29,12 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - voice-and-inbox: + # The former single job ran every step in series, so one runner held the + # whole 8-15 minute critical path. The work splits into independent workers + # that share nothing but the source tree. The ruleset `release-native-protection` + # requires the check name "Voice + founder inbox (Linux ARC)" exactly, so the + # tiny aggregator job below keeps that name and the workers do the work. + voice-and-inbox-core: # This is a public fork. Never run untrusted PR code on the private ARC LAN. # Same-repo PR + trusted human author/actor only; push and manual runs # require an authorized actor and one of the two exact branches above. @@ -49,9 +54,9 @@ jobs: contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor)) ) }} - name: Voice + founder inbox (Linux ARC) + name: Voice + inbox core (Linux ARC) runs-on: t3code-ci-arc - timeout-minutes: 90 + timeout-minutes: 45 env: CI: "true" GIT_CONFIG_NOSYSTEM: "1" @@ -80,43 +85,15 @@ jobs: "$GITHUB_REPOSITORY" "$RUNNER_NAME" "$GITHUB_REF" "$(git rev-parse HEAD)" - name: Provide libatomic for official Node binaries - shell: bash - run: | - set -euo pipefail - # Official Node 26 linux-x64 binaries link libatomic.so.1. The pinned - # actions-runner image (dotnet runtime-deps:8.0-noble) lacks it, and - # the ARC pod cannot use sudo/apt (no privilege escalation). Without - # it, Vite+ self-setup fails with exit 127. Use Ubuntu noble's - # immutable release-pocket package, pinned by SHA-256. - lib_system=/usr/lib/x86_64-linux-gnu/libatomic.so.1 - if test -e "$lib_system"; then - printf 'libatomic present at %s\n' "$lib_system" - exit 0 - fi - test "$(uname -m)" = x86_64 - deb_url='https://archive.ubuntu.com/ubuntu/pool/main/g/gcc-14/libatomic1_14-20240412-0ubuntu1_amd64.deb' - deb_sha256='f496d80626e1512456273965d44f47b281edf53fa26d0d8bd0defc5be7e4601c' - dir="$RUNNER_TEMP/libatomic" - mkdir -p "$dir" - curl -fsSL --connect-timeout 10 --max-time 120 -o "$dir/libatomic1.deb" "$deb_url" - printf '%s %s\n' "$deb_sha256" "$dir/libatomic1.deb" | sha256sum -c - - dpkg-deb -x "$dir/libatomic1.deb" "$dir/root" - lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" - test -f "$lib_dir/libatomic.so.1" - printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" + uses: ./.github/actions/provide-libatomic - - name: Set up pinned Node, pnpm and Vite+ - uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0 - env: - VP_DOWNLOAD_TIMEOUT: "120" - with: - node-version-file: package.json - cache: false - run-install: false - - - name: Install locked dependencies - shell: bash - run: vp install + # setup-vp's own cache cannot see the pnpm store on a self-hosted runner + # that starts from a clean workspace, so caching goes through the shared + # action: the Vite+ home, the pnpm store and the lockfile verification + # record, keyed on the lockfile. This job installs the whole workspace and + # is the one that saves the store; the other two restore it. + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps - name: Guard indispensable AssemblyAI voice implementation shell: bash @@ -153,7 +130,7 @@ jobs: vp run --filter t3 typecheck vp run --filter @t3tools/mobile typecheck - - name: Test AssemblyAI dictation, native inbox and thread placement behavior + - name: Test server voice, inbox and placement behavior shell: bash run: | set -euo pipefail @@ -165,9 +142,6 @@ jobs: packages/contracts/src/threadInbox.invariants.test.ts \ packages/contracts/src/threadInbox.upgrade.test.ts \ packages/contracts/src/threadMetadataMcp.test.ts \ - apps/web/src/components/threadActionMenu.logic.test.ts \ - apps/web/src/components/sidebar/threadListFilter.logic.test.ts \ - packages/client-runtime/src/state/threadAttribution.test.ts \ apps/server/src/orchestration-v2/ThreadLaunchService.test.ts \ apps/server/src/orchestration-v2/SubagentProjection.test.ts \ apps/server/src/orchestration-v2/ModelAlertReactor.test.ts \ @@ -177,6 +151,77 @@ jobs: apps/server/src/peer/RemoteDelegation.test.ts \ apps/server/src/mcp/OrchestratorMcpService.test.ts \ apps/server/src/cli/thread.test.ts \ + apps/server/src/ws.test.ts \ + packages/contracts/src/environment.test.ts \ + scripts/feature-map.test.ts + + - name: Build native T3 server + shell: bash + run: vp run --filter t3 build:bundle + + - name: Verify compiled server output + shell: bash + run: | + set -euo pipefail + test -f apps/server/dist/bin.mjs + printf 'Exact T3 source %s, server build successful on %s\n' \ + "$(git rev-parse HEAD)" "$RUNNER_NAME" + + voice-and-inbox-web: + if: >- + ${{ + github.repository == 'nullStack65/t3code' && + ( + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)) + || + (github.event_name != 'pull_request' && + (github.ref == 'refs/heads/feat/assemblyai-current' || + github.ref == 'refs/heads/release/native-0.1.10') && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor)) + ) + }} + name: Voice + inbox web (Linux ARC) + runs-on: t3code-ci-arc + timeout-minutes: 45 + env: + CI: "true" + GIT_CONFIG_NOSYSTEM: "1" + NODE_OPTIONS: "--max-old-space-size=3072" + GOMAXPROCS: "2" + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + sparse-checkout: | + /* + !/.repos/ + !/apps/mobile/modules/t3-terminal/Vendor/**/*.a + sparse-checkout-cone-mode: false + + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + # Restores the store the core job saves. save-pnpm-store stays off so two + # jobs never race to reserve the same cache key. + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps + with: + save-pnpm-store: "false" + + - name: Test web inbox, composer and voice behavior + shell: bash + run: | + set -euo pipefail + vp test run \ + apps/web/src/components/threadActionMenu.logic.test.ts \ + apps/web/src/components/sidebar/threadListFilter.logic.test.ts \ + packages/client-runtime/src/state/threadAttribution.test.ts \ apps/web/src/composerDraftStore.test.ts \ packages/client-runtime/src/voice-input/controller.test.ts \ apps/web/src/components/chat/composerSend.logic.test.ts \ @@ -185,10 +230,66 @@ jobs: apps/web/src/components/chat/draftPlacement.test.ts \ apps/web/src/components/chat/draftAttachmentUploads.test.ts \ apps/web/src/components/chat/draftUploadReconcile.test.ts \ - apps/web/src/lib/attachmentUploadQueue.test.ts \ - apps/server/src/ws.test.ts \ - packages/contracts/src/environment.test.ts \ - scripts/feature-map.test.ts + apps/web/src/lib/attachmentUploadQueue.test.ts + + - name: Build founder inbox and voice settings web client + shell: bash + run: vp run --filter @t3tools/web build + + - name: Verify compiled web output + shell: bash + run: | + set -euo pipefail + test -d apps/web/dist + printf 'Exact T3 source %s, web build successful on %s\n' \ + "$(git rev-parse HEAD)" "$RUNNER_NAME" + + voice-and-inbox-mobile: + if: >- + ${{ + github.repository == 'nullStack65/t3code' && + ( + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)) + ) + || + ( + github.event_name != 'pull_request' && + (github.ref == 'refs/heads/feat/assemblyai-current' || + github.ref == 'refs/heads/release/native-0.1.10') && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) + ) + }} + name: Voice + inbox mobile (Linux ARC) + runs-on: t3code-ci-arc + timeout-minutes: 45 + env: + CI: "true" + GIT_CONFIG_NOSYSTEM: "1" + NODE_OPTIONS: "--max-old-space-size=3072" + GOMAXPROCS: "2" + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + sparse-checkout: | + /* + !/.repos/ + !/apps/mobile/modules/t3-terminal/Vendor/**/*.a + sparse-checkout-cone-mode: false + + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps + with: + save-pnpm-store: "false" - name: Test mobile new-task placement, outbox and uploads shell: bash @@ -213,26 +314,18 @@ jobs: src/features/threads/NewTaskDraftRouteScreen.test.tsx - name: Provide Chromium libraries for the voice latency browser test - shell: bash - run: | - set -euo pipefail - if test -e /usr/lib/x86_64-linux-gnu/libnspr4.so; then - printf 'Chromium libraries present\n' - exit 0 - fi - dir="$RUNNER_TEMP/chromium-libs" - mkdir -p "$dir/lists/partial" "$dir/cache/archives/partial" "$dir/root" - apt_opts=(-o Debug::NoLocking=1 -o Dir::State::Lists="$dir/lists" -o Dir::Cache="$dir/cache") - apt-get "${apt_opts[@]}" -qq update - apt-get "${apt_opts[@]}" -qq install --download-only --no-install-recommends -y \ - libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 libcairo2 \ - libcups2t64 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0t64 libnspr4 libnss3 \ - libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 \ - libxkbcommon0 libxrandr2 - for deb in "$dir"/cache/archives/*.deb; do dpkg-deb -x "$deb" "$dir/root"; done - lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" - test -f "$lib_dir/libnspr4.so" - printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" + uses: ./.github/actions/provide-chromium-libs + + # The browser binary is the slow download. It is keyed on the Playwright + # version this lockfile resolves, so a bump refetches and everything else + # restores. The path is the runner temp dir, which is wiped between jobs, + # so nothing stale survives a version change. + - name: Restore Playwright Chromium + id: playwright_cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ runner.temp }}/playwright-browsers + key: playwright-chromium-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Test voice press-to-recording and release-to-text stay under 400 ms shell: bash @@ -246,19 +339,47 @@ jobs: src/speech/voiceInputLatency.browser.test.ts \ src/speech/useEnvironmentSpeechInput.browser.test.tsx - - name: Build native T3 server - shell: bash - run: vp run --filter t3 build:bundle + - name: Save Playwright Chromium + if: steps.playwright_cache.outputs.cache-hit != 'true' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ runner.temp }}/playwright-browsers + key: ${{ steps.playwright_cache.outputs.cache-primary-key }} - - name: Build founder inbox and voice settings web client + # Reports the exact check name the release-native-protection ruleset requires. + # It runs no build and installs nothing; it only waits for the three workers + # and fails when any of them failed, was cancelled, or was skipped. A skipped + # worker means the trust gate refused the run, and a required check must not + # turn green for a run that did no work. + voice-and-inbox: + name: Voice + founder inbox (Linux ARC) + needs: [voice-and-inbox-core, voice-and-inbox-web, voice-and-inbox-mobile] + if: always() + runs-on: t3code-ci-arc + timeout-minutes: 5 + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + sparse-checkout: .github + + # Fails the required check when a worker no longer runs one of the 48 + # tests the serial job ran, so coverage cannot shrink without this going red. + - name: Guard the parallel coverage shell: bash - run: vp run --filter @t3tools/web build + run: node .github/scripts/arc-ci-coverage.cjs - - name: Verify compiled release outputs + - name: Report the three workers shell: bash + env: + CORE: ${{ needs.voice-and-inbox-core.result }} + WEB: ${{ needs.voice-and-inbox-web.result }} + MOBILE: ${{ needs.voice-and-inbox-mobile.result }} run: | set -euo pipefail - test -f apps/server/dist/bin.mjs - test -d apps/web/dist - printf 'Exact T3 source %s, voice and inbox builds successful on %s\n' \ - "$(git rev-parse HEAD)" "$RUNNER_NAME" + printf 'core=%s web=%s mobile=%s\n' "$CORE" "$WEB" "$MOBILE" + for result in "$CORE" "$WEB" "$MOBILE"; do + test "$result" = success + done From 61b4730db8a52dd369523d33757f3d89467124bc Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:52:19 +0000 Subject: [PATCH 2/3] fix(ci): keep a cancelled ARC run from passing the required check The aggregator used if: always(), which also runs when the workflow is cancelled, and a worker that never started reports success. A new push cancels the previous run, so the required check would have gone green for a run whose tests never started. It now runs only when the workflow was not cancelled, and the coverage guard rejects both that condition and a test path that only appears inside dead code. The pnpm store save goes back to the action's original condition. This fork's default branch is release/native-0.1.10, so the push to it already writes the store every later run reads, and a pull request cache would only have been readable by that one PR. Model: grok/grok-4.7 Task: fix Agent: Builder Lane: magpie Harness: t3 --- .github/actions/setup-ci-deps/action.yml | 14 ++++++------ .github/scripts/arc-ci-coverage.cjs | 27 ++++++++++++++++++++++-- .github/scripts/arc-ci-coverage.test.cjs | 15 +++++++++++++ .github/workflows/closura-arc-ci.yml | 8 ++++++- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup-ci-deps/action.yml b/.github/actions/setup-ci-deps/action.yml index 9db8f531c7394..d89088678ec02 100644 --- a/.github/actions/setup-ci-deps/action.yml +++ b/.github/actions/setup-ci-deps/action.yml @@ -132,17 +132,17 @@ runs: # Concurrent jobs with the same install args reserve one key, so the losers # compress the store for nothing; all but one pass save-pnpm-store: false. # - # This fork's default branch is the stale `main` line, while every release PR - # targets `release/native-0.1.10`. Gating the save on the default branch alone - # would leave the release line restoring forever and never writing a store, so - # a push to either release branch, and a PR into one, also saves. + # A pull_request cache is scoped to that PR, so only the push to the default + # branch writes the store later runs share. This fork's default branch is + # `release/native-0.1.10`, so that push writes it and a PR into it reads it. + # A push to `feat/assemblyai-current` writes a store only that branch's own + # runs can read, which is the same scoping the action already gives any + # non-default branch. - name: Save pnpm store if: >- inputs.install == 'true' && inputs.save-pnpm-store == 'true' && (github.event_name != 'pull_request' || - github.base_ref == github.event.repository.default_branch || - github.base_ref == 'release/native-0.1.10' || - github.base_ref == 'feat/assemblyai-current') && + github.base_ref == github.event.repository.default_branch) && steps.pnpm_cache.outputs.cache-hit != 'true' && (steps.pnpm_store.outputs.namespace == 'full' || steps.pnpm_cache.outputs.cache-matched-key != format('pnpm-full-v1-{0}-{1}-{2}', runner.os, runner.arch, hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json'))) diff --git a/.github/scripts/arc-ci-coverage.cjs b/.github/scripts/arc-ci-coverage.cjs index e0de8116c163d..3deb7fbe94503 100644 --- a/.github/scripts/arc-ci-coverage.cjs +++ b/.github/scripts/arc-ci-coverage.cjs @@ -77,6 +77,7 @@ function parseWorkflow(source) { let current = null; let inRun = false; let runIndent = 0; + let inTriggers = true; const lines = source.split("\n"); for (const line of lines) { if (inRun) { @@ -87,13 +88,23 @@ function parseWorkflow(source) { continue; } } + if (inTriggers) { + if (line === "jobs:") inTriggers = false; + continue; + } const job = line.match(/^ {2}([\w-]+):\s*$/); - if (job && !line.startsWith(" ")) { - current = { id: job[1], name: null, needs: [], steps: [] }; + if (job) { + current = { id: job[1], name: null, needs: [], condition: null, steps: [] }; jobs[current.id] = current; continue; } if (!current) continue; + const condition = line.match(/^ {4}if:\s*(.+)$/); + if (condition && current.condition === null && current.steps.length === 0) { + current.condition = unquote(condition[1]); + continue; + } + if (!current) continue; const name = line.match(/^ {4}name:\s*(.+)$/); if (name) { current.name = unquote(name[1]); @@ -125,11 +136,18 @@ function parseWorkflow(source) { return jobs; } +// A test path only counts when a worker actually invokes it. A path that only +// appears inside a comment or a branch that never runs would otherwise let the +// guard pass while the required check runs nothing. function testsIn(job) { const found = []; for (const step of job.steps) { const prefix = step.directory ? `${step.directory}/` : ""; + let skipping = false; for (const line of step.run) { + if (/^(?:if\s+false\b|exit\b)/.test(line)) skipping = true; + else if (skipping && /^(?:fi|else|elif)\b/.test(line)) skipping = false; + if (skipping || line.startsWith("#")) continue; if (/^[\w./-]+\.(ts|tsx)$/.test(line)) found.push(prefix + line); } } @@ -149,6 +167,11 @@ function checkCoverage(source) { if (needs.join() !== [...WORKERS].sort().join()) { problems.push(`aggregator needs ${needs.join(", ") || "nothing"}`); } + // `always()` is true for a cancelled run, and a worker that never started + // reports success, so the required check would pass with nothing tested. + if (!aggregator.condition || !aggregator.condition.includes("!cancelled()")) { + problems.push("aggregator runs when the workflow is cancelled"); + } } const ran = []; for (const id of WORKERS) { diff --git a/.github/scripts/arc-ci-coverage.test.cjs b/.github/scripts/arc-ci-coverage.test.cjs index dfa0a4c351fc3..befef65649ab1 100644 --- a/.github/scripts/arc-ci-coverage.test.cjs +++ b/.github/scripts/arc-ci-coverage.test.cjs @@ -24,3 +24,18 @@ test("renaming the aggregator or dropping a test fails the check", () => { const dropped = workflow.replace(` ${REQUIRED_TESTS[0]} \\\n`, ""); assert.ok(checkCoverage(dropped).some((problem) => problem.includes(REQUIRED_TESTS[0]))); }); + +test("a test that only appears in dead code does not count as run", () => { + const buried = workflow.replace( + ` ${REQUIRED_TESTS[0]} \\\n`, + ` if false; then echo ${REQUIRED_TESTS[0]}; fi\n`, + ); + assert.ok(checkCoverage(buried).some((problem) => problem.includes(REQUIRED_TESTS[0]))); +}); + +test("an aggregator that runs on cancellation fails the check", () => { + const always = workflow.replace("if: ${{ !cancelled() }}", "if: always()"); + assert.ok( + checkCoverage(always).some((problem) => problem.includes("cancelled")), + ); +}); diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index d8114658f50eb..57f6c0db87815 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -351,10 +351,16 @@ jobs: # and fails when any of them failed, was cancelled, or was skipped. A skipped # worker means the trust gate refused the run, and a required check must not # turn green for a run that did no work. + # + # `if: always()` would also start this job when the workflow is cancelled, and + # a worker that never started reports `success`. The concurrency group cancels + # the previous in-progress run on every new push, so that would mark the + # required check green for a run whose tests never ran. `!cancelled()` still + # runs when a worker failed or was skipped. voice-and-inbox: name: Voice + founder inbox (Linux ARC) needs: [voice-and-inbox-core, voice-and-inbox-web, voice-and-inbox-mobile] - if: always() + if: ${{ !cancelled() }} runs-on: t3code-ci-arc timeout-minutes: 5 steps: From b0462ceb27e9d1d256177d05552f5eb9401cf9a2 Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Sat, 21 Nov 2026 01:13:20 +0000 Subject: [PATCH 3/3] fix(ci): set up Node before the ARC coverage guard The founder-inbox job checked out only .github and ran the coverage script with node, but the ARC image has no node on PATH, so the step exited 127. Provide libatomic, then setup-node from package.json, before that script. The guard fails if that order is removed. Model: grok-4.7 Task: fix Agent: Builder Lane: grok Harness: t3 --- .github/scripts/arc-ci-coverage.cjs | 23 ++++++++++++++++++++++ .github/scripts/arc-ci-coverage.test.cjs | 11 +++++++++++ .github/workflows/closura-arc-ci.yml | 25 +++++++++++++++++++----- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/.github/scripts/arc-ci-coverage.cjs b/.github/scripts/arc-ci-coverage.cjs index 3deb7fbe94503..52eb59d103191 100644 --- a/.github/scripts/arc-ci-coverage.cjs +++ b/.github/scripts/arc-ci-coverage.cjs @@ -154,6 +154,15 @@ function testsIn(job) { return found; } +function jobBody(source, id) { + const marker = `\n ${id}:`; + const start = source.indexOf(marker); + if (start < 0) return ""; + const rest = source.slice(start + marker.length); + const next = rest.search(/\n {2}[\w-]+:\s*\n/); + return next < 0 ? rest : rest.slice(0, next); +} + function checkCoverage(source) { const jobs = parseWorkflow(source); const problems = []; @@ -172,6 +181,20 @@ function checkCoverage(source) { if (!aggregator.condition || !aggregator.condition.includes("!cancelled()")) { problems.push("aggregator runs when the workflow is cancelled"); } + // The ARC image has no node on PATH. setup-node downloads an official + // Node 26 binary that needs libatomic, so both have to run first. + const body = jobBody(source, "voice-and-inbox"); + const libatomic = body.indexOf("uses: ./.github/actions/provide-libatomic"); + const setupNode = body.indexOf("uses: actions/setup-node@"); + const guard = body.indexOf("run: node .github/scripts/arc-ci-coverage.cjs"); + if ( + libatomic < 0 || + setupNode < 0 || + guard < 0 || + !(libatomic < setupNode && setupNode < guard) + ) { + problems.push("coverage guard runs before Node is on PATH"); + } } const ran = []; for (const id of WORKERS) { diff --git a/.github/scripts/arc-ci-coverage.test.cjs b/.github/scripts/arc-ci-coverage.test.cjs index befef65649ab1..4607a0e53c650 100644 --- a/.github/scripts/arc-ci-coverage.test.cjs +++ b/.github/scripts/arc-ci-coverage.test.cjs @@ -33,6 +33,17 @@ test("a test that only appears in dead code does not count as run", () => { assert.ok(checkCoverage(buried).some((problem) => problem.includes(REQUIRED_TESTS[0]))); }); +test("the coverage guard refuses to run before Node is on PATH", () => { + const withoutNode = workflow.replace( + / {6}- name: Provide libatomic for official Node binaries\n {8}uses: \.\/\.github\/actions\/provide-libatomic\n\n {6}- name: Setup Node\n {8}uses: actions\/setup-node@\S+ # v6\.5\.0\n {8}with:\n {10}node-version-file: package\.json\n\n/, + "", + ); + assert.notEqual(withoutNode, workflow); + assert.ok( + checkCoverage(withoutNode).some((problem) => problem.includes("Node is on PATH")), + ); +}); + test("an aggregator that runs on cancellation fails the check", () => { const always = workflow.replace("if: ${{ !cancelled() }}", "if: always()"); assert.ok( diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index 8a913cb760fce..507ab3a238695 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -370,10 +370,11 @@ jobs: key: ${{ steps.playwright_cache.outputs.cache-primary-key }} # Reports the exact check name the release-native-protection ruleset requires. - # It runs no build and installs nothing; it only waits for the three workers - # and fails when any of them failed, was cancelled, or was skipped. A skipped - # worker means the trust gate refused the run, and a required check must not - # turn green for a run that did no work. + # It runs no build and installs no workspace dependencies. The ARC image has + # no `node` on PATH, so this job sets up the repo's Node before the coverage + # guard. It fails when any worker failed, was cancelled, or was skipped. A + # skipped worker means the trust gate refused the run, and a required check + # must not turn green for a run that did no work. # # `if: always()` would also start this job when the workflow is cancelled, and # a worker that never started reports `success`. The concurrency group cancels @@ -392,7 +393,21 @@ jobs: with: persist-credentials: false fetch-depth: 2 - sparse-checkout: .github + # package.json is the Node version file. Cone mode on Git 2.43 accepts + # that root file alongside the .github directory. + sparse-checkout: | + .github + package.json + + # Official Node 26 links libatomic.so.1, which this image does not ship. + # The library path has to be set before setup-node runs that binary. + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + - name: Setup Node + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: package.json # Fails the required check when a worker no longer runs one of the 48 # tests the serial job ran, so coverage cannot shrink without this going red.