Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
perf: launch hosted checks without waiting for an optional local attestation
[._.]/ Adam Eivy886eca411969
diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.mdindex 86345edd25..da5d1fa045 100644--- a/docs/GITHUB_ACTIONS.md+++ b/docs/GITHUB_ACTIONS.md@@ -292,10 +292,9 @@ pushed head, and the impact planner skips what it attests to:- **When it applies.** Only a same-repository pull request into a non-`release`base that was not forced full. The planner verifies the merge-ref checkout'ssecond parent is the event's head (so the attested tree is compared with- the right commit) and reads `repos/{repo}/commits/{head}/statuses`. A head- committed less than five minutes ago with no `pregate` status yet is re-read- for up to 90 seconds (10-second interval; the summary says how long it- waited), because the status is posted after the push that started the run.+ the right commit) and reads `repos/{repo}/commits/{head}/statuses`. Statuses are read once: missing or late attestations immediately leave broad+ hosted coverage enabled. Focused pushes intentionally post no attestation,+ so the planner never waits for one.When you open the pull request yourself, the order is push, attest, then`gh pr create`, so the status precedes the `pull_request` event. Anyfailure — API error, unreadable description, tree mismatch, wrong creator,diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 421f2dab8a..fec772d4e1 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -1789,11 +1789,6 @@ const ATTESTATION_SKIPS = Object.freeze({'prompt-history': () => ({ promptHistory: false }),});-/** How long after the head commit a just-posted status may still be on its way. */-const ATTESTATION_YOUNG_HEAD_SECONDS = 300;-const ATTESTATION_POLL_TOTAL_MS = 90_000;-const ATTESTATION_POLL_INTERVAL_MS = 10_000;-/*** Whether this run may honor an attestation at all, and the head it would* read it from. Reads only the `CI_*` inputs ci.yml passes to the plan step.@@ -1883,17 +1878,16 @@ export function attestationDrift(plan, driftPaths) {* which `attestationDrift` weighs per stage in applyAttestation from the* `baseDrift` returned here.*- * A status posted moments after the push can still be on its way when the- * run starts, so a head younger than five minutes with no `pregate` status- * is re-read for up to 90 seconds before "no attestation" is concluded.+ * Focused local validation intentionally posts no attestation. Read once; a+ * missing or late receipt leaves broad hosted checks enabled immediately.** `log` defaults to stderr: the planner's stdout is the JSON plan pregate* and the tests parse, so every human-readable line here stays off it.*- * @param {{env?: NodeJS.ProcessEnv, exec?: typeof execFileSync, cwd?: string, log?: (line: string) => void, now?: () => number, sleep?: (ms: number) => void}} [options]+ * @param {{env?: NodeJS.ProcessEnv, exec?: typeof execFileSync, cwd?: string, log?: (line: string) => void}} [options]* @returns {{attested: boolean, reason: string, sha?: string, tree?: string, os?: string, node?: number, stages?: string[], creator?: string, createdAt?: string, baseDrift?: string[]|null, waitedMs?: number}}*/-export function resolveCiAttestation({ env = process.env, exec = execFileSync, cwd = process.cwd(), log = console.warn, now = Date.now, sleep = sleepMs } = {}) {+export function resolveCiAttestation({ env = process.env, exec = execFileSync, cwd = process.cwd(), log = console.warn } = {}) {const none = (reason) => {log(`⏭️ Pregate attestation not honored: ${reason}.`);return { attested: false, reason };@@ -1914,9 +1908,6 @@ export function resolveCiAttestation({ env = process.env, exec = execFileSync, c}const headTree = capture('git', ['rev-parse', '--verify', '--quiet', `${headSha}^{tree}`]);if (typeof headTree !== 'string') return none(`cannot resolve the tree of head ${headSha.slice(0, 9)}`);- const committed = capture('git', ['show', '-s', '--format=%ct', headSha]);- const headAgeSeconds = typeof committed === 'string' && /^\d+$/.test(committed) ? Math.floor(now() / 1000) - Number(committed) : null;-const readStatuses = () => {const body = capture('gh', ['api', `repos/${repository}/commits/${headSha}/statuses?per_page=100`]);if (typeof body !== 'string') return { error: `statuses API failed: ${body.error}` };@@ -1926,30 +1917,15 @@ export function resolveCiAttestation({ env = process.env, exec = execFileSync, creturn { error: 'statuses API returned unreadable JSON' };}};- const started = now();- let waitedMs = 0;- let selected;- for (;;) {- const read = readStatuses();- if (read.error) return none(read.error);- selected = selectAttestation(read.statuses, { owner, headTree });- const missing = !selected.attestation && selected.reason.startsWith('no "');- const young = headAgeSeconds !== null && headAgeSeconds >= 0 && headAgeSeconds < ATTESTATION_YOUNG_HEAD_SECONDS;- if (!missing || !young || now() - started >= ATTESTATION_POLL_TOTAL_MS) break;- sleep(ATTESTATION_POLL_INTERVAL_MS);- waitedMs = now() - started;- }- if (waitedMs > 0) log(`⏳ Waited ${Math.round(waitedMs / 1000)}s for a pregate status on the ${headAgeSeconds}s-old head ${headSha.slice(0, 9)}.`);+ const read = readStatuses();+ if (read.error) return none(read.error);+ const selected = selectAttestation(read.statuses, { owner, headTree });if (!selected.attestation) return none(selected.reason);const drift = capture('git', ['diff', '--name-only', 'HEAD^2', 'HEAD']);const baseDrift = typeof drift === 'string' ? drift.split('\n').filter(Boolean) : null;const { attestation, reason } = selected;log(`✅ Pregate attestation on ${headSha.slice(0, 9)} (tree ${attestation.tree.slice(0, 12)}): ${attestation.stages.join(', ')} — ${reason}; base moved by ${baseDrift ? `${baseDrift.length} file(s)` : 'an unreadable diff'}.`);- return { attested: true, reason, sha: headSha, ...attestation, baseDrift, waitedMs };-}--function sleepMs(ms) {- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);+ return { attested: true, reason, sha: headSha, ...attestation, baseDrift, waitedMs: 0 };}/**diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.jsindex 3532e6527c..2f3e9af786 100644--- a/scripts/ci-test-plan.test.js+++ b/scripts/ci-test-plan.test.js@@ -2345,30 +2345,21 @@ describe('pregate attestation', () => {expect(reasons).toHaveLength(8);});- it('waits up to 90 s for a status on a head younger than five minutes, and not on an older one', () => {- // The status is posted after the push that started this run, so a young- // head with no status yet is re-read at 10 s intervals.+ it('reads an absent attestation once and immediately retains broad CI for focused pushes', () => {let reads = 0;- const lateStatuses = () => { reads += 1; return reads < 4 ? [] : [status()]; };- const calls = [];- const young = resolveCiAttestation({ env: prEnv, exec: fakeExec({ statuses: lateStatuses, committedAt: Math.floor(NOW / 1000) - 60, calls }), log: quiet, ...clock() });- expect(young).toMatchObject({ attested: true, waitedMs: 30_000 });- expect(reads).toBe(4);-- reads = 0;- const lines = [];- const never = resolveCiAttestation({ env: prEnv, exec: fakeExec({ statuses: () => { reads += 1; return []; }, committedAt: Math.floor(NOW / 1000) - 60 }), log: (line) => lines.push(line), ...clock() });- expect(never.attested).toBe(false);- expect(reads).toBe(10);- expect(lines.some((line) => /^⏳ Waited 90s for a pregate status on the 60s-old head/.test(line))).toBe(true);-- reads = 0;- expect(resolve({ statuses: () => { reads += 1; return []; } }).attested).toBe(false);- expect(reads).toBe(1);- // A revocation or a mismatch is final: no waiting for it to change.- reads = 0;- expect(resolve({ statuses: () => { reads += 1; return [status({ state: 'failure' })]; }, committedAt: Math.floor(NOW / 1000) - 60 }).attested).toBe(false);+ const sleeps = [];+ let time = NOW;+ const result = resolveCiAttestation({+ env: prEnv,+ exec: fakeExec({ statuses: () => { reads += 1; return []; }, committedAt: Math.floor(NOW / 1000) - 60 }),+ log: quiet,+ now: () => time,+ sleep: ms => { sleeps.push(ms); time += ms; },+ });+ expect(result).toMatchObject({ attested: false, reason: 'no "pregate" status on the head' });expect(reads).toBe(1);+ expect(sleeps).toEqual([]);+ expect(applyAttestation(fullPlan(), result)).toMatchObject({ full: true, attestedStages: [] });});it('refuses, per stage, the stages a base-side change could reach', () => {