@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,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-doc-coverage-push.ts
|
|
4
|
-
import { execFileSync as
|
|
4
|
+
import { execFileSync as execFileSync9 } from "node:child_process";
|
|
5
5
|
import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
|
|
6
6
|
|
|
7
7
|
// ../../packages/aeg-core/src/entry-point.ts
|
|
@@ -781,10 +781,11 @@ function trancheSlugsFromLabels(labels) {
|
|
|
781
781
|
}
|
|
782
782
|
return slugs;
|
|
783
783
|
}
|
|
784
|
-
async function indexTrancheMilestonesAsync(owner, repo) {
|
|
784
|
+
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
785
|
+
const read = (fetch2) => options.retryFailedReads ? retryOnce(fetch2) : fetch2();
|
|
785
786
|
const [milestones, labels] = await Promise.all([
|
|
786
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
787
|
-
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
|
|
787
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
788
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
788
789
|
]);
|
|
789
790
|
const active = [];
|
|
790
791
|
const archived = [];
|
|
@@ -795,9 +796,16 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
795
796
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
796
797
|
const uniqueLegacySlugs = [...legacySlugs];
|
|
797
798
|
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
798
|
-
Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
|
|
799
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
|
|
799
|
+
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
800
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
800
801
|
]);
|
|
802
|
+
const issuesBySlug = new Map;
|
|
803
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
804
|
+
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
805
|
+
});
|
|
806
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
807
|
+
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
808
|
+
});
|
|
801
809
|
uniqueLegacySlugs.forEach((slug, i) => {
|
|
802
810
|
const m = legacyMilestoneBySlug.get(slug);
|
|
803
811
|
if (!m)
|
|
@@ -821,7 +829,14 @@ async function indexTrancheMilestonesAsync(owner, repo) {
|
|
|
821
829
|
else if (lifecycle === "complete")
|
|
822
830
|
archived.push({ slug, goal });
|
|
823
831
|
});
|
|
824
|
-
return { active, archived, facts, legacySlugs };
|
|
832
|
+
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
833
|
+
}
|
|
834
|
+
async function retryOnce(fetch2) {
|
|
835
|
+
try {
|
|
836
|
+
return await fetch2();
|
|
837
|
+
} catch {
|
|
838
|
+
return fetch2();
|
|
839
|
+
}
|
|
825
840
|
}
|
|
826
841
|
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
827
842
|
const [milestones, labels, issues] = await Promise.all([
|
|
@@ -1866,15 +1881,16 @@ function describeError(err) {
|
|
|
1866
1881
|
}
|
|
1867
1882
|
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1868
1883
|
function defaultPriorTrancheArchivalDeps() {
|
|
1869
|
-
let facts = new Map;
|
|
1870
1884
|
return {
|
|
1871
|
-
|
|
1872
|
-
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1885
|
+
activeTranches: async (excludeSlug, repo) => {
|
|
1886
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
|
|
1887
|
+
return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
|
|
1888
|
+
const issues = index.issuesBySlug?.get(m.slug);
|
|
1889
|
+
if (!issues)
|
|
1890
|
+
throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
|
|
1891
|
+
return { slug: m.slug, issues };
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1878
1894
|
};
|
|
1879
1895
|
}
|
|
1880
1896
|
function reason(err) {
|
|
@@ -1886,61 +1902,28 @@ async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = d
|
|
|
1886
1902
|
return { facts: [], infraFailure: null };
|
|
1887
1903
|
let candidates;
|
|
1888
1904
|
try {
|
|
1889
|
-
candidates = await deps.
|
|
1905
|
+
candidates = await deps.activeTranches(excludeSlug, repo);
|
|
1890
1906
|
} catch (err) {
|
|
1891
1907
|
return {
|
|
1892
1908
|
facts: [],
|
|
1893
1909
|
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1894
1910
|
};
|
|
1895
1911
|
}
|
|
1912
|
+
const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
|
|
1896
1913
|
const facts = [];
|
|
1897
|
-
const unreadable = [];
|
|
1898
|
-
const derived = new Map;
|
|
1899
|
-
const derive = (slug) => {
|
|
1900
|
-
let p = derived.get(slug);
|
|
1901
|
-
if (!p) {
|
|
1902
|
-
p = deps.deriveTranche(slug, repo);
|
|
1903
|
-
derived.set(slug, p);
|
|
1904
|
-
}
|
|
1905
|
-
return p;
|
|
1906
|
-
};
|
|
1907
1914
|
for (const project of projects) {
|
|
1908
1915
|
let found = null;
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
let candidateTranche;
|
|
1912
|
-
try {
|
|
1913
|
-
candidateTranche = await derive(slug);
|
|
1914
|
-
} catch {
|
|
1915
|
-
unknown = true;
|
|
1916
|
-
unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1917
|
-
break;
|
|
1918
|
-
}
|
|
1919
|
-
if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
|
|
1916
|
+
for (const { slug, issues } of candidates) {
|
|
1917
|
+
if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
|
|
1920
1918
|
continue;
|
|
1921
|
-
|
|
1922
|
-
try {
|
|
1923
|
-
openIssues = await deps.openIssues(slug, repo);
|
|
1924
|
-
} catch {
|
|
1925
|
-
openIssues = null;
|
|
1926
|
-
}
|
|
1927
|
-
if (openIssues === null) {
|
|
1928
|
-
unknown = true;
|
|
1929
|
-
unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
|
|
1930
|
-
break;
|
|
1931
|
-
}
|
|
1932
|
-
if (openIssues.length === 0) {
|
|
1919
|
+
if (!issues.some((issue) => issue.state === "OPEN")) {
|
|
1933
1920
|
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1934
1921
|
break;
|
|
1935
1922
|
}
|
|
1936
1923
|
}
|
|
1937
|
-
|
|
1938
|
-
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1924
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1939
1925
|
}
|
|
1940
|
-
return {
|
|
1941
|
-
facts,
|
|
1942
|
-
infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
|
|
1943
|
-
};
|
|
1926
|
+
return { facts, infraFailure: null };
|
|
1944
1927
|
}
|
|
1945
1928
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1946
1929
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
@@ -2766,11 +2749,13 @@ var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
|
2766
2749
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2767
2750
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2768
2751
|
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2752
|
+
var DEFAULT_READY_PUSH_TIMEOUT_MINUTES = 20;
|
|
2769
2753
|
var DEFAULT_REVIEW_POLICY = {
|
|
2770
2754
|
codeReviewThreshold: "BLOCKER",
|
|
2771
2755
|
securityThreshold: "HIGH",
|
|
2772
2756
|
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2773
|
-
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2757
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES,
|
|
2758
|
+
readyPushTimeoutMinutes: DEFAULT_READY_PUSH_TIMEOUT_MINUTES
|
|
2774
2759
|
};
|
|
2775
2760
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2776
2761
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -6959,7 +6944,17 @@ var HeaderMetaV3Schema = z3.object({
|
|
|
6959
6944
|
runtime: z3.string().nullable(),
|
|
6960
6945
|
source: z3.string().nullable()
|
|
6961
6946
|
}).strict();
|
|
6962
|
-
var
|
|
6947
|
+
var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
|
|
6948
|
+
schema: z3.literal(4),
|
|
6949
|
+
process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
|
|
6950
|
+
runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
|
|
6951
|
+
}).strict();
|
|
6952
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [
|
|
6953
|
+
HeaderMetaV1Schema,
|
|
6954
|
+
HeaderMetaV2Schema,
|
|
6955
|
+
HeaderMetaV3Schema,
|
|
6956
|
+
HeaderMetaV4Schema
|
|
6957
|
+
]);
|
|
6963
6958
|
var SubjectSchema = z3.object({
|
|
6964
6959
|
issue: z3.number().int().nullable(),
|
|
6965
6960
|
pr: z3.number().int().optional(),
|
|
@@ -7179,6 +7174,75 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
|
7179
7174
|
round: z3.number().int(),
|
|
7180
7175
|
phase: z3.string()
|
|
7181
7176
|
}).strict(),
|
|
7177
|
+
z3.object({
|
|
7178
|
+
...loopShared,
|
|
7179
|
+
event: z3.literal("conflict_reentry"),
|
|
7180
|
+
task: z3.number().int(),
|
|
7181
|
+
pr: z3.number().int().positive(),
|
|
7182
|
+
attempt: z3.number().int().positive(),
|
|
7183
|
+
bound: z3.number().int().positive()
|
|
7184
|
+
}).strict(),
|
|
7185
|
+
z3.object({
|
|
7186
|
+
...loopShared,
|
|
7187
|
+
event: z3.literal("storage_push"),
|
|
7188
|
+
round: z3.number().int(),
|
|
7189
|
+
branch: z3.string(),
|
|
7190
|
+
head: z3.string()
|
|
7191
|
+
}).strict(),
|
|
7192
|
+
z3.object({
|
|
7193
|
+
...loopShared,
|
|
7194
|
+
event: z3.literal("local_checks_run"),
|
|
7195
|
+
round: z3.number().int(),
|
|
7196
|
+
head: z3.string().nullable(),
|
|
7197
|
+
passed: z3.boolean(),
|
|
7198
|
+
wall_ms: z3.number().nonnegative()
|
|
7199
|
+
}).strict(),
|
|
7200
|
+
z3.object({
|
|
7201
|
+
...loopShared,
|
|
7202
|
+
event: z3.literal("ready_push"),
|
|
7203
|
+
round: z3.number().int(),
|
|
7204
|
+
head: z3.string(),
|
|
7205
|
+
outcome: z3.enum(["passed", "refused"]),
|
|
7206
|
+
selected: z3.number().int().nonnegative(),
|
|
7207
|
+
failed: z3.number().int().nonnegative(),
|
|
7208
|
+
rerun: z3.boolean(),
|
|
7209
|
+
wall_ms: z3.number().nonnegative()
|
|
7210
|
+
}).strict(),
|
|
7211
|
+
z3.object({
|
|
7212
|
+
...loopShared,
|
|
7213
|
+
event: z3.literal("failed_tests_rerun"),
|
|
7214
|
+
round: z3.number().int(),
|
|
7215
|
+
head: z3.string(),
|
|
7216
|
+
rerun_of: z3.string(),
|
|
7217
|
+
failed_files: z3.number().int().nonnegative(),
|
|
7218
|
+
affected_files: z3.number().int().nonnegative(),
|
|
7219
|
+
full_count: z3.number().int().nonnegative()
|
|
7220
|
+
}).strict(),
|
|
7221
|
+
z3.object({
|
|
7222
|
+
...loopShared,
|
|
7223
|
+
event: z3.literal("pr_opened"),
|
|
7224
|
+
round: z3.number().int(),
|
|
7225
|
+
pr: z3.number().int().positive(),
|
|
7226
|
+
head: z3.string()
|
|
7227
|
+
}).strict(),
|
|
7228
|
+
z3.object({
|
|
7229
|
+
...loopShared,
|
|
7230
|
+
event: z3.literal("ci_result_read"),
|
|
7231
|
+
round: z3.number().int(),
|
|
7232
|
+
pr: z3.number().int().positive(),
|
|
7233
|
+
head: z3.string(),
|
|
7234
|
+
conclusion: z3.enum(["green", "red", "pending", "skipped"]),
|
|
7235
|
+
failing_checks: z3.array(z3.string()),
|
|
7236
|
+
wait_ms: z3.number().nonnegative()
|
|
7237
|
+
}).strict(),
|
|
7238
|
+
z3.object({
|
|
7239
|
+
...loopShared,
|
|
7240
|
+
event: z3.literal("phase_time"),
|
|
7241
|
+
round: z3.number().int(),
|
|
7242
|
+
phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
|
|
7243
|
+
step: z3.string(),
|
|
7244
|
+
wall_ms: z3.number().nonnegative()
|
|
7245
|
+
}).strict(),
|
|
7182
7246
|
z3.object({
|
|
7183
7247
|
...loopShared,
|
|
7184
7248
|
event: z3.literal("driver_exited"),
|
|
@@ -7366,7 +7430,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
|
7366
7430
|
]);
|
|
7367
7431
|
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
7368
7432
|
var customShared = {
|
|
7369
|
-
meta:
|
|
7433
|
+
meta: HeaderMetaSchema,
|
|
7370
7434
|
subject: SubjectSchema,
|
|
7371
7435
|
kind: z3.literal("custom"),
|
|
7372
7436
|
...envelopeTail
|
|
@@ -7451,7 +7515,7 @@ function buildHeader(input) {
|
|
|
7451
7515
|
const issue = subject.issue;
|
|
7452
7516
|
return {
|
|
7453
7517
|
meta: {
|
|
7454
|
-
schema:
|
|
7518
|
+
schema: 4,
|
|
7455
7519
|
ts: input.now.toISOString(),
|
|
7456
7520
|
run_id: input.runId,
|
|
7457
7521
|
seq: input.seq,
|
|
@@ -7488,6 +7552,15 @@ function buildHeader(input) {
|
|
|
7488
7552
|
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
7489
7553
|
},
|
|
7490
7554
|
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
7555
|
+
process: {
|
|
7556
|
+
id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
|
|
7557
|
+
version: lineageFieldFromEnv(input.env.processVersion),
|
|
7558
|
+
digest: lineageFieldFromEnv(input.env.processDigest)
|
|
7559
|
+
},
|
|
7560
|
+
runner: {
|
|
7561
|
+
id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
|
|
7562
|
+
version: lineageFieldFromEnv(input.env.runnerVersion)
|
|
7563
|
+
},
|
|
7491
7564
|
source: lineageFieldFromEnv(input.env.source)
|
|
7492
7565
|
},
|
|
7493
7566
|
subject
|
|
@@ -7531,7 +7604,7 @@ function redact(value, home) {
|
|
|
7531
7604
|
return value;
|
|
7532
7605
|
}
|
|
7533
7606
|
// ../../packages/aeg-core/src/log/store.ts
|
|
7534
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
7607
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3, 4];
|
|
7535
7608
|
function metaOf(obj) {
|
|
7536
7609
|
if (obj === null || typeof obj !== "object")
|
|
7537
7610
|
return null;
|
|
@@ -7755,18 +7828,28 @@ var ResolutionRecordSchema = z4.object({
|
|
|
7755
7828
|
authenticatedFrom: z4.string().min(1),
|
|
7756
7829
|
consumedAt: isoTimestamp
|
|
7757
7830
|
}).strict();
|
|
7831
|
+
var ExecutionRoundMirrorRecordSchema = z4.object({
|
|
7832
|
+
version: z4.literal(1),
|
|
7833
|
+
kind: z4.literal("execution_round"),
|
|
7834
|
+
task: taskId,
|
|
7835
|
+
repository: z4.string().min(1),
|
|
7836
|
+
threadId: z4.string().min(1),
|
|
7837
|
+
checkpointId: z4.string().min(1),
|
|
7838
|
+
round: z4.number().int().positive(),
|
|
7839
|
+
recordedAt: isoTimestamp
|
|
7840
|
+
}).strict();
|
|
7758
7841
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
7759
7842
|
var CONTROL_AREA_DIRNAME = "control";
|
|
7760
7843
|
// src/lib/diff-evidence.ts
|
|
7761
|
-
import { execFileSync as
|
|
7844
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
7762
7845
|
import { join as join10, relative as relative2, resolve as resolve2 } from "node:path";
|
|
7763
7846
|
|
|
7764
7847
|
// src/lib/config.ts
|
|
7765
7848
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
7766
7849
|
import { promisify as promisify4 } from "node:util";
|
|
7767
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7850
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7768
7851
|
import { homedir } from "node:os";
|
|
7769
|
-
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
7852
|
+
import { basename as basename3, dirname, isAbsolute, join, resolve } from "node:path";
|
|
7770
7853
|
import { z as z6 } from "zod";
|
|
7771
7854
|
|
|
7772
7855
|
// src/checks/contract.ts
|
|
@@ -8229,7 +8312,8 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8229
8312
|
codeReviewThreshold: z6.string().min(1).optional(),
|
|
8230
8313
|
securityThreshold: z6.string().min(1).optional(),
|
|
8231
8314
|
maxRounds: z6.number().optional(),
|
|
8232
|
-
maxTaskMinutes: z6.number().optional()
|
|
8315
|
+
maxTaskMinutes: z6.number().optional(),
|
|
8316
|
+
readyPushTimeoutMinutes: z6.number().optional()
|
|
8233
8317
|
}).optional(),
|
|
8234
8318
|
securityScan: z6.object({
|
|
8235
8319
|
command: z6.array(z6.string().min(1)).min(1)
|
|
@@ -8245,7 +8329,16 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8245
8329
|
collisionThreshold: z6.number().int().nonnegative().optional()
|
|
8246
8330
|
}).optional(),
|
|
8247
8331
|
prePush: z6.object({
|
|
8248
|
-
alwaysRun: z6.array(z6.string()).optional()
|
|
8332
|
+
alwaysRun: z6.array(z6.string()).optional(),
|
|
8333
|
+
readyTests: z6.object({
|
|
8334
|
+
mode: z6.literal("ci"),
|
|
8335
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8336
|
+
check: z6.literal("Vinaya CI")
|
|
8337
|
+
}).strict().optional(),
|
|
8338
|
+
requiredCi: z6.object({
|
|
8339
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8340
|
+
check: z6.literal("Vinaya CI")
|
|
8341
|
+
}).strict().optional()
|
|
8249
8342
|
}).optional(),
|
|
8250
8343
|
report: z6.object({
|
|
8251
8344
|
commandTimeoutMs: z6.number().int().positive().optional()
|
|
@@ -8263,6 +8356,7 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8263
8356
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
8264
8357
|
}),
|
|
8265
8358
|
runtimeDir: z6.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
8359
|
+
runner: z6.enum(["standalone", "atta-engine"]).optional(),
|
|
8266
8360
|
logs: z6.object({
|
|
8267
8361
|
folder: z6.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
8268
8362
|
url: z6.string().url().optional(),
|
|
@@ -8275,7 +8369,7 @@ var VinayaConfigObjectSchema = z6.object({
|
|
|
8275
8369
|
message: "logs: headers requires url"
|
|
8276
8370
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
8277
8371
|
message: "logs: readHeaders requires url"
|
|
8278
|
-
}).optional(),
|
|
8372
|
+
}).or(z6.literal(false)).optional(),
|
|
8279
8373
|
decisionRecords: z6.object({
|
|
8280
8374
|
path: RepoRelativePathSchema
|
|
8281
8375
|
}).strict().optional()
|
|
@@ -8405,13 +8499,19 @@ function resolveReviewPolicy(config) {
|
|
|
8405
8499
|
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
8406
8500
|
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.`);
|
|
8407
8501
|
}
|
|
8502
|
+
const readyPushTimeoutMinutes = raw.readyPushTimeoutMinutes ?? DEFAULT_READY_PUSH_TIMEOUT_MINUTES;
|
|
8503
|
+
if (!Number.isInteger(readyPushTimeoutMinutes) || readyPushTimeoutMinutes < 1) {
|
|
8504
|
+
throw new Error(`vinaya.config.json: reviewPolicy.readyPushTimeoutMinutes "${readyPushTimeoutMinutes}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
8505
|
+
}
|
|
8408
8506
|
return {
|
|
8409
8507
|
codeReviewThreshold,
|
|
8410
8508
|
securityThreshold,
|
|
8411
8509
|
maxRounds,
|
|
8412
|
-
maxTaskMinutes
|
|
8510
|
+
maxTaskMinutes,
|
|
8511
|
+
readyPushTimeoutMinutes
|
|
8413
8512
|
};
|
|
8414
8513
|
}
|
|
8514
|
+
var emittedLocalOverrideWarnings = new Set;
|
|
8415
8515
|
function resolveGateCutovers(config) {
|
|
8416
8516
|
const raw = config?.gateCutovers;
|
|
8417
8517
|
if (!raw)
|
|
@@ -8905,7 +9005,7 @@ function resolveNumber(issue, subjectLabel, runner) {
|
|
|
8905
9005
|
}
|
|
8906
9006
|
|
|
8907
9007
|
// src/lib/brief-assembly.ts
|
|
8908
|
-
import { execFileSync as
|
|
9008
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8909
9009
|
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "node:fs";
|
|
8910
9010
|
import { join as join5 } from "node:path";
|
|
8911
9011
|
|
|
@@ -9075,6 +9175,10 @@ var COMMANDS = [
|
|
|
9075
9175
|
needs: ["forge", "operator-seat"],
|
|
9076
9176
|
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
9077
9177
|
flags: [
|
|
9178
|
+
{
|
|
9179
|
+
flag: "--runner <standalone|atta-engine>",
|
|
9180
|
+
description: "Override runner config for this invocation; absent uses config, whose default is standalone"
|
|
9181
|
+
},
|
|
9078
9182
|
{
|
|
9079
9183
|
flag: "--agent <claude|codex>",
|
|
9080
9184
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
@@ -9086,17 +9190,39 @@ var COMMANDS = [
|
|
|
9086
9190
|
{
|
|
9087
9191
|
flag: "--widen-surface <glob,...> --reason <text>",
|
|
9088
9192
|
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"
|
|
9193
|
+
},
|
|
9194
|
+
{
|
|
9195
|
+
flag: "--rollback",
|
|
9196
|
+
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`"
|
|
9089
9197
|
}
|
|
9090
9198
|
],
|
|
9091
9199
|
details: [
|
|
9200
|
+
"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.",
|
|
9201
|
+
"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.",
|
|
9202
|
+
"`--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.",
|
|
9092
9203
|
"`--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.",
|
|
9093
|
-
"
|
|
9204
|
+
"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.",
|
|
9094
9205
|
"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.",
|
|
9095
9206
|
"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.",
|
|
9096
9207
|
"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`)."
|
|
9097
9208
|
],
|
|
9098
9209
|
status: "shipped"
|
|
9099
9210
|
},
|
|
9211
|
+
{
|
|
9212
|
+
name: "task switch",
|
|
9213
|
+
needs: ["forge"],
|
|
9214
|
+
description: "Change a task's agent or model by setting its Engine checkpoint aside, so the next `task run` is accepted",
|
|
9215
|
+
flags: [
|
|
9216
|
+
{ flag: "--issue <n>", description: "Address the task by its Issue number instead of `<tranche> <n>`" },
|
|
9217
|
+
{ flag: "--agent <claude|codex>", description: "Vendor the next `task run` of the task continues on" },
|
|
9218
|
+
{ flag: "--model <model>", description: "Model the next `task run` is meant to use; absent, the vendor default" }
|
|
9219
|
+
],
|
|
9220
|
+
details: [
|
|
9221
|
+
"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.",
|
|
9222
|
+
"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."
|
|
9223
|
+
],
|
|
9224
|
+
status: "shipped"
|
|
9225
|
+
},
|
|
9100
9226
|
{
|
|
9101
9227
|
name: "task status",
|
|
9102
9228
|
needs: ["forge"],
|
|
@@ -9811,7 +9937,8 @@ var StateSourceConfigSchema = z7.discriminatedUnion("kind", [
|
|
|
9811
9937
|
z7.object({ kind: z7.literal("file"), root: z7.string().optional() })
|
|
9812
9938
|
]);
|
|
9813
9939
|
// src/checks/edge-resolve.ts
|
|
9814
|
-
import {
|
|
9940
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
9941
|
+
import { promisify as promisify5 } from "node:util";
|
|
9815
9942
|
|
|
9816
9943
|
// src/lib/github-rate-limit.ts
|
|
9817
9944
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
@@ -9862,15 +9989,20 @@ ${message}` : message;
|
|
|
9862
9989
|
// src/checks/edge-resolve.ts
|
|
9863
9990
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
9864
9991
|
var issueCache = new Map;
|
|
9992
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
9865
9993
|
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
9866
9994
|
function fetchIssueState(num, repo) {
|
|
9867
9995
|
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
9868
9996
|
const cached = issueCache.get(key);
|
|
9869
9997
|
if (cached)
|
|
9870
9998
|
return cached;
|
|
9871
|
-
|
|
9999
|
+
const out = readIssueOnce(num, repo).then((first) => first.readFailed ? readIssueOnce(num, repo) : first);
|
|
10000
|
+
issueCache.set(key, out);
|
|
10001
|
+
return out;
|
|
10002
|
+
}
|
|
10003
|
+
async function readIssueOnce(num, repo) {
|
|
9872
10004
|
try {
|
|
9873
|
-
const
|
|
10005
|
+
const { stdout } = await execFileAsync5("gh", [
|
|
9874
10006
|
"issue",
|
|
9875
10007
|
"view",
|
|
9876
10008
|
String(num),
|
|
@@ -9878,13 +10010,11 @@ function fetchIssueState(num, repo) {
|
|
|
9878
10010
|
`${repo.owner}/${repo.repo}`,
|
|
9879
10011
|
"--json",
|
|
9880
10012
|
"state,stateReason,closedByPullRequestsReferences"
|
|
9881
|
-
], { encoding: "utf8"
|
|
9882
|
-
|
|
10013
|
+
], { encoding: "utf8" });
|
|
10014
|
+
return { json: JSON.parse(stdout), readFailed: false };
|
|
9883
10015
|
} catch (err) {
|
|
9884
|
-
|
|
10016
|
+
return { json: null, readFailed: !ISSUE_NOT_FOUND.test(execErrorText(err)) };
|
|
9885
10017
|
}
|
|
9886
|
-
issueCache.set(key, out);
|
|
9887
|
-
return out;
|
|
9888
10018
|
}
|
|
9889
10019
|
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
9890
10020
|
let tranche;
|
|
@@ -9944,7 +10074,7 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
9944
10074
|
const direct = id.match(DIRECT_ISSUE_REF);
|
|
9945
10075
|
if (direct) {
|
|
9946
10076
|
const num = Number(direct[1]);
|
|
9947
|
-
const read = fetchIssueState(num, repo);
|
|
10077
|
+
const read = await fetchIssueState(num, repo);
|
|
9948
10078
|
return edgeFromIssueJson(num, read.json, read.readFailed);
|
|
9949
10079
|
}
|
|
9950
10080
|
const qualified = splitSlugQualifiedEdge(id);
|
|
@@ -10010,7 +10140,7 @@ function packageRoot(moduleUrl) {
|
|
|
10010
10140
|
}
|
|
10011
10141
|
|
|
10012
10142
|
// src/commands/doctrine.ts
|
|
10013
|
-
import { execFileSync as
|
|
10143
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
10014
10144
|
import { existsSync as existsSync4, readdirSync, readFileSync as readFileSync4 } from "node:fs";
|
|
10015
10145
|
import { dirname as dirname3, join as join4, sep } from "node:path";
|
|
10016
10146
|
import matter4 from "gray-matter";
|
|
@@ -10036,7 +10166,7 @@ function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.c
|
|
|
10036
10166
|
}
|
|
10037
10167
|
function gitToplevel(cwd) {
|
|
10038
10168
|
try {
|
|
10039
|
-
return
|
|
10169
|
+
return execFileSync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
10040
10170
|
encoding: "utf8",
|
|
10041
10171
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10042
10172
|
}).trim();
|
|
@@ -10065,7 +10195,7 @@ var PACKAGED_TEMPLATE_PATH = join5(PACKAGE_ROOT, "aeg-root", "templates", "brief
|
|
|
10065
10195
|
var TEMPLATE_PATH = existsSync5(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join5(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
10066
10196
|
function git(args) {
|
|
10067
10197
|
try {
|
|
10068
|
-
return
|
|
10198
|
+
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
10069
10199
|
} catch {
|
|
10070
10200
|
return "";
|
|
10071
10201
|
}
|
|
@@ -10684,7 +10814,7 @@ function coreCheckRegistry() {
|
|
|
10684
10814
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
10685
10815
|
|
|
10686
10816
|
// src/lib/log-sink.ts
|
|
10687
|
-
import { execFile as
|
|
10817
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
10688
10818
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
10689
10819
|
import {
|
|
10690
10820
|
appendFileSync,
|
|
@@ -10693,7 +10823,7 @@ import {
|
|
|
10693
10823
|
existsSync as existsSync8,
|
|
10694
10824
|
fstatSync as fstatSync3,
|
|
10695
10825
|
mkdirSync as mkdirSync4,
|
|
10696
|
-
lstatSync as
|
|
10826
|
+
lstatSync as lstatSync3,
|
|
10697
10827
|
openSync as openSync4,
|
|
10698
10828
|
readFileSync as readFileSync8,
|
|
10699
10829
|
renameSync as renameSync2,
|
|
@@ -10702,10 +10832,10 @@ import {
|
|
|
10702
10832
|
} from "node:fs";
|
|
10703
10833
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
10704
10834
|
import { dirname as dirname7, join as join9 } from "node:path";
|
|
10705
|
-
import { promisify as
|
|
10835
|
+
import { promisify as promisify6 } from "node:util";
|
|
10706
10836
|
|
|
10707
10837
|
// src/lib/run-paths.ts
|
|
10708
|
-
import { execFileSync as
|
|
10838
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
10709
10839
|
import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
10710
10840
|
import { dirname as dirname4, join as join7, resolve as resolvePath } from "node:path";
|
|
10711
10841
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
@@ -10853,7 +10983,7 @@ function resolveRepoSync() {
|
|
|
10853
10983
|
}
|
|
10854
10984
|
let url;
|
|
10855
10985
|
try {
|
|
10856
|
-
url =
|
|
10986
|
+
url = execFileSync7("git", ["remote", "get-url", "origin"], {
|
|
10857
10987
|
encoding: "utf-8",
|
|
10858
10988
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10859
10989
|
}).trim();
|
|
@@ -10917,7 +11047,7 @@ function appendLoopLogLine(path, line) {
|
|
|
10917
11047
|
import {
|
|
10918
11048
|
closeSync as closeSync3,
|
|
10919
11049
|
constants as fsConstants3,
|
|
10920
|
-
lstatSync,
|
|
11050
|
+
lstatSync as lstatSync2,
|
|
10921
11051
|
mkdirSync as mkdirSync3,
|
|
10922
11052
|
openSync as openSync3,
|
|
10923
11053
|
linkSync,
|
|
@@ -11088,7 +11218,7 @@ function removeQueueHead(path, cut) {
|
|
|
11088
11218
|
function queueBucketSize(path) {
|
|
11089
11219
|
let lstat;
|
|
11090
11220
|
try {
|
|
11091
|
-
lstat =
|
|
11221
|
+
lstat = lstatSync2(path);
|
|
11092
11222
|
} catch (err) {
|
|
11093
11223
|
if (!isEnoent(err))
|
|
11094
11224
|
throw err;
|
|
@@ -11255,6 +11385,7 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
11255
11385
|
|
|
11256
11386
|
// src/lib/log-sink.ts
|
|
11257
11387
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
11388
|
+
var LOG_FOLDER_ONLY_ENV = "VINAYA_LOG_FOLDER_ONLY";
|
|
11258
11389
|
function describeFolderFallback(reason) {
|
|
11259
11390
|
if (reason.kind === "anchor-unreadable") {
|
|
11260
11391
|
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`";
|
|
@@ -11294,6 +11425,9 @@ function logsCredentialMissing(headers, env) {
|
|
|
11294
11425
|
return false;
|
|
11295
11426
|
}
|
|
11296
11427
|
function resolveLogDestinationFrom(input) {
|
|
11428
|
+
if (input.localConfig?.logs === false || input.unattended && input.trustAnchorConfig?.logs === false) {
|
|
11429
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
11430
|
+
}
|
|
11297
11431
|
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
11298
11432
|
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
11299
11433
|
return { kind: "folder", folder: spoolDir };
|
|
@@ -11313,6 +11447,10 @@ function resolveLogDestinationFrom(input) {
|
|
|
11313
11447
|
} else {
|
|
11314
11448
|
effective = local;
|
|
11315
11449
|
}
|
|
11450
|
+
if (input.folderOnly || input.env[LOG_FOLDER_ONLY_ENV] === "1") {
|
|
11451
|
+
const folder = effective && "folder" in effective && !isInsideRepo(effective.folder, input.repoRoot) ? effective.folder : input.defaultFolder;
|
|
11452
|
+
return { kind: "folder", folder };
|
|
11453
|
+
}
|
|
11316
11454
|
if (hostFromEnv(input.env) === "ci") {
|
|
11317
11455
|
if (effective && "url" in effective) {
|
|
11318
11456
|
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
@@ -11337,21 +11475,51 @@ function resolveLogDestinationFrom(input) {
|
|
|
11337
11475
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
11338
11476
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
11339
11477
|
}
|
|
11340
|
-
var
|
|
11478
|
+
var LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000;
|
|
11479
|
+
var LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5;
|
|
11480
|
+
function createTrustAnchorCache(read, now = Date.now, bounds = {
|
|
11481
|
+
retryIntervalMs: LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS,
|
|
11482
|
+
maxRetries: LOG_DESTINATION_ANCHOR_MAX_RETRIES
|
|
11483
|
+
}) {
|
|
11484
|
+
const slots = new Map;
|
|
11485
|
+
const start = (repoRoot, retries) => {
|
|
11486
|
+
const slot = {
|
|
11487
|
+
reading: Promise.resolve().then(read).catch(() => null),
|
|
11488
|
+
retries,
|
|
11489
|
+
missedAt: null
|
|
11490
|
+
};
|
|
11491
|
+
slots.set(repoRoot, slot);
|
|
11492
|
+
slot.reading.then((config) => {
|
|
11493
|
+
if (config === null)
|
|
11494
|
+
slot.missedAt = now();
|
|
11495
|
+
});
|
|
11496
|
+
return slot.reading;
|
|
11497
|
+
};
|
|
11498
|
+
return {
|
|
11499
|
+
get: (repoRoot) => {
|
|
11500
|
+
const slot = slots.get(repoRoot);
|
|
11501
|
+
if (slot === undefined)
|
|
11502
|
+
return start(repoRoot, 0);
|
|
11503
|
+
if (slot.missedAt === null)
|
|
11504
|
+
return slot.reading;
|
|
11505
|
+
if (slot.retries >= bounds.maxRetries || now() - slot.missedAt < bounds.retryIntervalMs)
|
|
11506
|
+
return slot.reading;
|
|
11507
|
+
return start(repoRoot, slot.retries + 1);
|
|
11508
|
+
},
|
|
11509
|
+
clear: () => slots.clear()
|
|
11510
|
+
};
|
|
11511
|
+
}
|
|
11512
|
+
var processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
|
|
11341
11513
|
function processTrustAnchor(repoRoot) {
|
|
11342
|
-
|
|
11343
|
-
if (cached !== undefined)
|
|
11344
|
-
return cached;
|
|
11345
|
-
const reading = safeLoadTrustAnchorConfig();
|
|
11346
|
-
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
11347
|
-
return reading;
|
|
11514
|
+
return processTrustAnchorByRepo.get(repoRoot);
|
|
11348
11515
|
}
|
|
11349
|
-
async function defaultResolveLogDestination(repo, env) {
|
|
11516
|
+
async function defaultResolveLogDestination(repo, env, folderOnly = false) {
|
|
11350
11517
|
const localConfig = loadConfig();
|
|
11351
11518
|
const unattended = isUnattendedProcess(process.env);
|
|
11352
11519
|
const repoRoot = repoRootSync();
|
|
11353
11520
|
return resolveLogDestinationFrom({
|
|
11354
11521
|
localConfig,
|
|
11522
|
+
folderOnly,
|
|
11355
11523
|
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
11356
11524
|
unattended,
|
|
11357
11525
|
env,
|
|
@@ -11360,14 +11528,16 @@ async function defaultResolveLogDestination(repo, env) {
|
|
|
11360
11528
|
});
|
|
11361
11529
|
}
|
|
11362
11530
|
function unresolvedLogDestination(env) {
|
|
11531
|
+
const loaded = loadConfig();
|
|
11532
|
+
if (loaded?.logs === false)
|
|
11533
|
+
return { kind: "none", reason: "logs: false disables Log recording" };
|
|
11363
11534
|
if (hostFromEnv(env) === "ci") {
|
|
11364
11535
|
return {
|
|
11365
11536
|
kind: "none",
|
|
11366
11537
|
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
11367
11538
|
};
|
|
11368
11539
|
}
|
|
11369
|
-
const
|
|
11370
|
-
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
11540
|
+
const localConfig = loaded?.logs && loaded.logs.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
11371
11541
|
const unattended = isUnattendedProcess(process.env);
|
|
11372
11542
|
const repoRoot = repoRootSync();
|
|
11373
11543
|
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
@@ -11407,18 +11577,18 @@ function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot =
|
|
|
11407
11577
|
function isEnoent2(err) {
|
|
11408
11578
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
11409
11579
|
}
|
|
11410
|
-
var
|
|
11580
|
+
var execFileAsync6 = promisify6(execFile6);
|
|
11411
11581
|
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
11412
11582
|
let toplevel;
|
|
11413
11583
|
try {
|
|
11414
|
-
toplevel = (await
|
|
11584
|
+
toplevel = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
11415
11585
|
} catch (err) {
|
|
11416
11586
|
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
11417
11587
|
}
|
|
11418
11588
|
if (!existsSync8(join9(toplevel, "aeg-root", "roles")))
|
|
11419
11589
|
return vinayaVersion;
|
|
11420
11590
|
try {
|
|
11421
|
-
const sha = (await
|
|
11591
|
+
const sha = (await execFileAsync6("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
11422
11592
|
return `aeg-root@${sha}`;
|
|
11423
11593
|
} catch {
|
|
11424
11594
|
return vinayaVersion;
|
|
@@ -11441,7 +11611,7 @@ var TRANCHE_ISSUE_LIST_LIMIT = 200;
|
|
|
11441
11611
|
async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
11442
11612
|
let stdout;
|
|
11443
11613
|
try {
|
|
11444
|
-
({ stdout } = await
|
|
11614
|
+
({ stdout } = await execFileAsync6("gh", [
|
|
11445
11615
|
"issue",
|
|
11446
11616
|
"list",
|
|
11447
11617
|
"--state",
|
|
@@ -11479,7 +11649,7 @@ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
|
|
|
11479
11649
|
async function confirmBacklogIssue(issue, cwd, repo) {
|
|
11480
11650
|
let stdout;
|
|
11481
11651
|
try {
|
|
11482
|
-
({ stdout } = await
|
|
11652
|
+
({ stdout } = await execFileAsync6("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
|
|
11483
11653
|
cwd,
|
|
11484
11654
|
encoding: "utf8",
|
|
11485
11655
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
@@ -11498,7 +11668,7 @@ async function confirmBacklogIssue(issue, cwd, repo) {
|
|
|
11498
11668
|
async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
11499
11669
|
let branch;
|
|
11500
11670
|
try {
|
|
11501
|
-
branch = (await
|
|
11671
|
+
branch = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
11502
11672
|
encoding: "utf8",
|
|
11503
11673
|
timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
|
|
11504
11674
|
killSignal: "SIGKILL"
|
|
@@ -11581,7 +11751,7 @@ function headShaRead(key, read, shared) {
|
|
|
11581
11751
|
}
|
|
11582
11752
|
async function resolveHeadSha(cwd) {
|
|
11583
11753
|
try {
|
|
11584
|
-
const out = (await
|
|
11754
|
+
const out = (await execFileAsync6("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
11585
11755
|
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
11586
11756
|
} catch {
|
|
11587
11757
|
return null;
|
|
@@ -11589,6 +11759,7 @@ async function resolveHeadSha(cwd) {
|
|
|
11589
11759
|
}
|
|
11590
11760
|
function defaultDeps() {
|
|
11591
11761
|
return {
|
|
11762
|
+
readConfig: loadConfig,
|
|
11592
11763
|
outboxRoot: () => join9(GLOBAL_VINAYA_HOME, "outbox"),
|
|
11593
11764
|
home: () => homedir3(),
|
|
11594
11765
|
hostname: () => osHostname(),
|
|
@@ -11772,23 +11943,59 @@ function createLogSink(overrides = {}) {
|
|
|
11772
11943
|
};
|
|
11773
11944
|
let contextCache;
|
|
11774
11945
|
let settledContext;
|
|
11946
|
+
let contextEnv = {};
|
|
11947
|
+
const resolveDestination = async (repo, env) => deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : await deps.resolveLogDestination(repo, env, deps.folderOnly);
|
|
11775
11948
|
const context = () => {
|
|
11776
11949
|
if (contextCache === undefined) {
|
|
11777
11950
|
const env = deps.env();
|
|
11951
|
+
contextEnv = env;
|
|
11778
11952
|
contextCache = Promise.all([
|
|
11779
11953
|
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
11780
11954
|
doctrine()
|
|
11781
11955
|
]).then(async ([resolved, doctrineValue]) => {
|
|
11782
11956
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
11783
|
-
settledContext = { repo, doctrine: doctrineValue, destination: await
|
|
11957
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await resolveDestination(repo, env) };
|
|
11958
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
11784
11959
|
return settledContext;
|
|
11785
11960
|
});
|
|
11786
11961
|
}
|
|
11787
11962
|
return contextCache;
|
|
11788
11963
|
};
|
|
11964
|
+
let destinationRetries = 0;
|
|
11965
|
+
let destinationRetryDueAt = 0;
|
|
11966
|
+
let destinationRetryInFlight = false;
|
|
11967
|
+
const retryDestinationIfDue = (ctx) => {
|
|
11968
|
+
if (ctx.destination.kind !== "folder" || ctx.destination.fallbackReason?.kind !== "anchor-unreadable")
|
|
11969
|
+
return;
|
|
11970
|
+
if (destinationRetryInFlight || destinationRetries >= LOG_DESTINATION_ANCHOR_MAX_RETRIES)
|
|
11971
|
+
return;
|
|
11972
|
+
if (deps.now().getTime() < destinationRetryDueAt)
|
|
11973
|
+
return;
|
|
11974
|
+
destinationRetryInFlight = true;
|
|
11975
|
+
destinationRetries++;
|
|
11976
|
+
const generation = contextCache;
|
|
11977
|
+
Promise.resolve().then(() => resolveDestination(ctx.repo, contextEnv)).then((destination) => {
|
|
11978
|
+
if (contextCache !== generation)
|
|
11979
|
+
return;
|
|
11980
|
+
if (destination.kind === "server") {
|
|
11981
|
+
settledContext = { ...ctx, destination };
|
|
11982
|
+
contextCache = Promise.resolve(settledContext);
|
|
11983
|
+
return;
|
|
11984
|
+
}
|
|
11985
|
+
if (destination.kind !== "folder" || destination.fallbackReason?.kind !== "anchor-unreadable") {
|
|
11986
|
+
destinationRetries = LOG_DESTINATION_ANCHOR_MAX_RETRIES;
|
|
11987
|
+
}
|
|
11988
|
+
}, () => {
|
|
11989
|
+
return;
|
|
11990
|
+
}).finally(() => {
|
|
11991
|
+
destinationRetryInFlight = false;
|
|
11992
|
+
destinationRetryDueAt = deps.now().getTime() + LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS;
|
|
11993
|
+
});
|
|
11994
|
+
};
|
|
11789
11995
|
const resetContext = () => {
|
|
11790
11996
|
contextCache = undefined;
|
|
11791
11997
|
settledContext = undefined;
|
|
11998
|
+
destinationRetries = 0;
|
|
11792
11999
|
};
|
|
11793
12000
|
let drainChain = Promise.resolve();
|
|
11794
12001
|
const pendingWrites = new Set;
|
|
@@ -11801,24 +12008,30 @@ function createLogSink(overrides = {}) {
|
|
|
11801
12008
|
`);
|
|
11802
12009
|
});
|
|
11803
12010
|
};
|
|
11804
|
-
const snapshot = () => {
|
|
12011
|
+
const snapshot = (attribution) => {
|
|
11805
12012
|
const env = deps.env();
|
|
11806
12013
|
return {
|
|
12014
|
+
attributed: attribution !== undefined,
|
|
11807
12015
|
host: hostFromEnv(env),
|
|
11808
12016
|
now: deps.now(),
|
|
11809
12017
|
seq: seq++,
|
|
11810
12018
|
envFields: {
|
|
11811
|
-
role: env.VINAYA_ROLE,
|
|
12019
|
+
role: attribution?.role ?? env.VINAYA_ROLE,
|
|
11812
12020
|
task: env.VINAYA_TASK,
|
|
11813
|
-
round: env.VINAYA_ROUND,
|
|
12021
|
+
round: attribution ? String(attribution.round) : env.VINAYA_ROUND,
|
|
11814
12022
|
pr: env.VINAYA_PR,
|
|
11815
12023
|
run: env.VINAYA_RUN || runId,
|
|
11816
|
-
attempt: env.VINAYA_ATTEMPT,
|
|
12024
|
+
attempt: attribution ? String(attribution.attempt) : env.VINAYA_ATTEMPT,
|
|
11817
12025
|
parent: env.VINAYA_PARENT_EVENT,
|
|
11818
12026
|
workRef: env.VINAYA_WORK_REF,
|
|
11819
12027
|
flow: env.VINAYA_FLOW,
|
|
11820
12028
|
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
11821
12029
|
runtime: env.VINAYA_RUNTIME,
|
|
12030
|
+
processId: env.VINAYA_PROCESS_ID,
|
|
12031
|
+
processVersion: env.VINAYA_PROCESS_VERSION,
|
|
12032
|
+
processDigest: env.VINAYA_PROCESS_DIGEST,
|
|
12033
|
+
runnerId: env.VINAYA_RUNNER_ID,
|
|
12034
|
+
runnerVersion: env.VINAYA_RUNNER_VERSION,
|
|
11822
12035
|
source: env.VINAYA_SOURCE
|
|
11823
12036
|
}
|
|
11824
12037
|
};
|
|
@@ -11848,7 +12061,7 @@ function createLogSink(overrides = {}) {
|
|
|
11848
12061
|
eventId: randomUUID2(),
|
|
11849
12062
|
processId,
|
|
11850
12063
|
revision: headSha,
|
|
11851
|
-
provenance: deps.provenance,
|
|
12064
|
+
provenance: call.attributed ? "parent_attributed" : deps.provenance,
|
|
11852
12065
|
inputVersions: deps.inputVersions()
|
|
11853
12066
|
});
|
|
11854
12067
|
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
@@ -11873,11 +12086,14 @@ function createLogSink(overrides = {}) {
|
|
|
11873
12086
|
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
11874
12087
|
}
|
|
11875
12088
|
};
|
|
11876
|
-
function log(e) {
|
|
12089
|
+
function log(e, attribution) {
|
|
11877
12090
|
try {
|
|
11878
|
-
const call = snapshot();
|
|
12091
|
+
const call = snapshot(attribution);
|
|
11879
12092
|
const write = async () => {
|
|
11880
12093
|
const ctx = await context();
|
|
12094
|
+
try {
|
|
12095
|
+
retryDestinationIfDue(ctx);
|
|
12096
|
+
} catch {}
|
|
11881
12097
|
if (ctx.destination.kind === "none") {
|
|
11882
12098
|
writeEvent(e, call, ctx, null, null, true);
|
|
11883
12099
|
return;
|
|
@@ -11901,9 +12117,13 @@ function createLogSink(overrides = {}) {
|
|
|
11901
12117
|
function logSync(e, opts = {}) {
|
|
11902
12118
|
try {
|
|
11903
12119
|
const call = snapshot();
|
|
11904
|
-
let ctx =
|
|
12120
|
+
let ctx = deps.readConfig()?.logs === false ? {
|
|
12121
|
+
repo: null,
|
|
12122
|
+
doctrine: "unknown",
|
|
12123
|
+
destination: { kind: "none", reason: "logs: false disables Log recording" }
|
|
12124
|
+
} : settledContext;
|
|
11905
12125
|
if (ctx === undefined) {
|
|
11906
|
-
const destination = deps.unresolvedLogDestination(deps.env());
|
|
12126
|
+
const destination = deps.readConfig()?.logs === false ? { kind: "none", reason: "logs: false disables Log recording" } : deps.unresolvedLogDestination(deps.env());
|
|
11907
12127
|
if (destination.kind === "folder" && !opts.quiet) {
|
|
11908
12128
|
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
|
|
11909
12129
|
`);
|
|
@@ -11981,7 +12201,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
11981
12201
|
function fileDiffAgainst(ref, path) {
|
|
11982
12202
|
let committed;
|
|
11983
12203
|
try {
|
|
11984
|
-
committed =
|
|
12204
|
+
committed = execFileSync8("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
11985
12205
|
encoding: "utf8",
|
|
11986
12206
|
stdio: ["ignore", "pipe", "pipe"]
|
|
11987
12207
|
}).trim();
|
|
@@ -12002,7 +12222,7 @@ function stagedDiff(args) {
|
|
|
12002
12222
|
if (!readsStagedDiff())
|
|
12003
12223
|
return "";
|
|
12004
12224
|
try {
|
|
12005
|
-
return
|
|
12225
|
+
return execFileSync8("git", ["diff", "--cached", ...args], {
|
|
12006
12226
|
encoding: "utf8",
|
|
12007
12227
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12008
12228
|
}).trim();
|
|
@@ -12012,7 +12232,7 @@ function stagedDiff(args) {
|
|
|
12012
12232
|
}
|
|
12013
12233
|
function revParse(ref) {
|
|
12014
12234
|
try {
|
|
12015
|
-
return
|
|
12235
|
+
return execFileSync8("git", ["rev-parse", "--verify", ref], {
|
|
12016
12236
|
encoding: "utf8",
|
|
12017
12237
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12018
12238
|
}).trim();
|
|
@@ -12022,7 +12242,7 @@ function revParse(ref) {
|
|
|
12022
12242
|
}
|
|
12023
12243
|
function repoRoot() {
|
|
12024
12244
|
try {
|
|
12025
|
-
return
|
|
12245
|
+
return execFileSync8("git", ["rev-parse", "--show-toplevel"], {
|
|
12026
12246
|
encoding: "utf8",
|
|
12027
12247
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12028
12248
|
}).trim();
|
|
@@ -12033,7 +12253,7 @@ function repoRoot() {
|
|
|
12033
12253
|
function changedFiles(base) {
|
|
12034
12254
|
let out;
|
|
12035
12255
|
try {
|
|
12036
|
-
out =
|
|
12256
|
+
out = execFileSync8("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
12037
12257
|
encoding: "utf8",
|
|
12038
12258
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12039
12259
|
}).trim();
|
|
@@ -12082,7 +12302,7 @@ function resolveAddedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
|
12082
12302
|
if (resolved === null || resolved === head)
|
|
12083
12303
|
continue;
|
|
12084
12304
|
try {
|
|
12085
|
-
const out =
|
|
12305
|
+
const out = execFileSync8("git", ["diff", "--name-only", "--diff-filter=A", `${ref}...HEAD`], {
|
|
12086
12306
|
encoding: "utf8",
|
|
12087
12307
|
stdio: ["ignore", "pipe", "pipe"]
|
|
12088
12308
|
}).trim();
|
|
@@ -12148,7 +12368,7 @@ function warnOnUnreadPrincipals(check, err) {
|
|
|
12148
12368
|
var CHECK_NAME = "doc-coverage-push";
|
|
12149
12369
|
function git2(args) {
|
|
12150
12370
|
try {
|
|
12151
|
-
return
|
|
12371
|
+
return execFileSync9("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
12152
12372
|
} catch {
|
|
12153
12373
|
return "";
|
|
12154
12374
|
}
|