Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/benchmark-calibration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ jobs:
CURRENT_EVALUATOR_SHA256: ${{ steps.evaluator.outputs.sha256 }}
run: |
set -euo pipefail
profile="openai/gpt-5.6-luna"
populated="$(jq -er --arg profile "$profile" '.profiles[$profile].populated | if type == "boolean" then tostring else error("Calibration populated state must be boolean") end' bench/baseline-us.json)"
profile="openai/gpt-6-luna"
populated="$(jq -er --arg profile "$profile" '.profiles[$profile].populated | if type == "boolean" then tostring else error("Calibration populated state must be boolean") end' bench/baseline-gpt6-us.json)"
case "$populated" in
false) exit 0 ;;
true) ;;
*) echo "::error::Calibration baseline must declare a boolean populated state."; exit 1 ;;
esac
test -s bench/baseline-us.attestation.json || {
test -s bench/baseline-gpt6-us.attestation.json || {
echo "::error::Populated recalibration requires the retained baseline attestation."
exit 1
}
source_sha="$(jq -er --arg profile "$profile" '.profiles[$profile].calibration.sourceSha' bench/baseline-us.json)"
source_sha="$(jq -er --arg profile "$profile" '.profiles[$profile].calibration.sourceSha' bench/baseline-gpt6-us.json)"
[[ "$source_sha" =~ ^[0-9a-f]{40,64}$ ]] || {
echo "::error::Prior calibration source digest is invalid."
exit 1
Expand All @@ -72,7 +72,7 @@ jobs:
echo "::error::Recalibration requires a new main source commit."
exit 1
}
prior_evaluator="$(jq -er '.corpus.evaluatorSha256' bench/baseline-us.json)"
prior_evaluator="$(jq -er '.corpus.evaluatorSha256' bench/baseline-gpt6-us.json)"
[[ "$prior_evaluator" =~ ^[0-9a-f]{64}$ && "$CURRENT_EVALUATOR_SHA256" =~ ^[0-9a-f]{64}$ ]] || {
echo "::error::Calibration evaluator digest is invalid."
exit 1
Expand All @@ -86,8 +86,8 @@ jobs:
echo "::error::Prior calibration registry source mismatch."
exit 1
}
gh attestation verify bench/baseline-us.json \
--bundle bench/baseline-us.attestation.json \
gh attestation verify bench/baseline-gpt6-us.json \
--bundle bench/baseline-gpt6-us.attestation.json \
--repo postil-dev/postil-cli \
--signer-workflow postil-dev/postil-cli/.github/workflows/benchmark-calibration.yml \
--signer-digest "$source_sha" \
Expand Down Expand Up @@ -459,7 +459,7 @@ jobs:
run: |
set -euo pipefail
bun run bench:compare -- \
--baseline baseline-us.json \
--baseline baseline-gpt6-us.json \
--binary "${RUNNER_TEMP}/prepared/postil" \
--screen-profile ../provisional-models-us.json \
--cohort-manifest "${RUNNER_TEMP}/prepared/cohort.json" \
Expand Down Expand Up @@ -498,13 +498,13 @@ jobs:
id: attest-baseline
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
with:
subject-path: ${{ github.workspace }}/bench/baseline-us.json
subject-path: ${{ github.workspace }}/bench/baseline-gpt6-us.json
- name: Stage populated baseline evidence
run: |
mkdir -p "${RUNNER_TEMP}/populated-baseline"
cp bench/baseline-us.json "${RUNNER_TEMP}/populated-baseline/baseline-us.json"
cp bench/baseline-gpt6-us.json "${RUNNER_TEMP}/populated-baseline/baseline-gpt6-us.json"
cp "${{ steps.attest-baseline.outputs.bundle-path }}" \
"${RUNNER_TEMP}/populated-baseline/baseline-us.attestation.json"
"${RUNNER_TEMP}/populated-baseline/baseline-gpt6-us.attestation.json"
- name: Upload populated baseline
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
profile="openai/gpt-5.6-luna"
profile="openai/gpt-6-luna"
jq -e --arg profile "$profile" '.profiles[$profile].populated == true' \
bench/baseline-us.json >/dev/null && test -s bench/baseline-us.attestation.json || {
bench/baseline-gpt6-us.json >/dev/null && test -s bench/baseline-gpt6-us.attestation.json || {
echo "::error::New releases require the populated Azure/US baseline and its main-branch first-attempt calibration attestation."
exit 1
}
source_sha="$(jq -er --arg profile "$profile" \
'.profiles[$profile] | select(.populated == true) | .calibration.sourceSha' \
bench/baseline-us.json)"
bench/baseline-gpt6-us.json)"
[[ "$source_sha" =~ ^[0-9a-f]{40,64}$ ]] || {
echo "::error::The Luna baseline has an invalid calibration source digest."
exit 1
Expand All @@ -90,8 +90,8 @@ jobs:
echo "::error::The Luna baseline source is not protected by the calibration registry."
exit 1
}
gh attestation verify bench/baseline-us.json \
--bundle bench/baseline-us.attestation.json \
gh attestation verify bench/baseline-gpt6-us.json \
--bundle bench/baseline-gpt6-us.attestation.json \
--repo postil-dev/postil-cli \
--signer-workflow postil-dev/postil-cli/.github/workflows/benchmark-calibration.yml \
--signer-digest "$source_sha" \
Expand Down Expand Up @@ -531,7 +531,7 @@ jobs:
set -euo pipefail
comparison=0
bun run bench:compare -- \
--baseline baseline-us.json \
--baseline baseline-gpt6-us.json \
--binary "${{ github.workspace }}/target/release/postil" \
--screen-profile ../provisional-models-us.json \
--cohort-manifest "${{ runner.temp }}/bench-live-cohort.json" \
Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "postil-cli"
version = "0.9.21"
version = "0.9.22"
edition = "2024"
description = "Postil: a low-noise AI review gate. Silent on clean PRs, hard gate on real risk."
license = "Apache-2.0"
Expand Down Expand Up @@ -29,7 +29,7 @@ dirs = "6.0.0"
fs2 = "0.4.3"
futures = "0.3.32"
globset = "0.4.18"
hickory-resolver = "0.26.1"
hickory-resolver = "0.26.3"
httpdate = "1.0.3"
libc = "0.2.186"
memmap2 = "0.9.11"
Expand Down
13 changes: 13 additions & 0 deletions bench/baseline-gpt6-us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": 2,
"corpus": {
"fixtureCorpusSha256": "3a53ed4b0967c275cd47eb7633a4b56c94be1fdd2bd69bde0fc3eb77562c4924",
"evaluatorSha256": "d92d1824de9c10fccd27b948e4e45b35d4406d5d219894cacdbd21ea4a9eee0b"
},
"profiles": {
"openai/gpt-6-luna": {
"populated": false,
"instructions": "Run the existing benchmark-calibration workflow from current main on its first attempt. Import its attested, predeclared ten-slot calibration baseline and bundle in a later change before release."
}
}
}
31 changes: 23 additions & 8 deletions bench/src/compare-baseline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
import {
formatCanonicalDecimal,
parseCanonicalDecimal,
providerContractEvidence,
providerContractSha256,
sumCanonicalDecimals,
type ProviderContractEvidence,
Expand Down Expand Up @@ -101,22 +102,22 @@ test("release prerequisite rejects an unpopulated US baseline before attestation
try {
await mkdir(resolve(directory, "bench"));
const check = async (): Promise<{ code: number; output: string }> => {
const child = Bun.spawn(["bash", "-c", 'set -euo pipefail\nprofile="openai/gpt-5.6-luna"\n' + prerequisite], {
const child = Bun.spawn(["bash", "-c", 'set -euo pipefail\nprofile="openai/gpt-6-luna"\n' + prerequisite], {
cwd: directory, stdout: "pipe", stderr: "pipe", timeout: 10_000,
});
const [code, stdout, stderr] = await Promise.all([child.exited, new Response(child.stdout).text(), new Response(child.stderr).text()]);
return { code, output: stdout + stderr };
};
const baseline = (populated: boolean) => JSON.stringify({ profiles: { "openai/gpt-5.6-luna": { populated } } });
await writeFile(resolve(directory, "bench/baseline-us.json"), baseline(false));
const baseline = (populated: boolean) => JSON.stringify({ profiles: { "openai/gpt-6-luna": { populated } } });
await writeFile(resolve(directory, "bench/baseline-gpt6-us.json"), baseline(false));
const missing = await check();
expect(missing.code).toBe(1);
expect(missing.output).toContain("New releases require the populated Azure/US baseline");
await writeFile(resolve(directory, "bench/baseline-us.attestation.json"), JSON.stringify({ fixture: true }));
await writeFile(resolve(directory, "bench/baseline-gpt6-us.attestation.json"), JSON.stringify({ fixture: true }));
expect((await check()).code).toBe(1);
await writeFile(resolve(directory, "bench/baseline-us.json"), baseline(true));
await writeFile(resolve(directory, "bench/baseline-gpt6-us.json"), baseline(true));
expect((await check()).code).toBe(0);
await writeFile(resolve(directory, "bench/baseline-us.attestation.json"), "");
await writeFile(resolve(directory, "bench/baseline-gpt6-us.attestation.json"), "");
expect((await check()).code).toBe(1);
expect(workflow.indexOf("gh attestation verify", end)).toBeGreaterThan(end);
} finally {
Expand Down Expand Up @@ -146,8 +147,20 @@ test("retained attested US calibration binds its source and route while the embe
expect(usBaselineProfile.calibration.reportCount).toBe(10);
expect(() => assertBaselineCalibrationIntegrity(usBaselineProfile)).not.toThrow();
expect(usBaselineProfile.calibration.sourceSha).toMatch(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u);
expect(usBaselineProfile.screeningProfileSha256).toBe(us.sha256);
expect(usBaselineProfile.calibration.providerContractSha256).toBe(us.providerContractSha256);
const historicalProfileBytes = historicalArtifact("provisional-models-us.json");
const historicalProfile = JSON.parse(historicalProfileBytes);
const historicalContract = providerContractEvidence(
historicalProfile.upstreamProviderIdentity,
historicalProfile.upstreamProviderRoute,
new Map(historicalProfile.modelPriceBounds.map((bound: {
model: string; inputMicrosPerMillionTokens: number; outputMicrosPerMillionTokens: number;
}) => [bound.model, bound])),
historicalProfile.generatorChain,
historicalProfile.scorerChain,
);
expect(usBaselineProfile.screeningProfileSha256).toBe(createHash("sha256").update(historicalProfileBytes).digest("hex"));
expect(usBaselineProfile.calibration.providerContractSha256).toBe(providerContractSha256(historicalContract));
expect(usBaselineProfile.screeningProfileSha256).not.toBe(us.sha256);
expect(usBaselineProfile.upstreamProviderIdentity).toBe("Azure");
const attestation = JSON.parse(attestationBytes);
expect(attestation.mediaType).toBe("application/vnd.dev.sigstore.bundle.v0.3+json");
Expand Down Expand Up @@ -361,6 +374,7 @@ async function inputBoundReport(screeningProfilePath = resolve(import.meta.dir,
screeningProfileMetadata(screeningProfilePath),
]);
Object.assign(report.summary, {
model: profile.providerContract.modelPriceBounds.find(bound => bound.roles.includes("generator"))!.model,
binarySha256: createHash("sha256").update(binary).digest("hex"),
fixtureCorpusSha256: createHash("sha256")
.update(JSON.stringify(parsedCases))
Expand Down Expand Up @@ -1126,6 +1140,7 @@ describe("three-report aggregation compatibility", () => {
const reports = Array.from({ length: 5 }, () => {
const report = fakeReport();
Object.assign(report.summary, {
model: us.providerContract.modelPriceBounds.find(bound => bound.roles.includes("generator"))!.model,
screeningProfileSha256: us.sha256,
upstreamProviderRoute: us.upstreamProviderRoute,
providerContract: us.providerContract,
Expand Down
16 changes: 9 additions & 7 deletions bench/src/livemodels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,17 +1395,19 @@ describe("managed admission workflow", () => {
expect(calibration).toContain("--record");
expect(calibration).not.toContain("bench/baseline.json");
expect(calibration.match(/--screen-profile \.\.\/provisional-models-us\.json/gu)).toHaveLength(5);
expect(calibration).toContain("--baseline baseline-us.json");
expect(calibration).toContain("subject-path: ${{ github.workspace }}/bench/baseline-us.json");
expect(calibration).toContain('cp bench/baseline-us.json "${RUNNER_TEMP}/populated-baseline/baseline-us.json"');
expect(calibration).toContain("/populated-baseline/baseline-us.attestation.json");
expect(calibration).toContain('profile="openai/gpt-6-luna"');
expect(calibration).toContain("--baseline baseline-gpt6-us.json");
expect(calibration).toContain("subject-path: ${{ github.workspace }}/bench/baseline-gpt6-us.json");
expect(calibration).toContain('cp bench/baseline-gpt6-us.json "${RUNNER_TEMP}/populated-baseline/baseline-gpt6-us.json"');
expect(calibration).toContain("/populated-baseline/baseline-gpt6-us.attestation.json");
expect(calibration).toContain("name: benchmark-calibration-us-baseline-${{ github.run_id }}");
expect(release).toContain("New releases require the populated Azure/US baseline and its main-branch first-attempt calibration attestation.");
expect(release).not.toContain("provisional-models.json");
expect(release).toContain("--screen-profile ../provisional-models-us.json");
expect(release).not.toContain("bench/baseline.json");
expect(release).toContain("--baseline baseline-us.json");
expect(release).toContain("--bundle bench/baseline-us.attestation.json");
expect(release).toContain('profile="openai/gpt-6-luna"');
expect(release).toContain("--baseline baseline-gpt6-us.json");
expect(release).toContain("--bundle bench/baseline-gpt6-us.attestation.json");
expect(release).toContain("--signer-workflow postil-dev/postil-cli/.github/workflows/benchmark-calibration.yml");
expect(release).not.toContain("workflow_dispatch");
expect(release).toContain("name: Require the unique first release run for this tag");
Expand All @@ -1415,7 +1417,7 @@ describe("managed admission workflow", () => {
expect(release).toContain("group: release-${{ github.ref_name }}");
expect(release).toContain('gh release view "${GITHUB_REF_NAME}"');
expect(release).toContain("name: Verify the attested Azure/US Luna calibration baseline");
expect(release).toContain("bench/baseline-us.attestation.json");
expect(release).toContain("bench/baseline-gpt6-us.attestation.json");
expect(release).toContain('git/ref/tags/postil-calibration-${source_sha}');
expect(release).toContain(
"--signer-workflow postil-dev/postil-cli/.github/workflows/benchmark-calibration.yml",
Expand Down
11 changes: 6 additions & 5 deletions bench/src/scorer-eval.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ describe("parseModels", () => {
test("uses the embedded Luna scorer qualification candidate", async () => {
const defaults = await loadEmbeddedScorerDefaults();
expect(defaults.enabled).toBe(true);
expect(defaults.qualification_candidates).toEqual(["openai/gpt-5.6-luna"]);
expect(parseModels(undefined, defaults.qualification_candidates)).toEqual(["openai/gpt-5.6-luna"]);
expect(defaults.qualification_candidates).toEqual(["openai/gpt-6-luna"]);
expect(parseModels(undefined, defaults.qualification_candidates)).toEqual(["openai/gpt-6-luna"]);
});
});

Expand Down Expand Up @@ -2607,6 +2607,7 @@ test("diagnostic custody rejects dirty, stale and mismatched inputs before gener
const binary = postilBinaryPath();
const cliBinarySha256 = createHash("sha256").update(await readFile(binary)).digest("hex");
const input = { binary, sourceSha, evaluatorSha256, cliBinarySha256, keyName: "POSTIL_API_KEY" };
const pricedModels = [...new Set([GENERATOR_MODEL, ...(await loadEmbeddedScorerDefaults()).qualification_candidates])];
const keyPrevious = process.env.POSTIL_API_KEY;
process.env.POSTIL_API_KEY = crypto.randomUUID();
const dirty = await mkdtemp(join(tmpdir(), "postil-diagnostic-dirty-"));
Expand All @@ -2629,7 +2630,7 @@ test("diagnostic custody rejects dirty, stale and mismatched inputs before gener
identityMode === "missingRecovered" && adjudicationCalls === 1);
if (omitIdentity) identityFailures++;
res.writeHead(200, { "content-type": "application/json" });
res.end(JSON.stringify({ ...(omitIdentity ? {} : { model: GENERATOR_MODEL, provider: "Azure" }),
res.end(JSON.stringify({ ...(omitIdentity ? {} : { model: JSON.parse(body).model, provider: "Azure" }),
choices: [{ finish_reason: "stop", message: { content: adjudication ?? JSON.stringify({
scores: [{ confidence: 0.2, kind: "uncertainty", reason: "The claimed runtime break is unsupported by the change." }],
}) } }], usage: { prompt_tokens: 30, completion_tokens: 10, cost: 0.000045 } }));
Expand All @@ -2639,9 +2640,9 @@ test("diagnostic custody rejects dirty, stale and mismatched inputs before gener
const target = String(url);
if (new URL(target).origin === "https://openrouter.ai" && new URL(target).pathname === "/api/v1/endpoints/zdr") {
calls++; pricingCalls++;
return Response.json({ data: [{ model_id: GENERATOR_MODEL, provider_name: "Azure", tag: "azure/us", status: 0,
return Response.json({ data: pricedModels.map(model_id => ({ model_id, provider_name: "Azure", tag: "azure/us", status: 0,
supported_parameters: ["max_tokens", "max_completion_tokens", "reasoning", "reasoning_effort", "temperature", "response_format", "structured_outputs"],
pricing: { prompt: "0.000001", completion: "0.000002" } }] });
pricing: { prompt: "0.000001", completion: "0.000002" } })) });
}
if (new URL(target).origin === "https://openrouter.ai" && new URL(target).pathname === "/api/v1/chat/completions") {
calls++;
Expand Down
Loading
Loading