toolroll 0.9.118 → 0.9.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +14 -14
- package/dist/assignment.js +40 -29
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +32 -31
- package/dist/builder.js +286 -236
- package/dist/central-recovery-stage.js +3 -3
- package/dist/check-failure.js +2 -2
- package/dist/check-levels.js +3 -0
- package/dist/check-report.js +58 -7
- package/dist/contracts/console-api.js +4 -1
- package/dist/contracts/engine-api.js +1 -0
- package/dist/contracts/release-check.js +7 -4
- package/dist/contracts/release-terms.js +11 -2
- package/dist/contracts/verification-receipt.js +1 -1
- package/dist/deploy-gate.js +7 -1
- package/dist/direct-chat.js +3 -3
- package/dist/easy-start.js +8 -6
- package/dist/engine-reads.js +72 -0
- package/dist/flexible-conversation-schema.js +24 -0
- package/dist/flexible-conversation.js +162 -0
- package/dist/flexible-custody.js +3 -0
- package/dist/flexible-import.js +51 -0
- package/dist/flexible-session.js +84 -11
- package/dist/install-mode.js +1 -1
- package/dist/local-landing.js +500 -0
- package/dist/local-owner.js +1 -0
- package/dist/operate.js +143 -22
- package/dist/passwordless.js +1 -1
- package/dist/project-delete.js +1 -0
- package/dist/rehearsal.js +27 -0
- package/dist/release-adapters.js +170 -2
- package/dist/release-approval.js +11 -8
- package/dist/release-card.js +7 -2
- package/dist/release-carry.js +1 -1
- package/dist/release-cli.js +115 -14
- package/dist/release-main-proof.js +49 -0
- package/dist/release-main.js +110 -0
- package/dist/release-recheck.js +10 -3
- package/dist/release.js +221 -33
- package/dist/reply-shape.js +6 -1
- package/dist/result-actions.js +7 -1
- package/dist/result-follow-ups.js +8 -4
- package/dist/serve.js +31 -14
- package/dist/server/direct-chat.js +88 -3
- package/dist/server/engine-api.js +43 -5
- package/dist/server/render-results.js +3 -1
- package/dist/server/render-tasks.js +10 -1
- package/dist/server/route-table.js +9 -0
- package/dist/server/settings.js +31 -7
- package/dist/server/task-views.js +15 -0
- package/dist/server/tasks.js +63 -3
- package/dist/settings-groups-ui.js +2 -2
- package/dist/store.js +29 -4
- package/dist/surface.js +9 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/verification-evidence.js +17 -6
- package/dist/workspace-ui.js +1 -1
- package/package.json +2 -1
- package/scripts/release-proof.mjs +240 -0
package/dist/builder.js
CHANGED
|
@@ -16,14 +16,15 @@ import { CHECK_INVENTORY_CAPTURE, CHECK_REPORT_CAPTURE, CheckBaselineUnverifiabl
|
|
|
16
16
|
import { CHECK_LOAD_CAPTURE, CheckLoadWatch } from "./check-load.js";
|
|
17
17
|
import { NOTHING_STARTED_ACTION, retriedInside } from "./check-failure.js";
|
|
18
18
|
import { planTargetedRecheck, settleCoverage } from "./release-recheck.js";
|
|
19
|
-
import { effectiveCheckFacts } from "./verification-evidence.js";
|
|
19
|
+
import { coveragePasses, effectiveCheckFacts } from "./verification-evidence.js";
|
|
20
20
|
import { learningContext } from "./project-learning.js";
|
|
21
21
|
import { knowledgeContext } from "./project-knowledge.js";
|
|
22
22
|
import { flowGoalCuts } from "./flow-engine.js";
|
|
23
23
|
import { readCodingHandoff, verifyCodingHandoffBase } from "./coding-handoff.js";
|
|
24
24
|
import { PREPARED_EVIDENCE_FILE, preparedEvidenceGit, preparedScreenshotMatches, readPreparedEvidence, writePreparedEvidence } from "./prepared-evidence.js";
|
|
25
|
-
import { accessSync, constants as fsConstants, existsSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
26
|
-
import { homedir } from "node:os";
|
|
25
|
+
import { accessSync, chmodSync, constants as fsConstants, existsSync, mkdtempSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
26
|
+
import { homedir, tmpdir } from "node:os";
|
|
27
|
+
import { purposeCheckMode } from "./contracts/release-terms.js";
|
|
27
28
|
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
28
29
|
import { run, runClaudeStreamJsonl, runOwnerTag, streamsInput } from "./exec.js";
|
|
29
30
|
import { stopRequestedFor, stopWords, underStopWatch } from "./task-control.js";
|
|
@@ -1630,6 +1631,8 @@ async function settleProof(captured, statArtifactId, sealedHead) {
|
|
|
1630
1631
|
const gateCommand = batched ? null : configured;
|
|
1631
1632
|
let verifyCommand;
|
|
1632
1633
|
let checkAttempt = null;
|
|
1634
|
+
let deployCopyDir = null;
|
|
1635
|
+
let deployCleanupProblem = null;
|
|
1633
1636
|
let loadWatch = null;
|
|
1634
1637
|
let releaseFacts = null;
|
|
1635
1638
|
const verification = { last: null };
|
|
@@ -1680,186 +1683,92 @@ async function settleProof(captured, statArtifactId, sealedHead) {
|
|
|
1680
1683
|
recordCheckNote("Verification did not start: this worker no longer owned the build.");
|
|
1681
1684
|
}
|
|
1682
1685
|
else {
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
const decision = planTargetedRecheck(store, root, { runId, taskId: request.taskId, repo, head: sealedHead, command: configured, access, now: now() });
|
|
1689
|
-
const release = decision.authority !== null || releaseCheckScope(store.getScope(request.taskId));
|
|
1690
|
-
loadWatch = new CheckLoadWatch(configured.timeoutMs, request.machine === undefined ? {} : { sample: request.machine });
|
|
1686
|
+
const removeDeployCopy = () => {
|
|
1687
|
+
if (deployCopyDir === null)
|
|
1688
|
+
return;
|
|
1689
|
+
const dir = deployCopyDir;
|
|
1690
|
+
deployCopyDir = null;
|
|
1691
1691
|
try {
|
|
1692
|
-
|
|
1693
|
-
...(decision.mode === "targeted" ? { plan: decision.plan, snapshot: decision.snapshot } : {}), watch: decision.watch, release,
|
|
1694
|
-
learn: learnRequestFor(store, repo, now(), runId).learn }, now());
|
|
1692
|
+
rmSync(dir, { recursive: true, force: true });
|
|
1695
1693
|
}
|
|
1696
1694
|
catch (error) {
|
|
1697
|
-
|
|
1698
|
-
throw error;
|
|
1699
|
-
checkAttempt = null;
|
|
1700
|
-
baselineUnverifiable = error.message;
|
|
1701
|
-
recordCheckNote(error.message);
|
|
1702
|
-
}
|
|
1703
|
-
if (checkAttempt === null && loadWatch !== null) {
|
|
1704
|
-
loadWatch.finish();
|
|
1705
|
-
loadWatch = null;
|
|
1695
|
+
deployCleanupProblem = `its copy of this computer's database couldn't be deleted (${error instanceof Error ? error.message : String(error)})`;
|
|
1706
1696
|
}
|
|
1707
|
-
if (
|
|
1708
|
-
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
else
|
|
1713
|
-
checkAttempt = null;
|
|
1714
|
-
const progressWrites = coalescedProgressWriter(snapshot => { store.saveCheckProgress(runId, snapshot, now()); });
|
|
1715
|
-
const checkProgress = new CheckProgressTracker(snapshot => progressWrites.push(snapshot));
|
|
1716
|
-
const runVerification = async (label, missing = null) => {
|
|
1717
|
-
const streamed = { stdout: false, stderr: false };
|
|
1718
|
-
if (missing === null)
|
|
1719
|
-
checkConditions.last = captureCheckConditions({ repo, head: sealedHead, command: configured, access: checkLaunchOf(store, runId, captured.effective.profile).access, envNames: SETUP_ENV_ALLOWLIST });
|
|
1720
|
-
const result = missing !== null
|
|
1721
|
-
? { code: 127, stdout: "", stderr: `Toolroll did not start the check: ${missing} wasn't found.`, timedOut: false, notFound: false }
|
|
1722
|
-
: await underStopWatch(store, runId, () => {
|
|
1723
|
-
loadWatch?.attemptStarted();
|
|
1724
|
-
return runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, verifyRunner)), verifyShell.file, verifyShell.args, {
|
|
1725
|
-
cwd: worktree,
|
|
1726
|
-
timeoutMs: loadWatch?.limitMs ?? configured.timeoutMs,
|
|
1727
|
-
processGroup: true,
|
|
1728
|
-
owner: runOwnerTag(store, runId),
|
|
1729
|
-
beforeSpawn: () => !stopRequestedFor(store, runId, request.shouldStop),
|
|
1730
|
-
onSpawn: pid => {
|
|
1731
|
-
request.onProviderSpawn?.(pid);
|
|
1732
|
-
if (stopRequestedFor(store, runId, request.shouldStop))
|
|
1733
|
-
throw new Error("the attempt was stopped before spawn custody completed");
|
|
1734
|
-
},
|
|
1735
|
-
envAllowlist: SETUP_ENV_ALLOWLIST,
|
|
1736
|
-
omitEnv: SETUP_ENV_DENYLIST,
|
|
1737
|
-
...(checkAttempt === null ? {} : { stdin: checkAttempt.stdin }),
|
|
1738
|
-
onStdout: chunk => { streamed.stdout = true; checkProgress.feed(chunk, "stdout"); },
|
|
1739
|
-
onStderr: chunk => { streamed.stderr = true; checkProgress.feed(chunk, "stderr"); },
|
|
1740
|
-
}).finally(() => loadWatch?.attemptEnded());
|
|
1741
|
-
});
|
|
1742
|
-
if (missing !== null)
|
|
1743
|
-
unstartedChecks.set(result, missing);
|
|
1744
|
-
if (!streamed.stdout)
|
|
1745
|
-
checkProgress.feed(result.stdout, "stdout");
|
|
1746
|
-
if (!streamed.stderr)
|
|
1747
|
-
checkProgress.feed(result.stderr, "stderr");
|
|
1748
|
-
checkProgress.feed("\n", "stdout");
|
|
1749
|
-
checkProgress.feed("\n", "stderr");
|
|
1750
|
-
checkOutcomes.push(attemptOutcome(label, result));
|
|
1751
|
-
noteCheckSuite(label, result);
|
|
1752
|
-
checkLog.push(attemptLog(label, configured.command, result));
|
|
1753
|
-
verification.last = result;
|
|
1754
|
-
return result;
|
|
1697
|
+
if (deployCleanupProblem === null && existsSync(dir))
|
|
1698
|
+
deployCleanupProblem = `its copy of this computer's database is still at ${dir}`;
|
|
1699
|
+
if (deployCleanupProblem !== null)
|
|
1700
|
+
recordCheckNote(`The deploy check has no result: ${deployCleanupProblem}.`);
|
|
1755
1701
|
};
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
}));
|
|
1785
|
-
checkOutcomes.push(attemptOutcome(label, installed));
|
|
1786
|
-
noteCheckSuite(label, installed);
|
|
1787
|
-
checkLog.push(attemptLog(label, live.command, installed));
|
|
1788
|
-
if (installed.notFound || installed.timedOut || installed.code !== 0)
|
|
1789
|
-
return "own-install-failed";
|
|
1790
|
-
return await sealedTreeState(buildCheckoutGit(request.git ?? run, worktree)) === "clean" ? null : "setup-changed-files";
|
|
1791
|
-
};
|
|
1792
|
-
const ownInstall = baselineUnverifiable === null ? await ownInstallIfChanged() : null;
|
|
1793
|
-
const missingProgram = configured.recoverySetupDigest === null ? null : approvedProgramMissing(configured.command, worktree, process.env["PATH"]);
|
|
1794
|
-
const first = baselineUnverifiable === null && ownInstall === null ? await runVerification("Project check · attempt 1", missingProgram) : null;
|
|
1795
|
-
if (first === null) {
|
|
1796
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: baselineUnverifiable !== null ? "baseline-unverifiable" : ownInstall ?? "own-install-failed" };
|
|
1797
|
-
}
|
|
1798
|
-
else if (first.notFound || first.timedOut) {
|
|
1799
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: first.timedOut ? "timed-out" : "spawn-failed" };
|
|
1800
|
-
}
|
|
1801
|
-
else if (first.stoppedByPlane === true) {
|
|
1802
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "stopped-by-toolroll" };
|
|
1803
|
-
}
|
|
1804
|
-
else if (!launchFailedBeforeCheck(first, checkAttempt?.nonce ?? null, missingProgram)) {
|
|
1805
|
-
verifyCommand = { configured: true, ran: true, exitCode: first.code };
|
|
1806
|
-
}
|
|
1807
|
-
else {
|
|
1808
|
-
const recoveryDigest = configured.recoverySetupDigest;
|
|
1809
|
-
const liveRecoverySetup = () => {
|
|
1810
|
-
if (repo === null || recoveryDigest === null)
|
|
1811
|
-
return null;
|
|
1812
|
-
const liveVerify = store.liveVerifyCommand(configured.repo);
|
|
1813
|
-
const liveSetup = store.liveWorktreeSetup(repo);
|
|
1814
|
-
return liveVerify !== null &&
|
|
1815
|
-
liveVerify.digest === configured.digest &&
|
|
1816
|
-
liveVerify.recoverySetupDigest === recoveryDigest &&
|
|
1817
|
-
liveSetup !== null &&
|
|
1818
|
-
liveSetup.digest === recoveryDigest
|
|
1819
|
-
? liveSetup
|
|
1820
|
-
: null;
|
|
1821
|
-
};
|
|
1822
|
-
const setup = liveRecoverySetup();
|
|
1823
|
-
if (recoveryDigest === null) {
|
|
1824
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "dependency-missing" };
|
|
1825
|
-
}
|
|
1826
|
-
else if (setup === null || setup.digest !== recoveryDigest) {
|
|
1827
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-stale" };
|
|
1828
|
-
}
|
|
1829
|
-
else if (!store.proveRunnerCustodyForSpawn(runId, now())) {
|
|
1830
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "custody-lost" };
|
|
1702
|
+
try {
|
|
1703
|
+
const verifyRunner = request.verify ?? run;
|
|
1704
|
+
const verifyShell = approvedCommandShell(configured.command);
|
|
1705
|
+
let baselineUnverifiable = null;
|
|
1706
|
+
const deployCheck = repo !== null && chosenCheck?.level === "full" && purposeCheckMode(store.getScope(request.taskId)?.releaseCheck) === "deploy";
|
|
1707
|
+
if (deployCheck) {
|
|
1708
|
+
const access = checkLaunchOf(store, runId, captured.effective.profile).access;
|
|
1709
|
+
loadWatch = new CheckLoadWatch(configured.timeoutMs, request.machine === undefined ? {} : { sample: request.machine });
|
|
1710
|
+
try {
|
|
1711
|
+
const live = store.databaseFile();
|
|
1712
|
+
if (live === null)
|
|
1713
|
+
throw new Error("this plane's database has no file to copy");
|
|
1714
|
+
deployCopyDir = mkdtempSync(join(realpathSync(tmpdir()), "toolroll-deploy-check-"));
|
|
1715
|
+
chmodSync(deployCopyDir, 0o700);
|
|
1716
|
+
const copy = join(deployCopyDir, "orders.db");
|
|
1717
|
+
await (await import("./backup.js")).onlineCopy(live, copy);
|
|
1718
|
+
checkAttempt = prepareCheckAttempt(store, root, { runId, repo: repo, head: sealedHead, command: configured, access, authority: null, watch: [], release: true, limitMs: loadWatch.limitMs, deploy: { copy } }, now());
|
|
1719
|
+
if (checkAttempt === null)
|
|
1720
|
+
throw new Error("the release commit couldn't be read, so the deploy check couldn't be sealed");
|
|
1721
|
+
store.addRunNote(runId, "Toolroll", "The deploy check: build this commit, upgrade a copy of this computer's database with it and start it against that copy.", now());
|
|
1722
|
+
}
|
|
1723
|
+
catch (error) {
|
|
1724
|
+
checkAttempt = null;
|
|
1725
|
+
baselineUnverifiable = `The deploy check couldn't be prepared: ${error instanceof Error ? error.message : String(error)}.`;
|
|
1726
|
+
recordCheckNote(baselineUnverifiable);
|
|
1727
|
+
loadWatch.finish();
|
|
1728
|
+
loadWatch = null;
|
|
1729
|
+
}
|
|
1831
1730
|
}
|
|
1832
|
-
else {
|
|
1833
|
-
const
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1731
|
+
else if (repo !== null && chosenCheck?.level === "full" && (store.getScope(request.taskId)?.candidate ?? null) !== null) {
|
|
1732
|
+
const access = checkLaunchOf(store, runId, captured.effective.profile).access;
|
|
1733
|
+
const decision = planTargetedRecheck(store, root, { runId, taskId: request.taskId, repo, head: sealedHead, command: configured, access, now: now() });
|
|
1734
|
+
const release = decision.authority !== null || releaseCheckScope(store.getScope(request.taskId));
|
|
1735
|
+
loadWatch = new CheckLoadWatch(configured.timeoutMs, request.machine === undefined ? {} : { sample: request.machine });
|
|
1736
|
+
try {
|
|
1737
|
+
checkAttempt = prepareCheckAttempt(store, root, { runId, repo, head: sealedHead, command: configured, access, authority: decision.authority, limitMs: loadWatch?.limitMs,
|
|
1738
|
+
...(decision.mode === "targeted" ? { plan: decision.plan, snapshot: decision.snapshot } : {}), watch: decision.watch, release,
|
|
1739
|
+
learn: learnRequestFor(store, repo, now(), runId).learn }, now());
|
|
1838
1740
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1741
|
+
catch (error) {
|
|
1742
|
+
if (!(error instanceof CheckBaselineUnverifiable))
|
|
1743
|
+
throw error;
|
|
1744
|
+
checkAttempt = null;
|
|
1745
|
+
baselineUnverifiable = error.message;
|
|
1746
|
+
recordCheckNote(error.message);
|
|
1842
1747
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1748
|
+
if (checkAttempt === null && loadWatch !== null) {
|
|
1749
|
+
loadWatch.finish();
|
|
1750
|
+
loadWatch = null;
|
|
1846
1751
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1752
|
+
if (loadWatch !== null && loadWatch.limitMs !== configured.timeoutMs)
|
|
1753
|
+
store.addRunNote(runId, "Toolroll", `The release check's time limit: ${loadWatch.why}.`, now());
|
|
1754
|
+
if (checkAttempt !== null && decision.mode === "targeted")
|
|
1755
|
+
store.addRunNote(runId, "Toolroll", `Re-running only what failed at run #${decision.plan.base}: ${decision.plan.units.length} unit files, ${decision.plan.groups.reduce((n, one) => n + one.groups.length, 0)} journey groups, ${decision.plan.versions.length} upgrade versions${decision.plan.parts.length > 0 ? `, and in full: ${decision.plan.parts.join(", ")}` : ""}.`, now());
|
|
1756
|
+
}
|
|
1757
|
+
else
|
|
1758
|
+
checkAttempt = null;
|
|
1759
|
+
const progressWrites = coalescedProgressWriter(snapshot => { store.saveCheckProgress(runId, snapshot, now()); });
|
|
1760
|
+
const checkProgress = new CheckProgressTracker(snapshot => progressWrites.push(snapshot));
|
|
1761
|
+
const runVerification = async (label, missing = null) => {
|
|
1762
|
+
const streamed = { stdout: false, stderr: false };
|
|
1763
|
+
if (missing === null)
|
|
1764
|
+
checkConditions.last = captureCheckConditions({ repo, head: sealedHead, command: configured, access: checkLaunchOf(store, runId, captured.effective.profile).access, envNames: SETUP_ENV_ALLOWLIST });
|
|
1765
|
+
const result = missing !== null
|
|
1766
|
+
? { code: 127, stdout: "", stderr: `Toolroll did not start the check: ${missing} wasn't found.`, timedOut: false, notFound: false }
|
|
1767
|
+
: await underStopWatch(store, runId, () => {
|
|
1768
|
+
loadWatch?.attemptStarted();
|
|
1769
|
+
return runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, verifyRunner)), verifyShell.file, verifyShell.args, {
|
|
1861
1770
|
cwd: worktree,
|
|
1862
|
-
timeoutMs:
|
|
1771
|
+
timeoutMs: loadWatch?.limitMs ?? configured.timeoutMs,
|
|
1863
1772
|
processGroup: true,
|
|
1864
1773
|
owner: runOwnerTag(store, runId),
|
|
1865
1774
|
beforeSpawn: () => !stopRequestedFor(store, runId, request.shouldStop),
|
|
@@ -1870,86 +1779,227 @@ async function settleProof(captured, statArtifactId, sealedHead) {
|
|
|
1870
1779
|
},
|
|
1871
1780
|
envAllowlist: SETUP_ENV_ALLOWLIST,
|
|
1872
1781
|
omitEnv: SETUP_ENV_DENYLIST,
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1782
|
+
...(checkAttempt === null ? {} : { stdin: checkAttempt.stdin }),
|
|
1783
|
+
onStdout: chunk => { streamed.stdout = true; checkProgress.feed(chunk, "stdout"); },
|
|
1784
|
+
onStderr: chunk => { streamed.stderr = true; checkProgress.feed(chunk, "stderr"); },
|
|
1785
|
+
}).finally(() => loadWatch?.attemptEnded());
|
|
1786
|
+
});
|
|
1787
|
+
if (missing !== null)
|
|
1788
|
+
unstartedChecks.set(result, missing);
|
|
1789
|
+
if (!streamed.stdout)
|
|
1790
|
+
checkProgress.feed(result.stdout, "stdout");
|
|
1791
|
+
if (!streamed.stderr)
|
|
1792
|
+
checkProgress.feed(result.stderr, "stderr");
|
|
1793
|
+
checkProgress.feed("\n", "stdout");
|
|
1794
|
+
checkProgress.feed("\n", "stderr");
|
|
1795
|
+
checkOutcomes.push(attemptOutcome(label, result));
|
|
1796
|
+
noteCheckSuite(label, result);
|
|
1797
|
+
checkLog.push(attemptLog(label, configured.command, result));
|
|
1798
|
+
verification.last = result;
|
|
1799
|
+
return result;
|
|
1800
|
+
};
|
|
1801
|
+
const ownInstallIfChanged = async () => {
|
|
1802
|
+
const depsRoot = sharedDepsRootOf(store);
|
|
1803
|
+
if (depsRoot === null || repo === null)
|
|
1804
|
+
return null;
|
|
1805
|
+
const linked = linkedKey(worktree, depsRoot);
|
|
1806
|
+
const live = linked === null ? null : store.liveWorktreeSetup(repo);
|
|
1807
|
+
if (linked === null || live === null)
|
|
1808
|
+
return null;
|
|
1809
|
+
if (sharingFor({ repo, worktree, setup: live, root: depsRoot })?.key === linked && readyCopy(depsRoot, linked) !== null)
|
|
1810
|
+
return null;
|
|
1811
|
+
if (!store.proveRunnerCustodyForSpawn(runId, now()))
|
|
1812
|
+
return "custody-lost";
|
|
1813
|
+
detachShared(worktree, depsRoot);
|
|
1814
|
+
const label = "Own install · approved project setup (package.json or lockfile changed)";
|
|
1815
|
+
const setupShell = approvedCommandShell(live.command);
|
|
1816
|
+
const installed = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, request.setup ?? run)), setupShell.file, setupShell.args, {
|
|
1817
|
+
cwd: worktree,
|
|
1818
|
+
timeoutMs: live.timeoutMs,
|
|
1819
|
+
processGroup: true,
|
|
1820
|
+
owner: runOwnerTag(store, runId),
|
|
1821
|
+
beforeSpawn: () => !stopRequestedFor(store, runId, request.shouldStop),
|
|
1822
|
+
onSpawn: pid => {
|
|
1823
|
+
request.onProviderSpawn?.(pid);
|
|
1824
|
+
if (stopRequestedFor(store, runId, request.shouldStop))
|
|
1825
|
+
throw new Error("the attempt was stopped before spawn custody completed");
|
|
1826
|
+
},
|
|
1827
|
+
envAllowlist: SETUP_ENV_ALLOWLIST,
|
|
1828
|
+
omitEnv: SETUP_ENV_DENYLIST,
|
|
1829
|
+
}));
|
|
1830
|
+
checkOutcomes.push(attemptOutcome(label, installed));
|
|
1831
|
+
noteCheckSuite(label, installed);
|
|
1832
|
+
checkLog.push(attemptLog(label, live.command, installed));
|
|
1833
|
+
if (installed.notFound || installed.timedOut || installed.code !== 0)
|
|
1834
|
+
return "own-install-failed";
|
|
1835
|
+
return await sealedTreeState(buildCheckoutGit(request.git ?? run, worktree)) === "clean" ? null : "setup-changed-files";
|
|
1836
|
+
};
|
|
1837
|
+
const ownInstall = baselineUnverifiable === null ? await ownInstallIfChanged() : null;
|
|
1838
|
+
const missingProgram = configured.recoverySetupDigest === null ? null : approvedProgramMissing(configured.command, worktree, process.env["PATH"]);
|
|
1839
|
+
const first = baselineUnverifiable === null && ownInstall === null ? await runVerification("Project check · attempt 1", missingProgram) : null;
|
|
1840
|
+
if (first === null) {
|
|
1841
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: baselineUnverifiable !== null ? "baseline-unverifiable" : ownInstall ?? "own-install-failed" };
|
|
1842
|
+
}
|
|
1843
|
+
else if (first.notFound || first.timedOut) {
|
|
1844
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: first.timedOut ? "timed-out" : "spawn-failed" };
|
|
1845
|
+
}
|
|
1846
|
+
else if (first.stoppedByPlane === true) {
|
|
1847
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "stopped-by-toolroll" };
|
|
1848
|
+
}
|
|
1849
|
+
else if (!launchFailedBeforeCheck(first, checkAttempt?.nonce ?? null, missingProgram)) {
|
|
1850
|
+
verifyCommand = { configured: true, ran: true, exitCode: first.code };
|
|
1851
|
+
}
|
|
1852
|
+
else {
|
|
1853
|
+
const recoveryDigest = configured.recoverySetupDigest;
|
|
1854
|
+
const liveRecoverySetup = () => {
|
|
1855
|
+
if (repo === null || recoveryDigest === null)
|
|
1856
|
+
return null;
|
|
1857
|
+
const liveVerify = store.liveVerifyCommand(configured.repo);
|
|
1858
|
+
const liveSetup = store.liveWorktreeSetup(repo);
|
|
1859
|
+
return liveVerify !== null &&
|
|
1860
|
+
liveVerify.digest === configured.digest &&
|
|
1861
|
+
liveVerify.recoverySetupDigest === recoveryDigest &&
|
|
1862
|
+
liveSetup !== null &&
|
|
1863
|
+
liveSetup.digest === recoveryDigest
|
|
1864
|
+
? liveSetup
|
|
1865
|
+
: null;
|
|
1866
|
+
};
|
|
1867
|
+
const setup = liveRecoverySetup();
|
|
1868
|
+
if (recoveryDigest === null) {
|
|
1869
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "dependency-missing" };
|
|
1870
|
+
}
|
|
1871
|
+
else if (setup === null || setup.digest !== recoveryDigest) {
|
|
1872
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-stale" };
|
|
1873
|
+
}
|
|
1874
|
+
else if (!store.proveRunnerCustodyForSpawn(runId, now())) {
|
|
1875
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "custody-lost" };
|
|
1876
|
+
}
|
|
1877
|
+
else {
|
|
1878
|
+
const gitRunner = buildCheckoutGit(request.git ?? run, worktree);
|
|
1879
|
+
const beforeSetup = await sealedTreeState(gitRunner);
|
|
1880
|
+
if (beforeSetup === "head-moved") {
|
|
1881
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "checkout-moved" };
|
|
1882
|
+
recordCheckNote("Automatic recovery stopped before setup because HEAD no longer matched the built commit.");
|
|
1883
|
+
}
|
|
1884
|
+
else if (beforeSetup === "unavailable") {
|
|
1885
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "cleanliness-unavailable" };
|
|
1886
|
+
recordCheckNote("Automatic recovery stopped before setup because checkout cleanliness could not be confirmed.");
|
|
1887
|
+
}
|
|
1888
|
+
else if (beforeSetup === "changed") {
|
|
1889
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "tracked-files-changed" };
|
|
1890
|
+
recordCheckNote("Automatic recovery stopped before setup because tracked files no longer matched the built commit.");
|
|
1891
|
+
}
|
|
1892
|
+
else {
|
|
1893
|
+
const liveBeforeSetup = liveRecoverySetup();
|
|
1894
|
+
if (liveBeforeSetup === null) {
|
|
1895
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-stale" };
|
|
1896
|
+
recordCheckNote("Automatic recovery stopped before setup because its approval changed.");
|
|
1897
|
+
}
|
|
1898
|
+
else if (!store.proveRunnerCustodyForSpawn(runId, now())) {
|
|
1899
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "custody-lost" };
|
|
1900
|
+
recordCheckNote("Automatic recovery stopped before setup: this worker no longer owned the build.");
|
|
1879
1901
|
}
|
|
1880
1902
|
else {
|
|
1881
|
-
const
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1903
|
+
const setupRunner = request.setup ?? run;
|
|
1904
|
+
const setupShell = approvedCommandShell(liveBeforeSetup.command);
|
|
1905
|
+
const restored = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, setupRunner)), setupShell.file, setupShell.args, {
|
|
1906
|
+
cwd: worktree,
|
|
1907
|
+
timeoutMs: liveBeforeSetup.timeoutMs,
|
|
1908
|
+
processGroup: true,
|
|
1909
|
+
owner: runOwnerTag(store, runId),
|
|
1910
|
+
beforeSpawn: () => !stopRequestedFor(store, runId, request.shouldStop),
|
|
1911
|
+
onSpawn: pid => {
|
|
1912
|
+
request.onProviderSpawn?.(pid);
|
|
1913
|
+
if (stopRequestedFor(store, runId, request.shouldStop))
|
|
1914
|
+
throw new Error("the attempt was stopped before spawn custody completed");
|
|
1915
|
+
},
|
|
1916
|
+
envAllowlist: SETUP_ENV_ALLOWLIST,
|
|
1917
|
+
omitEnv: SETUP_ENV_DENYLIST,
|
|
1918
|
+
}));
|
|
1919
|
+
checkOutcomes.push(attemptOutcome("Automatic recovery · approved project setup", restored));
|
|
1920
|
+
noteCheckSuite("Automatic recovery · approved project setup", restored);
|
|
1921
|
+
checkLog.push(attemptLog("Automatic recovery · approved project setup", liveBeforeSetup.command, restored));
|
|
1922
|
+
if (restored.notFound || restored.timedOut || restored.code !== 0) {
|
|
1923
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-failed" };
|
|
1901
1924
|
}
|
|
1902
1925
|
else {
|
|
1903
|
-
const
|
|
1904
|
-
if (
|
|
1905
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "
|
|
1926
|
+
const afterSetup = await sealedTreeState(gitRunner);
|
|
1927
|
+
if (afterSetup === "head-moved") {
|
|
1928
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "checkout-moved" };
|
|
1929
|
+
recordCheckNote("Automatic recovery stopped: setup moved HEAD away from the built commit.");
|
|
1930
|
+
}
|
|
1931
|
+
else if (afterSetup === "unavailable") {
|
|
1932
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "cleanliness-unavailable" };
|
|
1933
|
+
recordCheckNote("Automatic recovery stopped after setup because checkout cleanliness could not be confirmed.");
|
|
1906
1934
|
}
|
|
1907
|
-
else if (
|
|
1908
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "
|
|
1935
|
+
else if (afterSetup === "changed") {
|
|
1936
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-changed-files" };
|
|
1937
|
+
recordCheckNote("Automatic recovery stopped: setup changed tracked files after the build.");
|
|
1909
1938
|
}
|
|
1910
|
-
else if (
|
|
1911
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "
|
|
1939
|
+
else if (!store.proveRunnerCustodyForSpawn(runId, now())) {
|
|
1940
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "custody-lost" };
|
|
1941
|
+
recordCheckNote("Automatic recovery stopped before retry: this worker no longer owned the build.");
|
|
1942
|
+
}
|
|
1943
|
+
else if (liveRecoverySetup() === null) {
|
|
1944
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "setup-stale" };
|
|
1945
|
+
recordCheckNote("Automatic recovery stopped before retry because its approval changed.");
|
|
1912
1946
|
}
|
|
1913
1947
|
else {
|
|
1914
|
-
|
|
1948
|
+
const retried = await runVerification("Project check · retry after setup");
|
|
1949
|
+
if (retried.timedOut) {
|
|
1950
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "retry-timed-out" };
|
|
1951
|
+
}
|
|
1952
|
+
else if (retried.notFound) {
|
|
1953
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "retry-spawn-failed" };
|
|
1954
|
+
}
|
|
1955
|
+
else if (verificationExecutableMissing(retried)) {
|
|
1956
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "dependency-still-missing" };
|
|
1957
|
+
}
|
|
1958
|
+
else {
|
|
1959
|
+
verifyCommand = { configured: true, ran: true, exitCode: retried.code, setupReplayed: true, firstAttempt: { class: "launch", program: missingProgram, exitCode: first.code } };
|
|
1960
|
+
}
|
|
1915
1961
|
}
|
|
1916
1962
|
}
|
|
1917
1963
|
}
|
|
1918
1964
|
}
|
|
1919
1965
|
}
|
|
1920
1966
|
}
|
|
1921
|
-
|
|
1922
|
-
try {
|
|
1923
|
-
checkProgress.finish();
|
|
1924
|
-
}
|
|
1925
|
-
catch { }
|
|
1926
|
-
if (loadWatch !== null) {
|
|
1927
|
-
const record = loadWatch.finish();
|
|
1967
|
+
removeDeployCopy();
|
|
1928
1968
|
try {
|
|
1929
|
-
|
|
1969
|
+
checkProgress.finish();
|
|
1930
1970
|
}
|
|
1931
|
-
catch
|
|
1932
|
-
|
|
1971
|
+
catch { }
|
|
1972
|
+
if (loadWatch !== null) {
|
|
1973
|
+
const record = loadWatch.finish();
|
|
1974
|
+
try {
|
|
1975
|
+
sealJson(store, root, runId, "check-load.json", record, CHECK_LOAD_CAPTURE, now());
|
|
1976
|
+
}
|
|
1977
|
+
catch (error) {
|
|
1978
|
+
store.addRunNote(runId, "Toolroll", `This check's load record wasn't kept (${redactSecretText(error instanceof Error ? error.message : String(error))}), so a timeout in it can't be called the machine's own.`, now());
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
if (!progressWrites.flush())
|
|
1982
|
+
progressWrites.flush();
|
|
1983
|
+
const last = verification.last;
|
|
1984
|
+
let sealedReport = null;
|
|
1985
|
+
if (checkAttempt !== null && last !== null && !last.notFound) {
|
|
1986
|
+
sealedReport = settledReport = sealCheckOutcome(store, root, checkAttempt, { stdout: last.stdout, exitCode: last.timedOut ? null : last.code }, now());
|
|
1987
|
+
keepCheckTimeline(store, { runId, taskId: request.taskId, report: sealedReport, stdout: last.stdout, now: now() });
|
|
1988
|
+
}
|
|
1989
|
+
if (checkAttempt !== null) {
|
|
1990
|
+
const settled = settleCoverage(store, root, { runId, taskId: request.taskId, exitCode: last === null || last.notFound || last.timedOut ? null : last.code, now: now() }, run => { const gate = verificationEvidence(store, root, run); return gate.ok ? gate.digest : null; });
|
|
1991
|
+
const sha = (capture) => { const found = store.artifactsFor(runId).filter(a => a.kind === "structured-output" && a.capture === capture); return found.length === 1 ? found[0].sha256 : null; };
|
|
1992
|
+
const effective = effectiveCheckFacts(verifyCommand, { coverage: deployCleanupProblem !== null ? "no-result" : settled.coverage, check: { attempt: checkAttempt.mode === "deploy" ? "full" : checkAttempt.mode, report: sha(CHECK_REPORT_CAPTURE), inventory: sha(CHECK_INVENTORY_CAPTURE), retried: retriedInside(sealedReport) }, composed: settled.composed });
|
|
1993
|
+
verifyCommand = effective.result;
|
|
1994
|
+
releaseFacts = effective.facts;
|
|
1995
|
+
}
|
|
1996
|
+
else if (verifyCommand.configured && verifyCommand.ran && chosenCheck?.level === "full" && releaseCheckScope(store.getScope(request.taskId))) {
|
|
1997
|
+
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "no-result" };
|
|
1998
|
+
recordCheckNote("The release check ran without a sealed attempt (its commit couldn't be read before it ran), so it has no result that can count.");
|
|
1933
1999
|
}
|
|
1934
2000
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
const last = verification.last;
|
|
1938
|
-
let sealedReport = null;
|
|
1939
|
-
if (checkAttempt !== null && last !== null && !last.notFound) {
|
|
1940
|
-
sealedReport = settledReport = sealCheckOutcome(store, root, checkAttempt, { stdout: last.stdout, exitCode: last.timedOut ? null : last.code }, now());
|
|
1941
|
-
keepCheckTimeline(store, { runId, taskId: request.taskId, report: sealedReport, stdout: last.stdout, now: now() });
|
|
1942
|
-
}
|
|
1943
|
-
if (checkAttempt !== null) {
|
|
1944
|
-
const settled = settleCoverage(store, root, { runId, taskId: request.taskId, exitCode: last === null || last.notFound || last.timedOut ? null : last.code, now: now() }, run => { const gate = verificationEvidence(store, root, run); return gate.ok ? gate.digest : null; });
|
|
1945
|
-
const sha = (capture) => { const found = store.artifactsFor(runId).filter(a => a.kind === "structured-output" && a.capture === capture); return found.length === 1 ? found[0].sha256 : null; };
|
|
1946
|
-
const effective = effectiveCheckFacts(verifyCommand, { coverage: settled.coverage, check: { attempt: checkAttempt.mode, report: sha(CHECK_REPORT_CAPTURE), inventory: sha(CHECK_INVENTORY_CAPTURE), retried: retriedInside(sealedReport) }, composed: settled.composed });
|
|
1947
|
-
verifyCommand = effective.result;
|
|
1948
|
-
releaseFacts = effective.facts;
|
|
1949
|
-
}
|
|
1950
|
-
else if (verifyCommand.configured && verifyCommand.ran && chosenCheck?.level === "full" && releaseCheckScope(store.getScope(request.taskId))) {
|
|
1951
|
-
verifyCommand = { configured: true, ran: false, attemptFailed: true, failure: "no-result" };
|
|
1952
|
-
recordCheckNote("The release check ran without a sealed attempt (its commit couldn't be read before it ran), so it has no result that can count.");
|
|
2001
|
+
finally {
|
|
2002
|
+
removeDeployCopy();
|
|
1953
2003
|
}
|
|
1954
2004
|
}
|
|
1955
2005
|
if (configured !== null && checkLog.length > 0) {
|
|
@@ -1968,7 +2018,7 @@ async function settleProof(captured, statArtifactId, sealedHead) {
|
|
|
1968
2018
|
}
|
|
1969
2019
|
if (configured !== null && checkLog.length > 0)
|
|
1970
2020
|
sealVerificationReceipt(store, root, runId, sealedHead, configured, verifyCommand, now(), undefined, releaseFacts ?? undefined);
|
|
1971
|
-
const uncovered = releaseFacts !== null && releaseFacts.coverage
|
|
2021
|
+
const uncovered = releaseFacts !== null && !coveragePasses(releaseFacts.coverage);
|
|
1972
2022
|
const checkStatus = verifyCommand.configured === false ? "not-run"
|
|
1973
2023
|
: uncovered ? "failed"
|
|
1974
2024
|
: verifyCommand.ran ? verifyCommand.exitCode === 0 ? "passed" : "failed"
|
|
@@ -6,9 +6,9 @@ import { openStore } from "./store.js";
|
|
|
6
6
|
import { holdAutoPublish, autoPublishHeld, PUBLISH_ALLOWED_ACTION, PUBLISH_HELD_ACTION } from "./release-auto.js";
|
|
7
7
|
import { revokeCoordinator } from "./coordinator.js";
|
|
8
8
|
export const MAX_STAGE_BYTES = 128 * 1024 * 1024;
|
|
9
|
-
const SUPPORTED_SCHEMA =
|
|
10
|
-
const SCHEMA_OBJECT_COUNT =
|
|
11
|
-
const SCHEMA_DIGEST = "
|
|
9
|
+
const SUPPORTED_SCHEMA = 185;
|
|
10
|
+
const SCHEMA_OBJECT_COUNT = 726;
|
|
11
|
+
const SCHEMA_DIGEST = "8e589635cf648eef4a4c85fb12c614b3c004d983df639ccd2bf95b3005bf5791";
|
|
12
12
|
const INVENTORY = [
|
|
13
13
|
["person-credentials", "store.ts:revokeApiToken", "credential", true],
|
|
14
14
|
["lead-credentials", "store.ts:revokeLeadCredentials", "credential", true],
|