@attalabs/vinaya 0.40.0 → 0.41.0
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/aeg-root/contracts/developer-reviewer.md +2 -2
- package/aeg-root/contracts/planner-developer.md +4 -4
- package/aeg-root/process.md +3 -3
- package/aeg-root/roles/developer/reference.md +3 -0
- package/aeg-root/state-machine.md +2 -2
- package/aeg-root/templates/brief-template.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +165 -65
- package/dist/checks/bin/check-branch-topology.js +169 -60
- package/dist/checks/bin/check-brief-shape.js +165 -65
- package/dist/checks/bin/check-changeset-coverage.js +342 -122
- package/dist/checks/bin/check-ci-shard-coverage.js +384 -130
- package/dist/checks/bin/check-closes-n.js +169 -60
- package/dist/checks/bin/check-coherence.js +165 -65
- package/dist/checks/bin/check-dead-branch-push.js +142 -59
- package/dist/checks/bin/check-dispatch-readiness.js +211 -81
- package/dist/checks/bin/check-doc-claims.js +165 -65
- package/dist/checks/bin/check-doc-coverage-push.js +342 -122
- package/dist/checks/bin/check-doc-coverage.js +344 -124
- package/dist/checks/bin/check-doctrine-no-procedures.js +165 -65
- package/dist/checks/bin/check-doctrine-portability.js +342 -122
- package/dist/checks/bin/check-evidence-fresh.js +376 -129
- package/dist/checks/bin/check-exec-bits.js +342 -122
- package/dist/checks/bin/check-first-push-dispatch.js +208 -78
- package/dist/checks/bin/check-issue-milestone-attach.js +142 -59
- package/dist/checks/bin/check-issue-objectives-numbering.js +165 -65
- package/dist/checks/bin/check-issue-parts-coverage.js +142 -59
- package/dist/checks/bin/check-issue-surface-globs.js +218 -88
- package/dist/checks/bin/check-issue-title-grammar.js +142 -59
- package/dist/checks/bin/check-main-branch-refusal.js +142 -59
- package/dist/checks/bin/check-no-disk-state.js +142 -59
- package/dist/checks/bin/check-pr-premise-reassert.js +165 -65
- package/dist/checks/bin/check-pr-report-density.js +142 -59
- package/dist/checks/bin/check-principal-test-plan-wait.js +165 -65
- package/dist/checks/bin/check-quoted-command.js +338 -118
- package/dist/checks/bin/check-reader-resolvable-prose.js +338 -118
- package/dist/checks/bin/check-registry-gates.js +206 -78
- package/dist/checks/bin/check-retired-vocabulary.js +338 -118
- package/dist/checks/bin/check-review-gate.js +203 -83
- package/dist/checks/bin/check-single-plan-pr.js +142 -59
- package/dist/checks/bin/check-surface-scope.js +169 -60
- package/dist/checks/bin/check-test-plan.js +165 -65
- package/dist/checks/bin/check-token-collection-wired.js +142 -59
- package/dist/checks/bin/check-workspace-escape.js +340 -120
- package/dist/checks/bin/verify-coherence.js +153 -60
- package/dist/checks/bin/verify-dispatch.js +169 -69
- package/dist/checks/bin/verify-docs.js +142 -57
- package/dist/index.js +16280 -11764
- package/dist/lib/pre-push-cache-test-run.js +791 -68
- package/dist/lib/pre-push-changed-files.js +65 -19
- package/dist/lib/pre-push-mode.js +466 -0
- package/dist/lib/pre-push-progress-dir.js +4205 -0
- package/dist/lib/pre-push-record-tests.js +446 -0
- package/dist/lib/pre-push-select-tests.js +1426 -454
- package/dist/lib/push-progress-observer.js +4213 -0
- package/package.json +11 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +18 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +17 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +13 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +1 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +77 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +221 -56
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +52 -109
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wzfiav._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{38kom-9c-oi65.js → 0x7u6si-ai179.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1p3vr9qts86_b.js → 2fu7mfsj4oima.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{21tunzmxjvm2a.js → 34b4ruddunn3q.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-ci-shard-coverage.ts
|
|
4
|
-
import { execFileSync as
|
|
4
|
+
import { execFileSync as execFileSync9 } from "node:child_process";
|
|
5
5
|
|
|
6
6
|
// src/lib/diff-evidence.ts
|
|
7
|
-
import { execFileSync as
|
|
7
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
8
8
|
import { join as join10, relative as relative2, resolve as resolve2 } from "node:path";
|
|
9
9
|
|
|
10
10
|
// ../../packages/aeg-core/src/entry-point.ts
|
|
@@ -784,10 +784,11 @@ function trancheSlugsFromLabels(labels) {
|
|
|
784
784
|
}
|
|
785
785
|
return slugs;
|
|
786
786
|
}
|
|
787
|
-
async function indexTrancheMilestonesAsync(owner, repo) {
|
|
787
|
+
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
788
|
+
const read = (fetch2) => options.retryFailedReads ? retryOnce(fetch2) : fetch2();
|
|
788
789
|
const [milestones, labels] = await Promise.all([
|
|
789
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
790
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
|
|
790
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
791
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
791
792
|
]);
|
|
792
793
|
const active = [];
|
|
793
794
|
const archived = [];
|
|
@@ -798,9 +799,16 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
798
799
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
799
800
|
const uniqueLegacySlugs = [...legacySlugs];
|
|
800
801
|
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
801
|
-
Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
|
|
802
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
|
|
802
|
+
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
803
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
803
804
|
]);
|
|
805
|
+
const issuesBySlug = new Map;
|
|
806
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
807
|
+
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
808
|
+
});
|
|
809
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
810
|
+
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
811
|
+
});
|
|
804
812
|
uniqueLegacySlugs.forEach((slug, i) => {
|
|
805
813
|
const m = legacyMilestoneBySlug.get(slug);
|
|
806
814
|
if (!m)
|
|
@@ -824,7 +832,14 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
824
832
|
else if (lifecycle === "complete")
|
|
825
833
|
archived.push({ slug, goal });
|
|
826
834
|
});
|
|
827
|
-
return { active, archived, facts, legacySlugs };
|
|
835
|
+
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
836
|
+
}
|
|
837
|
+
async function retryOnce(fetch2) {
|
|
838
|
+
try {
|
|
839
|
+
return await fetch2();
|
|
840
|
+
} catch {
|
|
841
|
+
return fetch2();
|
|
842
|
+
}
|
|
828
843
|
}
|
|
829
844
|
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
830
845
|
const [milestones, labels, issues] = await Promise.all([
|
|
@@ -1869,15 +1884,16 @@ function describeError(err) {
|
|
|
1869
1884
|
}
|
|
1870
1885
|
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1871
1886
|
function defaultPriorTrancheArchivalDeps() {
|
|
1872
|
-
let facts = new Map;
|
|
1873
1887
|
return {
|
|
1874
|
-
|
|
1875
|
-
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1888
|
+
activeTranches: async (excludeSlug, repo) => {
|
|
1889
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
|
|
1890
|
+
return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
|
|
1891
|
+
const issues = index.issuesBySlug?.get(m.slug);
|
|
1892
|
+
if (!issues)
|
|
1893
|
+
throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
|
|
1894
|
+
return { slug: m.slug, issues };
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1881
1897
|
};
|
|
1882
1898
|
}
|
|
1883
1899
|
function reason(err) {
|
|
@@ -1889,61 +1905,28 @@ async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = d
|
|
|
1889
1905
|
return { facts: [], infraFailure: null };
|
|
1890
1906
|
let candidates;
|
|
1891
1907
|
try {
|
|
1892
|
-
candidates = await deps.
|
|
1908
|
+
candidates = await deps.activeTranches(excludeSlug, repo);
|
|
1893
1909
|
} catch (err) {
|
|
1894
1910
|
return {
|
|
1895
1911
|
facts: [],
|
|
1896
1912
|
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1897
1913
|
};
|
|
1898
1914
|
}
|
|
1915
|
+
const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
|
|
1899
1916
|
const facts = [];
|
|
1900
|
-
const unreadable = [];
|
|
1901
|
-
const derived = new Map;
|
|
1902
|
-
const derive = (slug) => {
|
|
1903
|
-
let p = derived.get(slug);
|
|
1904
|
-
if (!p) {
|
|
1905
|
-
p = deps.deriveTranche(slug, repo);
|
|
1906
|
-
derived.set(slug, p);
|
|
1907
|
-
}
|
|
1908
|
-
return p;
|
|
1909
|
-
};
|
|
1910
1917
|
for (const project of projects) {
|
|
1911
1918
|
let found = null;
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
let candidateTranche;
|
|
1915
|
-
try {
|
|
1916
|
-
candidateTranche = await derive(slug);
|
|
1917
|
-
} catch {
|
|
1918
|
-
unknown = true;
|
|
1919
|
-
unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1920
|
-
break;
|
|
1921
|
-
}
|
|
1922
|
-
if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
|
|
1919
|
+
for (const { slug, issues } of candidates) {
|
|
1920
|
+
if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
|
|
1923
1921
|
continue;
|
|
1924
|
-
|
|
1925
|
-
try {
|
|
1926
|
-
openIssues = await deps.openIssues(slug, repo);
|
|
1927
|
-
} catch {
|
|
1928
|
-
openIssues = null;
|
|
1929
|
-
}
|
|
1930
|
-
if (openIssues === null) {
|
|
1931
|
-
unknown = true;
|
|
1932
|
-
unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1933
|
-
break;
|
|
1934
|
-
}
|
|
1935
|
-
if (openIssues.length === 0) {
|
|
1922
|
+
if (!issues.some((issue) => issue.state === "OPEN")) {
|
|
1936
1923
|
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1937
1924
|
break;
|
|
1938
1925
|
}
|
|
1939
1926
|
}
|
|
1940
|
-
|
|
1941
|
-
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1927
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1942
1928
|
}
|
|
1943
|
-
return {
|
|
1944
|
-
facts,
|
|
1945
|
-
infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
|
|
1946
|
-
};
|
|
1929
|
+
return { facts, infraFailure: null };
|
|
1947
1930
|
}
|
|
1948
1931
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1949
1932
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
@@ -2769,11 +2752,13 @@ var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
|
2769
2752
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2770
2753
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2771
2754
|
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2755
|
+
var DEFAULT_READY_PUSH_TIMEOUT_MINUTES = 20;
|
|
2772
2756
|
var DEFAULT_REVIEW_POLICY = {
|
|
2773
2757
|
codeReviewThreshold: "BLOCKER",
|
|
2774
2758
|
securityThreshold: "HIGH",
|
|
2775
2759
|
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2776
|
-
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2760
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES,
|
|
2761
|
+
readyPushTimeoutMinutes: DEFAULT_READY_PUSH_TIMEOUT_MINUTES
|
|
2777
2762
|
};
|
|
2778
2763
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2779
2764
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -6962,7 +6947,17 @@ var HeaderMetaV3Schema = z3.object({
|
|
|
6962
6947
|
runtime: z3.string().nullable(),
|
|
6963
6948
|
source: z3.string().nullable()
|
|
6964
6949
|
}).strict();
|
|
6965
|
-
var
|
|
6950
|
+
var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
|
|
6951
|
+
schema: z3.literal(4),
|
|
6952
|
+
process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
|
|
6953
|
+
runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
|
|
6954
|
+
}).strict();
|
|
6955
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [
|
|
6956
|
+
HeaderMetaV1Schema,
|
|
6957
|
+
HeaderMetaV2Schema,
|
|
6958
|
+
HeaderMetaV3Schema,
|
|
6959
|
+
HeaderMetaV4Schema
|
|
6960
|
+
]);
|
|
6966
6961
|
var SubjectSchema = z3.object({
|
|
6967
6962
|
issue: z3.number().int().nullable(),
|
|
6968
6963
|
pr: z3.number().int().optional(),
|
|
@@ -7182,6 +7177,75 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
|
7182
7177
|
round: z3.number().int(),
|
|
7183
7178
|
phase: z3.string()
|
|
7184
7179
|
}).strict(),
|
|
7180
|
+
z3.object({
|
|
7181
|
+
...loopShared,
|
|
7182
|
+
event: z3.literal("conflict_reentry"),
|
|
7183
|
+
task: z3.number().int(),
|
|
7184
|
+
pr: z3.number().int().positive(),
|
|
7185
|
+
attempt: z3.number().int().positive(),
|
|
7186
|
+
bound: z3.number().int().positive()
|
|
7187
|
+
}).strict(),
|
|
7188
|
+
z3.object({
|
|
7189
|
+
...loopShared,
|
|
7190
|
+
event: z3.literal("storage_push"),
|
|
7191
|
+
round: z3.number().int(),
|
|
7192
|
+
branch: z3.string(),
|
|
7193
|
+
head: z3.string()
|
|
7194
|
+
}).strict(),
|
|
7195
|
+
z3.object({
|
|
7196
|
+
...loopShared,
|
|
7197
|
+
event: z3.literal("local_checks_run"),
|
|
7198
|
+
round: z3.number().int(),
|
|
7199
|
+
head: z3.string().nullable(),
|
|
7200
|
+
passed: z3.boolean(),
|
|
7201
|
+
wall_ms: z3.number().nonnegative()
|
|
7202
|
+
}).strict(),
|
|
7203
|
+
z3.object({
|
|
7204
|
+
...loopShared,
|
|
7205
|
+
event: z3.literal("ready_push"),
|
|
7206
|
+
round: z3.number().int(),
|
|
7207
|
+
head: z3.string(),
|
|
7208
|
+
outcome: z3.enum(["passed", "refused"]),
|
|
7209
|
+
selected: z3.number().int().nonnegative(),
|
|
7210
|
+
failed: z3.number().int().nonnegative(),
|
|
7211
|
+
rerun: z3.boolean(),
|
|
7212
|
+
wall_ms: z3.number().nonnegative()
|
|
7213
|
+
}).strict(),
|
|
7214
|
+
z3.object({
|
|
7215
|
+
...loopShared,
|
|
7216
|
+
event: z3.literal("failed_tests_rerun"),
|
|
7217
|
+
round: z3.number().int(),
|
|
7218
|
+
head: z3.string(),
|
|
7219
|
+
rerun_of: z3.string(),
|
|
7220
|
+
failed_files: z3.number().int().nonnegative(),
|
|
7221
|
+
affected_files: z3.number().int().nonnegative(),
|
|
7222
|
+
full_count: z3.number().int().nonnegative()
|
|
7223
|
+
}).strict(),
|
|
7224
|
+
z3.object({
|
|
7225
|
+
...loopShared,
|
|
7226
|
+
event: z3.literal("pr_opened"),
|
|
7227
|
+
round: z3.number().int(),
|
|
7228
|
+
pr: z3.number().int().positive(),
|
|
7229
|
+
head: z3.string()
|
|
7230
|
+
}).strict(),
|
|
7231
|
+
z3.object({
|
|
7232
|
+
...loopShared,
|
|
7233
|
+
event: z3.literal("ci_result_read"),
|
|
7234
|
+
round: z3.number().int(),
|
|
7235
|
+
pr: z3.number().int().positive(),
|
|
7236
|
+
head: z3.string(),
|
|
7237
|
+
conclusion: z3.enum(["green", "red", "pending", "skipped"]),
|
|
7238
|
+
failing_checks: z3.array(z3.string()),
|
|
7239
|
+
wait_ms: z3.number().nonnegative()
|
|
7240
|
+
}).strict(),
|
|
7241
|
+
z3.object({
|
|
7242
|
+
...loopShared,
|
|
7243
|
+
event: z3.literal("phase_time"),
|
|
7244
|
+
round: z3.number().int(),
|
|
7245
|
+
phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
|
|
7246
|
+
step: z3.string(),
|
|
7247
|
+
wall_ms: z3.number().nonnegative()
|
|
7248
|
+
}).strict(),
|
|
7185
7249
|
z3.object({
|
|
7186
7250
|
...loopShared,
|
|
7187
7251
|
event: z3.literal("driver_exited"),
|
|
@@ -7369,7 +7433,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
|
7369
7433
|
]);
|
|
7370
7434
|
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
7371
7435
|
var customShared = {
|
|
7372
|
-
meta:
|
|
7436
|
+
meta: HeaderMetaSchema,
|
|
7373
7437
|
subject: SubjectSchema,
|
|
7374
7438
|
kind: z3.literal("custom"),
|
|
7375
7439
|
...envelopeTail
|
|
@@ -7454,7 +7518,7 @@ function buildHeader(input) {
|
|
|
7454
7518
|
const issue = subject.issue;
|
|
7455
7519
|
return {
|
|
7456
7520
|
meta: {
|
|
7457
|
-
schema:
|
|
7521
|
+
schema: 4,
|
|
7458
7522
|
ts: input.now.toISOString(),
|
|
7459
7523
|
run_id: input.runId,
|
|
7460
7524
|
seq: input.seq,
|
|
@@ -7491,6 +7555,15 @@ function buildHeader(input) {
|
|
|
7491
7555
|
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
7492
7556
|
},
|
|
7493
7557
|
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
7558
|
+
process: {
|
|
7559
|
+
id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
|
|
7560
|
+
version: lineageFieldFromEnv(input.env.processVersion),
|
|
7561
|
+
digest: lineageFieldFromEnv(input.env.processDigest)
|
|
7562
|
+
},
|
|
7563
|
+
runner: {
|
|
7564
|
+
id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
|
|
7565
|
+
version: lineageFieldFromEnv(input.env.runnerVersion)
|
|
7566
|
+
},
|
|
7494
7567
|
source: lineageFieldFromEnv(input.env.source)
|
|
7495
7568
|
},
|
|
7496
7569
|
subject
|
|
@@ -7534,7 +7607,7 @@ function redact(value, home) {
|
|
|
7534
7607
|
return value;
|
|
7535
7608
|
}
|
|
7536
7609
|
// ../../packages/aeg-core/src/log/store.ts
|
|
7537
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
7610
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3, 4];
|
|
7538
7611
|
function metaOf(obj) {
|
|
7539
7612
|
if (obj === null || typeof obj !== "object")
|
|
7540
7613
|
return null;
|
|
@@ -7758,14 +7831,24 @@ var ResolutionRecordSchema = z4.object({
|
|
|
7758
7831
|
authenticatedFrom: z4.string().min(1),
|
|
7759
7832
|
consumedAt: isoTimestamp
|
|
7760
7833
|
}).strict();
|
|
7834
|
+
var ExecutionRoundMirrorRecordSchema = z4.object({
|
|
7835
|
+
version: z4.literal(1),
|
|
7836
|
+
kind: z4.literal("execution_round"),
|
|
7837
|
+
task: taskId,
|
|
7838
|
+
repository: z4.string().min(1),
|
|
7839
|
+
threadId: z4.string().min(1),
|
|
7840
|
+
checkpointId: z4.string().min(1),
|
|
7841
|
+
round: z4.number().int().positive(),
|
|
7842
|
+
recordedAt: isoTimestamp
|
|
7843
|
+
}).strict();
|
|
7761
7844
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
7762
7845
|
var CONTROL_AREA_DIRNAME = "control";
|
|
7763
7846
|
// src/lib/config.ts
|
|
7764
7847
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
7765
7848
|
import { promisify as promisify4 } from "node:util";
|
|
7766
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7849
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7767
7850
|
import { homedir } from "node:os";
|
|
7768
|
-
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
7851
|
+
import { basename as basename3, dirname, isAbsolute, join, resolve } from "node:path";
|
|
7769
7852
|
import { z as z6 } from "zod";
|
|
7770
7853
|
|
|
7771
7854
|
// src/checks/contract.ts
|
|
@@ -8228,7 +8311,8 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8228
8311
|
codeReviewThreshold: z6.string().min(1).optional(),
|
|
8229
8312
|
securityThreshold: z6.string().min(1).optional(),
|
|
8230
8313
|
maxRounds: z6.number().optional(),
|
|
8231
|
-
maxTaskMinutes: z6.number().optional()
|
|
8314
|
+
maxTaskMinutes: z6.number().optional(),
|
|
8315
|
+
readyPushTimeoutMinutes: z6.number().optional()
|
|
8232
8316
|
}).optional(),
|
|
8233
8317
|
securityScan: z6.object({
|
|
8234
8318
|
command: z6.array(z6.string().min(1)).min(1)
|
|
@@ -8244,7 +8328,16 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8244
8328
|
collisionThreshold: z6.number().int().nonnegative().optional()
|
|
8245
8329
|
}).optional(),
|
|
8246
8330
|
prePush: z6.object({
|
|
8247
|
-
alwaysRun: z6.array(z6.string()).optional()
|
|
8331
|
+
alwaysRun: z6.array(z6.string()).optional(),
|
|
8332
|
+
readyTests: z6.object({
|
|
8333
|
+
mode: z6.literal("ci"),
|
|
8334
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8335
|
+
check: z6.literal("Vinaya CI")
|
|
8336
|
+
}).strict().optional(),
|
|
8337
|
+
requiredCi: z6.object({
|
|
8338
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8339
|
+
check: z6.literal("Vinaya CI")
|
|
8340
|
+
}).strict().optional()
|
|
8248
8341
|
}).optional(),
|
|
8249
8342
|
report: z6.object({
|
|
8250
8343
|
commandTimeoutMs: z6.number().int().positive().optional()
|
|
@@ -8262,6 +8355,7 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8262
8355
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
8263
8356
|
}),
|
|
8264
8357
|
runtimeDir: z6.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
8358
|
+
runner: z6.enum(["standalone", "atta-engine"]).optional(),
|
|
8265
8359
|
logs: z6.object({
|
|
8266
8360
|
folder: z6.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
8267
8361
|
url: z6.string().url().optional(),
|
|
@@ -8274,7 +8368,7 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8274
8368
|
message: "logs: headers requires url"
|
|
8275
8369
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
8276
8370
|
message: "logs: readHeaders requires url"
|
|
8277
|
-
}).optional(),
|
|
8371
|
+
}).or(z6.literal(false)).optional(),
|
|
8278
8372
|
decisionRecords: z6.object({
|
|
8279
8373
|
path: RepoRelativePathSchema
|
|
8280
8374
|
}).strict().optional()
|
|
@@ -8404,13 +8498,19 @@ function resolveReviewPolicy(config) {
|
|
|
8404
8498
|
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
8405
8499
|
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
8406
8500
|
}
|
|
8501
|
+
const readyPushTimeoutMinutes = raw.readyPushTimeoutMinutes ?? DEFAULT_READY_PUSH_TIMEOUT_MINUTES;
|
|
8502
|
+
if (!Number.isInteger(readyPushTimeoutMinutes) || readyPushTimeoutMinutes < 1) {
|
|
8503
|
+
throw new Error(`vinaya.config.json: reviewPolicy.readyPushTimeoutMinutes "${readyPushTimeoutMinutes}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
8504
|
+
}
|
|
8407
8505
|
return {
|
|
8408
8506
|
codeReviewThreshold,
|
|
8409
8507
|
securityThreshold,
|
|
8410
8508
|
maxRounds,
|
|
8411
|
-
maxTaskMinutes
|
|
8509
|
+
maxTaskMinutes,
|
|
8510
|
+
readyPushTimeoutMinutes
|
|
8412
8511
|
};
|
|
8413
8512
|
}
|
|
8513
|
+
var emittedLocalOverrideWarnings = new Set;
|
|
8414
8514
|
function resolveGateCutovers(config) {
|
|
8415
8515
|
const raw = config?.gateCutovers;
|
|
8416
8516
|
if (!raw)
|
|
@@ -8904,7 +9004,7 @@ function resolveNumber(issue, subjectLabel, runner) {
|
|
|
8904
9004
|
}
|
|
8905
9005
|
|
|
8906
9006
|
// src/lib/brief-assembly.ts
|
|
8907
|
-
import { execFileSync as
|
|
9007
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8908
9008
|
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "node:fs";
|
|
8909
9009
|
import { join as join5 } from "node:path";
|
|
8910
9010
|
|
|
@@ -9074,6 +9174,10 @@ var COMMANDS = [
|
|
|
9074
9174
|
needs: ["forge", "operator-seat"],
|
|
9075
9175
|
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
9076
9176
|
flags: [
|
|
9177
|
+
{
|
|
9178
|
+
flag: "--runner <standalone|atta-engine>",
|
|
9179
|
+
description: "Override runner config for this invocation; absent uses config, whose default is standalone"
|
|
9180
|
+
},
|
|
9077
9181
|
{
|
|
9078
9182
|
flag: "--agent <claude|codex>",
|
|
9079
9183
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
@@ -9085,17 +9189,39 @@ var COMMANDS = [
|
|
|
9085
9189
|
{
|
|
9086
9190
|
flag: "--widen-surface <glob,...> --reason <text>",
|
|
9087
9191
|
description: "Continue a pre-pull-request escalation whose Developer asked for `widen_surface`: supersede the frozen brief with the globs added to `## Surface`, record that as the escalation's resolution, grade the widened Issue through the write gate, then start the run"
|
|
9192
|
+
},
|
|
9193
|
+
{
|
|
9194
|
+
flag: "--rollback",
|
|
9195
|
+
description: "Run the terminate-and-restart procedure for this task: cancel its in-flight Engine run, reconcile every prepared and uncertain effect by its identity, then start a fresh standalone run from the same frozen brief. Refuses a task whose recorded runner is not `atta-engine`"
|
|
9088
9196
|
}
|
|
9089
9197
|
],
|
|
9090
9198
|
details: [
|
|
9199
|
+
"The atta-engine runner starts the workspace Engine script with Bun, streams its output and returns its exit code. A published install without the script prints one notice and falls back to standalone. Engine Log events use the local folder only; logs: false disables all Log destinations for both runners.",
|
|
9200
|
+
"A run's runner is recorded when it starts and never changes: switching `runner` in config changes only the runner of new runs, and a run recorded on `atta-engine` keeps routing to the Engine for `task status`, `task_resume` and `task_cancel`. A start on a pause another runner holds is refused with a typed reason naming the recorded runner and the requested one, and so is a start on another runner's Engine run that is still in flight with no pause held — halted or stopped short of completed or cancelled.",
|
|
9201
|
+
"`--rollback` ends the Engine run first: a held pause through the shared cancel `task_cancel` uses, which needs a Principal ruling newer than the pause as any cancel does; a run halted with no pause held has its started effects fenced; a run that already completed or was cancelled is refused, as is a driver still running with no pause held, which is never signalled; and the standalone run never starts while the Engine driver lives, a cancelled run's driver given a bounded wait to release its lock. Every started and uncertain effect is then reconciled by its identity: one the forge carries is recorded verified, one it does not carry is left for the restarted run to complete, and one the forge read cannot settle refuses the restart. Each rehearsal appends a record — task, recorded runner, action, reconciled effect identities, the restarted run's runner and terminal state — to `backend-rollback-rehearsals.jsonl` in the task's runtime directory, whether it completed, was refused or failed at a later step, and nothing removes it.",
|
|
9091
9202
|
"`--widen-surface` is the Planner's one command for a widen-surface escalation, and refuses before any write when the held pause is not one (no pause, a pause with a pull request — whose continuation is the ruling on that pull request — or a round whose Developer asked for no `widen_surface`), when a driver is still alive for the task, when the escalation's resolution is already consumed (a replay — the Surface is never widened twice), or when the widened body fails the write gate, whose findings name the field to edit first. The escalation packet's permitted next actions name this command with the globs the Developer asked for, and `task_resume` refuses such an escalation naming it.",
|
|
9092
|
-
"
|
|
9203
|
+
"Prepares the frozen brief and resolves the task, branch and model once. The standalone runner then starts the watching driver (`runDriverLoop`, `dev-review-loop.ts`). Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
9093
9204
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
9094
9205
|
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
9095
9206
|
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
9096
9207
|
],
|
|
9097
9208
|
status: "shipped"
|
|
9098
9209
|
},
|
|
9210
|
+
{
|
|
9211
|
+
name: "task switch",
|
|
9212
|
+
needs: ["forge"],
|
|
9213
|
+
description: "Change a task's agent or model by setting its Engine checkpoint aside, so the next `task run` is accepted",
|
|
9214
|
+
flags: [
|
|
9215
|
+
{ flag: "--issue <n>", description: "Address the task by its Issue number instead of `<tranche> <n>`" },
|
|
9216
|
+
{ flag: "--agent <claude|codex>", description: "Vendor the next `task run` of the task continues on" },
|
|
9217
|
+
{ flag: "--model <model>", description: "Model the next `task run` is meant to use; absent, the vendor default" }
|
|
9218
|
+
],
|
|
9219
|
+
details: [
|
|
9220
|
+
"Refuses, changing nothing, while a driver for the task is alive, naming its pid. Otherwise moves the task's Engine checkpoint (`checkpoints.sqlite` with its `-wal` and `-shm` files) into a timestamped `switched-*` folder of the task's run directory and never deletes it; the branch, its commits and its pull request are untouched, so the next `task run` with the new agent continues the same branch on a fresh checkpoint.",
|
|
9221
|
+
"Writes one driver-log line naming the from and to agent, the from and to model and the folder the checkpoint went to. On the standalone runner it changes nothing on disk and says that runner already continues a task on a new `--agent` by itself. `task run` and `run-engine --resume` still refuse an agent other than the checkpoint's, and their refusal names this command."
|
|
9222
|
+
],
|
|
9223
|
+
status: "shipped"
|
|
9224
|
+
},
|
|
9099
9225
|
{
|
|
9100
9226
|
name: "task status",
|
|
9101
9227
|
needs: ["forge"],
|
|
@@ -9810,7 +9936,8 @@ var StateSourceConfigSchema = z7.discriminatedUnion("kind", [
|
|
|
9810
9936
|
z7.object({ kind: z7.literal("file"), root: z7.string().optional() })
|
|
9811
9937
|
]);
|
|
9812
9938
|
// src/checks/edge-resolve.ts
|
|
9813
|
-
import {
|
|
9939
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
9940
|
+
import { promisify as promisify5 } from "node:util";
|
|
9814
9941
|
|
|
9815
9942
|
// src/lib/github-rate-limit.ts
|
|
9816
9943
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
@@ -9861,15 +9988,20 @@ ${message}` : message;
|
|
|
9861
9988
|
// src/checks/edge-resolve.ts
|
|
9862
9989
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
9863
9990
|
var issueCache = new Map;
|
|
9991
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
9864
9992
|
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
9865
9993
|
function fetchIssueState(num, repo) {
|
|
9866
9994
|
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
9867
9995
|
const cached = issueCache.get(key);
|
|
9868
9996
|
if (cached)
|
|
9869
9997
|
return cached;
|
|
9870
|
-
|
|
9998
|
+
const out = readIssueOnce(num, repo).then((first) => first.readFailed ? readIssueOnce(num, repo) : first);
|
|
9999
|
+
issueCache.set(key, out);
|
|
10000
|
+
return out;
|
|
10001
|
+
}
|
|
10002
|
+
async function readIssueOnce(num, repo) {
|
|
9871
10003
|
try {
|
|
9872
|
-
const
|
|
10004
|
+
const { stdout } = await execFileAsync5("gh", [
|
|
9873
10005
|
"issue",
|
|
9874
10006
|
"view",
|
|
9875
10007
|
String(num),
|
|
@@ -9877,13 +10009,11 @@ function fetchIssueState(num, repo) {
|
|
|
9877
10009
|
`${repo.owner}/${repo.repo}`,
|
|
9878
10010
|
"--json",
|
|
9879
10011
|
"state,stateReason,closedByPullRequestsReferences"
|
|
9880
|
-
], { encoding: "utf8"
|
|
9881
|
-
|
|
10012
|
+
], { encoding: "utf8" });
|
|
10013
|
+
return { json: JSON.parse(stdout), readFailed: false };
|
|
9882
10014
|
} catch (err) {
|
|
9883
|
-
|
|
10015
|
+
return { json: null, readFailed: !ISSUE_NOT_FOUND.test(execErrorText(err)) };
|
|
9884
10016
|
}
|
|
9885
|
-
issueCache.set(key, out);
|
|
9886
|
-
return out;
|
|
9887
10017
|
}
|
|
9888
10018
|
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
9889
10019
|
let tranche;
|
|
@@ -9943,7 +10073,7 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
9943
10073
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
9944
10074
|
if (direct) {
|
|
9945
10075
|
const num = Number(direct[1]);
|
|
9946
|
-
const read = fetchIssueState(num, repo);
|
|
10076
|
+
const read = await fetchIssueState(num, repo);
|
|
9947
10077
|
return edgeFromIssueJson(num, read.json, read.readFailed);
|
|
9948
10078
|
}
|
|
9949
10079
|
const qualified = splitSlugQualifiedEdge(id);
|
|
@@ -10009,7 +10139,7 @@ function packageRoot(moduleUrl) {
|
|
|
10009
10139
|
}
|
|
10010
10140
|
|
|
10011
10141
|
// src/commands/doctrine.ts
|
|
10012
|
-
import { execFileSync as
|
|
10142
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
10013
10143
|
import { existsSync as existsSync4, readdirSync, readFileSync as readFileSync4 } from "node:fs";
|
|
10014
10144
|
import { dirname as dirname3, join as join4, sep } from "node:path";
|
|
10015
10145
|
import matter4 from "gray-matter";
|
|
@@ -10035,7 +10165,7 @@ function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.c
|
|
|
10035
10165
|
}
|
|
10036
10166
|
function gitToplevel(cwd) {
|
|
10037
10167
|
try {
|
|
10038
|
-
return
|
|
10168
|
+
return execFileSync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
10039
10169
|
encoding: "utf8",
|
|
10040
10170
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10041
10171
|
}).trim();
|
|
@@ -10064,7 +10194,7 @@ var PACKAGED_TEMPLATE_PATH = join5(PACKAGE_ROOT, "aeg-root", "templates", "brief
|
|
|
10064
10194
|
var TEMPLATE_PATH = existsSync5(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join5(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
10065
10195
|
function git(args) {
|
|
10066
10196
|
try {
|
|
10067
|
-
return
|
|
10197
|
+
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
10068
10198
|
} catch {
|
|
10069
10199
|
return "";
|
|
10070
10200
|
}
|
|
@@ -10683,7 +10813,7 @@ function coreCheckRegistry() {
|
|
|
10683
10813
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
10684
10814
|
|
|
10685
10815
|
// src/lib/log-sink.ts
|
|
10686
|
-
import { execFile as
|
|
10816
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
10687
10817
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
10688
10818
|
import {
|
|
10689
10819
|
appendFileSync,
|
|
@@ -10692,7 +10822,7 @@ import {
|
|
|
10692
10822
|
existsSync as existsSync8,
|
|
10693
10823
|
fstatSync as fstatSync3,
|
|
10694
10824
|
mkdirSync as mkdirSync4,
|
|
10695
|
-
lstatSync as
|
|
10825
|
+
lstatSync as lstatSync3,
|
|
10696
10826
|
openSync as openSync4,
|
|
10697
10827
|
readFileSync as readFileSync8,
|
|
10698
10828
|
renameSync as renameSync2,
|
|
@@ -10701,10 +10831,10 @@ import {
|
|
|
10701
10831
|
} from "node:fs";
|
|
10702
10832
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
10703
10833
|
import { dirname as dirname7, join as join9 } from "node:path";
|
|
10704
|
-
import { promisify as
|
|
10834
|
+
import { promisify as promisify6 } from "node:util";
|
|
10705
10835
|
|
|
10706
10836
|
// src/lib/run-paths.ts
|
|
10707
|
-
import { execFileSync as
|
|
10837
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
10708
10838
|
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
10709
10839
|
import { dirname as dirname4, join as join7, resolve as resolvePath } from "node:path";
|
|
10710
10840
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
@@ -10852,7 +10982,7 @@ function resolveRepoSync() {
|
|
|
10852
10982
|
}
|
|
10853
10983
|
let url;
|
|
10854
10984
|
try {
|
|
10855
|
-
url =
|
|
10985
|
+
url = execFileSync7("git", ["remote", "get-url", "origin"], {
|
|
10856
10986
|
encoding: "utf-8",
|
|
10857
10987
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10858
10988
|
}).trim();
|
|
@@ -10916,7 +11046,7 @@ function appendLoopLogLine(path, line) {
|
|
|
10916
11046
|
import {
|
|
10917
11047
|
closeSync as closeSync3,
|
|
10918
11048
|
constants as fsConstants3,
|
|
10919
|
-
lstatSync,
|
|
11049
|
+
lstatSync as lstatSync2,
|
|
10920
11050
|
mkdirSync as mkdirSync3,
|
|
10921
11051
|
openSync as openSync3,
|
|
10922
11052
|
linkSync,
|
|
@@ -11087,7 +11217,7 @@ function removeQueueHead(path, cut) {
|
|
|
11087
11217
|
function queueBucketSize(path) {
|
|
11088
11218
|
let lstat;
|
|
11089
11219
|
try {
|
|
11090
|
-
lstat =
|
|
11220
|
+
lstat = lstatSync2(path);
|
|
11091
11221
|
} catch (err) {
|
|
11092
11222
|
if (!isEnoent(err))
|
|
11093
11223
|
throw err;
|
|
@@ -11254,6 +11384,7 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
11254
11384
|
|
|
11255
11385
|
// src/lib/log-sink.ts
|
|
11256
11386
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
11387
|
+
var LOG_FOLDER_ONLY_ENV = "VINAYA_LOG_FOLDER_ONLY";
|
|
11257
11388
|
function describeFolderFallback(reason) {
|
|
11258
11389
|
if (reason.kind === "anchor-unreadable") {
|
|
11259
11390
|
return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
|
|
@@ -11293,6 +11424,9 @@ function logsCredentialMissing(headers, env) {
|
|
|
11293
11424
|
return false;
|
|
11294
11425
|
}
|
|
11295
11426
|
function resolveLogDestinationFrom(input) {
|
|
11427
|
+
if (input.localConfig?.logs === false || input.unattended && input.trustAnchorConfig?.logs === false) {
|
|
11428
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
11429
|
+
}
|
|
11296
11430
|
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
11297
11431
|
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
11298
11432
|
return { kind: "folder", folder: spoolDir };
|
|
@@ -11312,6 +11446,10 @@ function resolveLogDestinationFrom(input) {
|
|
|
11312
11446
|
} else {
|
|
11313
11447
|
effective = local;
|
|
11314
11448
|
}
|
|
11449
|
+
if (input.folderOnly || input.env[LOG_FOLDER_ONLY_ENV] === "1") {
|
|
11450
|
+
const folder = effective && "folder" in effective && !isInsideRepo(effective.folder, input.repoRoot) ? effective.folder : input.defaultFolder;
|
|
11451
|
+
return { kind: "folder", folder };
|
|
11452
|
+
}
|
|
11315
11453
|
if (hostFromEnv(input.env) === "ci") {
|
|
11316
11454
|
if (effective && "url" in effective) {
|
|
11317
11455
|
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
@@ -11336,21 +11474,51 @@ function resolveLogDestinationFrom(input) {
|
|
|
11336
11474
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
11337
11475
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
11338
11476
|
}
|
|
11339
|
-
var
|
|
11477
|
+
var LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000;
|
|
11478
|
+
var LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5;
|
|
11479
|
+
function createTrustAnchorCache(read, now = Date.now, bounds = {
|
|
11480
|
+
retryIntervalMs: LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS,
|
|
11481
|
+
maxRetries: LOG_DESTINATION_ANCHOR_MAX_RETRIES
|
|
11482
|
+
}) {
|
|
11483
|
+
const slots = new Map;
|
|
11484
|
+
const start = (repoRoot, retries) => {
|
|
11485
|
+
const slot = {
|
|
11486
|
+
reading: Promise.resolve().then(read).catch(() => null),
|
|
11487
|
+
retries,
|
|
11488
|
+
missedAt: null
|
|
11489
|
+
};
|
|
11490
|
+
slots.set(repoRoot, slot);
|
|
11491
|
+
slot.reading.then((config) => {
|
|
11492
|
+
if (config === null)
|
|
11493
|
+
slot.missedAt = now();
|
|
11494
|
+
});
|
|
11495
|
+
return slot.reading;
|
|
11496
|
+
};
|
|
11497
|
+
return {
|
|
11498
|
+
get: (repoRoot) => {
|
|
11499
|
+
const slot = slots.get(repoRoot);
|
|
11500
|
+
if (slot === undefined)
|
|
11501
|
+
return start(repoRoot, 0);
|
|
11502
|
+
if (slot.missedAt === null)
|
|
11503
|
+
return slot.reading;
|
|
11504
|
+
if (slot.retries >= bounds.maxRetries || now() - slot.missedAt < bounds.retryIntervalMs)
|
|
11505
|
+
return slot.reading;
|
|
11506
|
+
return start(repoRoot, slot.retries + 1);
|
|
11507
|
+
},
|
|
11508
|
+
clear: () => slots.clear()
|
|
11509
|
+
};
|
|
11510
|
+
}
|
|
11511
|
+
var processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
|
|
11340
11512
|
function processTrustAnchor(repoRoot) {
|
|
11341
|
-
|
|
11342
|
-
if (cached !== undefined)
|
|
11343
|
-
return cached;
|
|
11344
|
-
const reading = safeLoadTrustAnchorConfig();
|
|
11345
|
-
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
11346
|
-
return reading;
|
|
11513
|
+
return processTrustAnchorByRepo.get(repoRoot);
|
|
11347
11514
|
}
|
|
11348
|
-
async function defaultResolveLogDestination(repo, env) {
|
|
11515
|
+
async function defaultResolveLogDestination(repo, env, folderOnly = false) {
|
|
11349
11516
|
const localConfig = loadConfig();
|
|
11350
11517
|
const unattended = isUnattendedProcess(process.env);
|
|
11351
11518
|
const repoRoot = repoRootSync();
|
|
11352
11519
|
return resolveLogDestinationFrom({
|
|
11353
11520
|
localConfig,
|
|
11521
|
+
folderOnly,
|
|
11354
11522
|
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
11355
11523
|
unattended,
|
|
11356
11524
|
env,
|
|
@@ -11359,14 +11527,16 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
11359
11527
|
});
|
|
11360
11528
|
}
|
|
11361
11529
|
function unresolvedLogDestination(env) {
|
|
11530
|
+
const loaded = loadConfig();
|
|
11531
|
+
if (loaded?.logs === false)
|
|
11532
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
11362
11533
|
if (hostFromEnv(env) === "ci") {
|
|
11363
11534
|
return {
|
|
11364
11535
|
kind: "none",
|
|
11365
11536
|
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
11366
11537
|
};
|
|
11367
11538
|
}
|
|
11368
|
-
const
|
|
11369
|
-
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
11539
|
+
const localConfig = loaded?.logs && loaded.logs.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
11370
11540
|
const unattended = isUnattendedProcess(process.env);
|
|
11371
11541
|
const repoRoot = repoRootSync();
|
|
11372
11542
|
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
@@ -11406,18 +11576,18 @@ function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot =
|
|
|
11406
11576
|
function isEnoent2(err) {
|
|
11407
11577
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
11408
11578
|
}
|
|
11409
|
-
var
|
|
11579
|
+
var execFileAsync6 = promisify6(execFile6);
|
|
11410
11580
|
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
11411
11581
|
let toplevel;
|
|
11412
11582
|
try {
|
|
11413
|
-
toplevel = (await
|
|
11583
|
+
toplevel = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
11414
11584
|
} catch (err) {
|
|
11415
11585
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
11416
11586
|
}
|
|
11417
11587
|
if (!existsSync8(join9(toplevel, "aeg-root", "roles")))
|
|
11418
11588
|
return vinayaVersion;
|
|
11419
11589
|
try {
|
|
11420
|
-
const sha = (await
|
|
11590
|
+
const sha = (await execFileAsync6("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
11421
11591
|
return `aeg-root@${sha}`;
|
|
11422
11592
|
} catch {
|
|
11423
11593
|
return vinayaVersion;
|
|
@@ -11440,7 +11610,7 @@ var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
|
11440
11610
|
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
11441
11611
|
let stdout;
|
|
11442
11612
|
try {
|
|
11443
|
-
({ stdout } = await
|
|
11613
|
+
({ stdout } = await execFileAsync6("gh", [
|
|
11444
11614
|
"issue",
|
|
11445
11615
|
"list",
|
|
11446
11616
|
"--state",
|
|
@@ -11478,7 +11648,7 @@ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
|
11478
11648
|
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
11479
11649
|
let stdout;
|
|
11480
11650
|
try {
|
|
11481
|
-
({ stdout } = await
|
|
11651
|
+
({ stdout } = await execFileAsync6("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
11482
11652
|
cwd,
|
|
11483
11653
|
encoding: "utf8",
|
|
11484
11654
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
@@ -11497,7 +11667,7 @@ async function confirmBacklogIssue(issue, cwd, repo) {
|
|
|
11497
11667
|
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
11498
11668
|
let branch;
|
|
11499
11669
|
try {
|
|
11500
|
-
branch = (await
|
|
11670
|
+
branch = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
11501
11671
|
encoding: "utf8",
|
|
11502
11672
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
11503
11673
|
killSignal: "SIGKILL"
|
|
@@ -11580,7 +11750,7 @@ function headShaRead(key, read, shared) {
|
|
|
11580
11750
|
}
|
|
11581
11751
|
async function resolveHeadSha(cwd) {
|
|
11582
11752
|
try {
|
|
11583
|
-
const out = (await
|
|
11753
|
+
const out = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
11584
11754
|
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
11585
11755
|
} catch {
|
|
11586
11756
|
return null;
|
|
@@ -11588,6 +11758,7 @@ async function resolveHeadSha(cwd) {
|
|
|
11588
11758
|
}
|
|
11589
11759
|
function defaultDeps() {
|
|
11590
11760
|
return {
|
|
11761
|
+
readConfig: loadConfig,
|
|
11591
11762
|
outboxRoot: () => join9(GLOBAL_VINAYA_HOME, "outbox"),
|
|
11592
11763
|
home: () => homedir3(),
|
|
11593
11764
|
hostname: () => osHostname(),
|
|
@@ -11771,23 +11942,59 @@ function createLogSink(overrides = {}) {
|
|
|
11771
11942
|
};
|
|
11772
11943
|
let contextCache;
|
|
11773
11944
|
let settledContext;
|
|
11945
|
+
let contextEnv = {};
|
|
11946
|
+
const resolveDestination = async (repo, env) => deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : await deps.resolveLogDestination(repo, env, deps.folderOnly);
|
|
11774
11947
|
const context = () => {
|
|
11775
11948
|
if (contextCache === undefined) {
|
|
11776
11949
|
const env = deps.env();
|
|
11950
|
+
contextEnv = env;
|
|
11777
11951
|
contextCache = Promise.all([
|
|
11778
11952
|
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
11779
11953
|
doctrine()
|
|
11780
11954
|
]).then(async ([resolved, doctrineValue]) => {
|
|
11781
11955
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
11782
|
-
settledContext = { repo, doctrine: doctrineValue, destination: await
|
|
11956
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await resolveDestination(repo, env) };
|
|
11957
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
11783
11958
|
return settledContext;
|
|
11784
11959
|
});
|
|
11785
11960
|
}
|
|
11786
11961
|
return contextCache;
|
|
11787
11962
|
};
|
|
11963
|
+
let destinationRetries = 0;
|
|
11964
|
+
let destinationRetryDueAt = 0;
|
|
11965
|
+
let destinationRetryInFlight = false;
|
|
11966
|
+
const retryDestinationIfDue = (ctx) => {
|
|
11967
|
+
if (ctx.destination.kind !== "folder" || ctx.destination.fallbackReason?.kind !== "anchor-unreadable")
|
|
11968
|
+
return;
|
|
11969
|
+
if (destinationRetryInFlight || destinationRetries >= LOG_DESTINATION_ANCHOR_MAX_RETRIES)
|
|
11970
|
+
return;
|
|
11971
|
+
if (deps.now().getTime() < destinationRetryDueAt)
|
|
11972
|
+
return;
|
|
11973
|
+
destinationRetryInFlight = true;
|
|
11974
|
+
destinationRetries++;
|
|
11975
|
+
const generation = contextCache;
|
|
11976
|
+
Promise.resolve().then(() => resolveDestination(ctx.repo, contextEnv)).then((destination) => {
|
|
11977
|
+
if (contextCache !== generation)
|
|
11978
|
+
return;
|
|
11979
|
+
if (destination.kind === "server") {
|
|
11980
|
+
settledContext = { ...ctx, destination };
|
|
11981
|
+
contextCache = Promise.resolve(settledContext);
|
|
11982
|
+
return;
|
|
11983
|
+
}
|
|
11984
|
+
if (destination.kind !== "folder" || destination.fallbackReason?.kind !== "anchor-unreadable") {
|
|
11985
|
+
destinationRetries = LOG_DESTINATION_ANCHOR_MAX_RETRIES;
|
|
11986
|
+
}
|
|
11987
|
+
}, () => {
|
|
11988
|
+
return;
|
|
11989
|
+
}).finally(() => {
|
|
11990
|
+
destinationRetryInFlight = false;
|
|
11991
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
11992
|
+
});
|
|
11993
|
+
};
|
|
11788
11994
|
const resetContext = () => {
|
|
11789
11995
|
contextCache = undefined;
|
|
11790
11996
|
settledContext = undefined;
|
|
11997
|
+
destinationRetries = 0;
|
|
11791
11998
|
};
|
|
11792
11999
|
let drainChain = Promise.resolve();
|
|
11793
12000
|
const pendingWrites = new Set;
|
|
@@ -11800,24 +12007,30 @@ function createLogSink(overrides = {}) {
|
|
|
11800
12007
|
`);
|
|
11801
12008
|
});
|
|
11802
12009
|
};
|
|
11803
|
-
const snapshot = () => {
|
|
12010
|
+
const snapshot = (attribution) => {
|
|
11804
12011
|
const env = deps.env();
|
|
11805
12012
|
return {
|
|
12013
|
+
attributed: attribution !== undefined,
|
|
11806
12014
|
host: hostFromEnv(env),
|
|
11807
12015
|
now: deps.now(),
|
|
11808
12016
|
seq: seq++,
|
|
11809
12017
|
envFields: {
|
|
11810
|
-
role: env.VINAYA_ROLE,
|
|
12018
|
+
role: attribution?.role ?? env.VINAYA_ROLE,
|
|
11811
12019
|
task: env.VINAYA_TASK,
|
|
11812
|
-
round: env.VINAYA_ROUND,
|
|
12020
|
+
round: attribution ? String(attribution.round) : env.VINAYA_ROUND,
|
|
11813
12021
|
pr: env.VINAYA_PR,
|
|
11814
12022
|
run: env.VINAYA_RUN || runId,
|
|
11815
|
-
attempt: env.VINAYA_ATTEMPT,
|
|
12023
|
+
attempt: attribution ? String(attribution.attempt) : env.VINAYA_ATTEMPT,
|
|
11816
12024
|
parent: env.VINAYA_PARENT_EVENT,
|
|
11817
12025
|
workRef: env.VINAYA_WORK_REF,
|
|
11818
12026
|
flow: env.VINAYA_FLOW,
|
|
11819
12027
|
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
11820
12028
|
runtime: env.VINAYA_RUNTIME,
|
|
12029
|
+
processId: env.VINAYA_PROCESS_ID,
|
|
12030
|
+
processVersion: env.VINAYA_PROCESS_VERSION,
|
|
12031
|
+
processDigest: env.VINAYA_PROCESS_DIGEST,
|
|
12032
|
+
runnerId: env.VINAYA_RUNNER_ID,
|
|
12033
|
+
runnerVersion: env.VINAYA_RUNNER_VERSION,
|
|
11821
12034
|
source: env.VINAYA_SOURCE
|
|
11822
12035
|
}
|
|
11823
12036
|
};
|
|
@@ -11847,7 +12060,7 @@ function createLogSink(overrides = {}) {
|
|
|
11847
12060
|
eventId: randomUUID2(),
|
|
11848
12061
|
processId,
|
|
11849
12062
|
revision: headSha,
|
|
11850
|
-
provenance: deps.provenance,
|
|
12063
|
+
provenance: call.attributed ? "parent_attributed" : deps.provenance,
|
|
11851
12064
|
inputVersions: deps.inputVersions()
|
|
11852
12065
|
});
|
|
11853
12066
|
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
@@ -11872,11 +12085,14 @@ function createLogSink(overrides = {}) {
|
|
|
11872
12085
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
11873
12086
|
}
|
|
11874
12087
|
};
|
|
11875
|
-
function log(e) {
|
|
12088
|
+
function log(e, attribution) {
|
|
11876
12089
|
try {
|
|
11877
|
-
const call = snapshot();
|
|
12090
|
+
const call = snapshot(attribution);
|
|
11878
12091
|
const write = async () => {
|
|
11879
12092
|
const ctx = await context();
|
|
12093
|
+
try {
|
|
12094
|
+
retryDestinationIfDue(ctx);
|
|
12095
|
+
} catch {}
|
|
11880
12096
|
if (ctx.destination.kind === "none") {
|
|
11881
12097
|
writeEvent(e, call, ctx, null, null, true);
|
|
11882
12098
|
return;
|
|
@@ -11900,9 +12116,13 @@ function createLogSink(overrides = {}) {
|
|
|
11900
12116
|
function logSync(e, opts = {}) {
|
|
11901
12117
|
try {
|
|
11902
12118
|
const call = snapshot();
|
|
11903
|
-
let ctx =
|
|
12119
|
+
let ctx = deps.readConfig()?.logs === false ? {
|
|
12120
|
+
repo: null,
|
|
12121
|
+
doctrine: "unknown",
|
|
12122
|
+
destination: { kind: "none", reason: "logs: false disables Log recording" }
|
|
12123
|
+
} : settledContext;
|
|
11904
12124
|
if (ctx === undefined) {
|
|
11905
|
-
const destination = deps.unresolvedLogDestination(deps.env());
|
|
12125
|
+
const destination = deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : deps.unresolvedLogDestination(deps.env());
|
|
11906
12126
|
if (destination.kind === "folder" && !opts.quiet) {
|
|
11907
12127
|
warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
|
|
11908
12128
|
`);
|
|
@@ -11980,7 +12200,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
11980
12200
|
function fileDiffAgainst(ref, path) {
|
|
11981
12201
|
let committed;
|
|
11982
12202
|
try {
|
|
11983
|
-
committed =
|
|
12203
|
+
committed = execFileSync8("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
11984
12204
|
encoding: "utf8",
|
|
11985
12205
|
stdio: ["ignore", "pipe", "pipe"]
|
|
11986
12206
|
}).trim();
|
|
@@ -12001,7 +12221,7 @@ function stagedDiff(args) {
|
|
|
12001
12221
|
if (!readsStagedDiff())
|
|
12002
12222
|
return "";
|
|
12003
12223
|
try {
|
|
12004
|
-
return
|
|
12224
|
+
return execFileSync8("git", ["diff", "--cached", ...args], {
|
|
12005
12225
|
encoding: "utf8",
|
|
12006
12226
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12007
12227
|
}).trim();
|
|
@@ -12011,7 +12231,7 @@ function stagedDiff(args) {
|
|
|
12011
12231
|
}
|
|
12012
12232
|
function revParse(ref) {
|
|
12013
12233
|
try {
|
|
12014
|
-
return
|
|
12234
|
+
return execFileSync8("git", ["rev-parse", "--verify", ref], {
|
|
12015
12235
|
encoding: "utf8",
|
|
12016
12236
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12017
12237
|
}).trim();
|
|
@@ -12021,7 +12241,7 @@ function revParse(ref) {
|
|
|
12021
12241
|
}
|
|
12022
12242
|
function repoRoot() {
|
|
12023
12243
|
try {
|
|
12024
|
-
return
|
|
12244
|
+
return execFileSync8("git", ["rev-parse", "--show-toplevel"], {
|
|
12025
12245
|
encoding: "utf8",
|
|
12026
12246
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12027
12247
|
}).trim();
|
|
@@ -12032,7 +12252,7 @@ function repoRoot() {
|
|
|
12032
12252
|
function changedFiles(base) {
|
|
12033
12253
|
let out;
|
|
12034
12254
|
try {
|
|
12035
|
-
out =
|
|
12255
|
+
out = execFileSync8("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
12036
12256
|
encoding: "utf8",
|
|
12037
12257
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12038
12258
|
}).trim();
|
|
@@ -12081,7 +12301,7 @@ function resolveAddedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
|
12081
12301
|
if (resolved === null || resolved === head)
|
|
12082
12302
|
continue;
|
|
12083
12303
|
try {
|
|
12084
|
-
const out =
|
|
12304
|
+
const out = execFileSync8("git", ["diff", "--name-only", "--diff-filter=A", `${ref}...HEAD`], {
|
|
12085
12305
|
encoding: "utf8",
|
|
12086
12306
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12087
12307
|
}).trim();
|
|
@@ -12119,7 +12339,7 @@ function findingsInThisDiff(findings) {
|
|
|
12119
12339
|
}
|
|
12120
12340
|
|
|
12121
12341
|
// src/lib/ci-shard-membership.ts
|
|
12122
|
-
var CI_SHARD_COUNT =
|
|
12342
|
+
var CI_SHARD_COUNT = 6;
|
|
12123
12343
|
var CI_SHARD_DIR_REL = "tests/ci-shards";
|
|
12124
12344
|
function shardFileRelPath(n) {
|
|
12125
12345
|
return `${CI_SHARD_DIR_REL}/shard-${n}.txt`;
|
|
@@ -12136,18 +12356,35 @@ var CHECK_NAME = "ci-shard-coverage";
|
|
|
12136
12356
|
var CLI_PREFIX = "apps/cli/";
|
|
12137
12357
|
function git2(args) {
|
|
12138
12358
|
try {
|
|
12139
|
-
return
|
|
12359
|
+
return execFileSync9("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
12140
12360
|
} catch {
|
|
12141
12361
|
return null;
|
|
12142
12362
|
}
|
|
12143
12363
|
}
|
|
12144
|
-
function
|
|
12145
|
-
const out = git2(["diff", "--cached", "--name-only", "--diff-filter=A"]);
|
|
12364
|
+
function pathLines(out) {
|
|
12146
12365
|
if (out === null || out === "")
|
|
12147
12366
|
return [];
|
|
12148
12367
|
return out.split(`
|
|
12149
12368
|
`).map((s) => s.trim()).filter(Boolean);
|
|
12150
12369
|
}
|
|
12370
|
+
function stagedAddedFiles() {
|
|
12371
|
+
return pathLines(git2(["diff", "--cached", "--name-only", "--diff-filter=A"]));
|
|
12372
|
+
}
|
|
12373
|
+
function stagedRemovedFiles() {
|
|
12374
|
+
return pathLines(git2(["diff", "--cached", "--name-only", "--no-renames", "--diff-filter=D"]));
|
|
12375
|
+
}
|
|
12376
|
+
function branchRemovedFiles() {
|
|
12377
|
+
const head = git2(["rev-parse", "--verify", "HEAD"]);
|
|
12378
|
+
for (const ref of new Set([process.env.BASE_SHA || "origin/main", "origin/main", "main"])) {
|
|
12379
|
+
const resolved = git2(["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
|
|
12380
|
+
if (resolved === null || resolved === "" || resolved === head)
|
|
12381
|
+
continue;
|
|
12382
|
+
const out = git2(["diff", "--name-only", "--no-renames", "--diff-filter=D", `${ref}...HEAD`]);
|
|
12383
|
+
if (out !== null)
|
|
12384
|
+
return pathLines(out);
|
|
12385
|
+
}
|
|
12386
|
+
return null;
|
|
12387
|
+
}
|
|
12151
12388
|
function stagedCliFileContent(relPath) {
|
|
12152
12389
|
return git2(["show", `:${CLI_PREFIX}${relPath}`]);
|
|
12153
12390
|
}
|
|
@@ -12165,9 +12402,11 @@ function main() {
|
|
|
12165
12402
|
});
|
|
12166
12403
|
process.exit(1);
|
|
12167
12404
|
}
|
|
12168
|
-
const
|
|
12169
|
-
|
|
12170
|
-
|
|
12405
|
+
const cliTests = (paths) => paths.filter((p) => p.startsWith(CLI_PREFIX)).map((p) => p.slice(CLI_PREFIX.length)).filter(isCliTestFile);
|
|
12406
|
+
const addedTestFiles = cliTests(files ?? (tracked || "").split(`
|
|
12407
|
+
`));
|
|
12408
|
+
const removedTestFiles = files === null ? [] : cliTests((preCommit ? stagedRemovedFiles() : branchRemovedFiles()) ?? []);
|
|
12409
|
+
if (addedTestFiles.length === 0 && removedTestFiles.length === 0 && files !== null) {
|
|
12171
12410
|
process.stdout.write(`${CHECK_NAME}: no CLI test file to judge
|
|
12172
12411
|
`);
|
|
12173
12412
|
process.exit(0);
|
|
@@ -12186,9 +12425,24 @@ function main() {
|
|
|
12186
12425
|
}
|
|
12187
12426
|
}
|
|
12188
12427
|
const missing = addedTestFiles.filter((f) => !shardMembers.has(f));
|
|
12189
|
-
|
|
12428
|
+
const trackedTests = new Set(addedTestFiles);
|
|
12429
|
+
const stale = [
|
|
12430
|
+
...removedTestFiles.filter((f) => shardMembers.has(f)),
|
|
12431
|
+
...files === null ? [...shardMembers].filter((f) => !trackedTests.has(f)) : []
|
|
12432
|
+
].sort();
|
|
12433
|
+
process.stdout.write(`${CHECK_NAME}: ${addedTestFiles.length} CLI test file(s) judged from ${preCommit ? "index" : "HEAD"}; ${missing.length} missing from a shard; ${stale.length} listed but no longer there
|
|
12190
12434
|
`);
|
|
12191
12435
|
const shardPaths = shardRelPaths.map((rel) => `${CLI_PREFIX}${rel}`);
|
|
12436
|
+
for (const file of stale) {
|
|
12437
|
+
emitCheckError({
|
|
12438
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
12439
|
+
check: CHECK_NAME,
|
|
12440
|
+
severity: "error",
|
|
12441
|
+
message: `${CLI_PREFIX}${file} is listed in a CI shard (${shardPaths.join(", ")}) but is no longer a CLI test file — removed, or moved to another owner.`,
|
|
12442
|
+
file: `${CLI_PREFIX}${file}`,
|
|
12443
|
+
agent_recovery_prompt: `Remove the "${file}" line from its shard file in the same change. A test moved to another owner needs no line: the repository's test schedule places it.`
|
|
12444
|
+
});
|
|
12445
|
+
}
|
|
12192
12446
|
for (const file of missing) {
|
|
12193
12447
|
emitCheckError({
|
|
12194
12448
|
schema: CHECK_SCHEMA_VERSION,
|
|
@@ -12199,6 +12453,6 @@ function main() {
|
|
|
12199
12453
|
agent_recovery_prompt: `Add "${file}" as its own line to one of ${shardPaths.join(", ")}, stage that shard file, and commit the update.`
|
|
12200
12454
|
});
|
|
12201
12455
|
}
|
|
12202
|
-
process.exit(missing.length > 0 ? 1 : 0);
|
|
12456
|
+
process.exit(missing.length > 0 || stale.length > 0 ? 1 : 0);
|
|
12203
12457
|
}
|
|
12204
12458
|
main();
|