mirror of
https://github.com/openai/codex-security.git
synced 2026-11-23 09:59:21 +08:00
fix(sdk): pass severity record efforts through to the host (#1842)
* fix(sdk): pass severity record efforts through to the host * test(sdk): cover host efforts in the records workflows * test(sdk): exercise unchanged reasoning effort at the host * fix(sdk): forward every string effort in severity record reviews --------- Co-authored-by: Codex <codex@users.noreply.github.com> Co-authored-by: Michael D'Angelo <mdangelo@openai.com> Co-authored-by: mldangelo-oai <269034524+mldangelo-oai@users.noreply.github.com>
This commit is contained in:
co-authored by
Codex
Michael D'Angelo
mldangelo-oai
parent
8faac059c6
commit
021f6a68ab
@@ -58,7 +58,8 @@ an integer from 1 through 10 (default: 3), validated before any host work.
|
||||
For each record the CLI emits that many sequential `method: "review.run"` requests,
|
||||
each with a unique request ID and params containing `requestId`, `stage: "severity-classification"`, explicit
|
||||
`model` and `effort`, `trustedInstructions`, untrusted report/rubric `prompt`, and
|
||||
an output JSON `schema`. The host must authorize the requested model and effort,
|
||||
an output JSON `schema`. The SDK and CLI forward the `effort` string unchanged.
|
||||
The host must authorize the requested model and effort,
|
||||
create a fresh independent review context, preserve the instruction/data boundary,
|
||||
and disable tools, repository access, browsing, and source inspection.
|
||||
A managed-agent host can execute this request directly in its existing session
|
||||
|
||||
@@ -46,15 +46,7 @@ export const classifySeverityRecordsInputSchema = z
|
||||
version: z.literal(1),
|
||||
rubric: severityRubricSnapshotSchema.optional(),
|
||||
model: text,
|
||||
effort: z.enum([
|
||||
"minimal",
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
"max",
|
||||
"ultra",
|
||||
]),
|
||||
effort: z.string(),
|
||||
records: z.array(
|
||||
z
|
||||
.object({
|
||||
|
||||
@@ -12,7 +12,7 @@ import { capture, dependencies } from "./cli-fixtures.js";
|
||||
|
||||
const hash = (value: string) =>
|
||||
createHash("sha256").update(value, "utf8").digest("hex");
|
||||
function input(): ClassifySeverityRecordsInput & {
|
||||
function input(effort = "high"): ClassifySeverityRecordsInput & {
|
||||
rubric: NonNullable<ClassifySeverityRecordsInput["rubric"]>;
|
||||
} {
|
||||
const markdown =
|
||||
@@ -23,7 +23,7 @@ function input(): ClassifySeverityRecordsInput & {
|
||||
version: 1,
|
||||
rubric: { revision: 4, markdown, sha256: hash(markdown) },
|
||||
model: "synthetic-model",
|
||||
effort: "high",
|
||||
effort,
|
||||
records: [
|
||||
{
|
||||
id: "canonical-one",
|
||||
@@ -46,8 +46,9 @@ function answer(request: SeverityClassificationReviewRequest) {
|
||||
};
|
||||
}
|
||||
|
||||
test("binds assessments to exact UTF-8 snapshots without rewriting the original report", async () => {
|
||||
const original = input();
|
||||
const efforts = ["", "\t", " synthetic-effort "];
|
||||
test.each(efforts)("preserves UTF-8 records and effort %p", async (effort) => {
|
||||
const original = input(effort);
|
||||
const before = structuredClone(original);
|
||||
const requests: SeverityClassificationReviewRequest[] = [];
|
||||
const result = await classifySeverityRecords(original, {
|
||||
@@ -55,7 +56,7 @@ test("binds assessments to exact UTF-8 snapshots without rewriting the original
|
||||
async run(request) {
|
||||
requests.push(request);
|
||||
expect(request.model).toBe(original.model);
|
||||
expect(request.effort).toBe("high");
|
||||
expect(request.effort).toBe(original.effort);
|
||||
expect(JSON.parse(request.prompt).rubric).toEqual([
|
||||
original.rubric.markdown,
|
||||
]);
|
||||
@@ -89,6 +90,8 @@ test("binds assessments to exact UTF-8 snapshots without rewriting the original
|
||||
});
|
||||
|
||||
test.each([
|
||||
"missing-effort",
|
||||
"numeric-effort",
|
||||
"rubric-hash",
|
||||
"finding-hash",
|
||||
"duplicate",
|
||||
@@ -99,6 +102,8 @@ test.each([
|
||||
"unsafe-revision",
|
||||
])("rejects %s before any host work", async (scenario) => {
|
||||
const data = input();
|
||||
if (scenario === "missing-effort") Reflect.deleteProperty(data, "effort");
|
||||
if (scenario === "numeric-effort") Reflect.set(data, "effort", 1);
|
||||
if (scenario === "rubric-hash") data.rubric.markdown += " ";
|
||||
if (scenario === "finding-hash") data.records[0]!.findingJson += " ";
|
||||
if (scenario === "duplicate") data.records.push(data.records[0]!);
|
||||
@@ -296,7 +301,7 @@ test.each([
|
||||
capture().stream,
|
||||
deps,
|
||||
);
|
||||
const params: ClassifySeverityRecordsInput = input();
|
||||
const params: ClassifySeverityRecordsInput = input("none");
|
||||
if (scenario === "default-rubric") delete params.rubric;
|
||||
const completed = [
|
||||
"completed",
|
||||
|
||||
Reference in New Issue
Block a user