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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Local candidate — 2026-10-31

Add an opt-in Comic build result 1.1.0 candidate for confirmed no-output
rate-limit failures and bounded synthetic retry conformance. Released v1
artifacts and default behavior are preserved. No publication or production
adoption is declared.

## Unreleased — Comic Manifest revision and approval boundaries (#95)

- Pin the exact merged Codex approval-time clarification and its synthetic
Expand Down
13 changes: 13 additions & 0 deletions CONSTITUTION_CONFORMANCE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## Studio #99 Codex publication and Platform adoption — 2026-10-09

## O02/O03 local retry candidate — 2026-10-31

Owner/reviewer: @andrewperis. Constitution 1.0.0 at
`a9cc8a503aa30e17820edc62ac95f7cbe10e0564`. Profiles: universal,
RFC/specification and runtime implementation. Bounded synthetic, in-memory-only
rate-limit retry candidate; exact version negotiation, actual provenance,
protected outcome evidence, immutable terminal readback, original budgets and
explicit caller authority. No new dependencies, private data, creative work or
exception. Tests and candidate decision documents provide technical evidence;
owner normative acceptance, production adoption and publication remain pending.
Released v1 artifacts remain unchanged. Re-review on any provider, storage,
identity, authority, retention or scope expansion.

Owner: @andrewperis. Constitution 1.0.0 at
`a9cc8a503aa30e17820edc62ac95f7cbe10e0564`. Platform base:
`9476aeb27246230d982bd8cfde7cfc0d82939de7`, including merged preparation PR #42.
Expand Down
43 changes: 43 additions & 0 deletions docs/offline-orchestration-prototype.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,46 @@ only accepted production input. A completed mock result only demonstrates the
synthetic lifecycle and structural compatibility; it does not establish content
quality, rights, safety, approval, release eligibility, or publication
authority.

## Local opt-in no-output retry candidate (2026-10-31)

Default behavior described above remains available. Passing
`noOutputResultVersion: '1.1.0'` to `submit` explicitly selects the **unreleased**
Comic build-result candidate for confirmed no-action rate-limit failures only.
Success continues to emit v1. Other versions fail before admission. Cancellation,
validation failure and timeout remain unmapped when no verified output exists.

```js
const first = await runner.submit({
productionSource,
noOutputResultVersion: '1.1.0',
mockOutcome: { kind: 'rate-limit', retry_after_ms: 10 }
});
// After the delay, while the original job deadline and budgets permit:
const second = await runner.retry({ authorizeRetry: true });
```

The first failed result has `outputs: []`, `diagnostics: ['OUTPUT_MISSING']`,
and one actual-input transformation with empty output digests and false withheld
flags. Immutable outcome and result bytes plus terminal linkage must verify.
Retry rechecks pinned inputs, prompt, protected outcome and terminal result
before allocating IDs and again immediately before dispatch after async mock
preflight. IDs are fresh; the prepared event links `retry_of_attempt_id`.
The second attempt always closes the job; there is no third attempt or hidden
retry. Delay is measured conservatively from terminal completion. A caller may
use `closeJob()` instead. A restart can only inspect; it cannot resume retry.

The experimental validator lives in `src/comic-manifest/result-candidate.js`;
the stable `validateComicManifest` entry point continues to reject 1.1.0.
`candidate-contract.js` pins exact local Codex schema bytes. Regenerate with:

```sh
node scripts/generate-comic-result-candidate.mjs /path/to/codex/schemas/json/comic-manifest/v1.1/comic-build-result.schema.json
```

Codex's `specs/comic-build-result-1.1-candidate.md` records the additive minor
compatibility choice, exact schema ID, lifecycle and migration boundary. This
is a local implementation candidate, not a published contract pin or production
consumer adoption. Existing release manifests, v1 validators and fixtures are
unchanged. O02/O03 owner review remains pending. Real providers, durable storage,
cancellation retries, timeout/integrity mapping and production use are excluded.
21 changes: 21 additions & 0 deletions scripts/generate-comic-result-candidate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createRequire } from 'node:module';
import { createHash } from 'node:crypto';
import { readFile, writeFile } from 'node:fs/promises';
import Ajv2020 from 'ajv/dist/2020.js';
import addFormats from 'ajv-formats';
import standaloneCode from 'ajv/dist/standalone/index.js';
import { COMIC_BUILD_RESULT_CANDIDATE as pin } from '../src/comic-manifest/candidate-contract.js';
const require = createRequire(import.meta.url);
const lock = JSON.parse(await readFile(new URL('../package-lock.json', import.meta.url)));
for (const [name, version] of Object.entries({ ajv: '8.20.0', 'ajv-formats': '3.0.1' })) {
if (require(`${name}/package.json`).version !== version || lock.packages[`node_modules/${name}`].version !== version) throw new Error('Validator dependency mismatch');
}
const bytes = await readFile(process.argv[2]);
if (bytes.length !== pin.byte_size || 'sha256:' + createHash('sha256').update(bytes).digest('hex') !== pin.sha256) throw new Error('Candidate schema identity mismatch');
const schema = JSON.parse(bytes);
if (schema.$id !== pin.schema_id) throw new Error('Candidate schema ID mismatch');
const ajv = new Ajv2020({ strict: true, strictRequired: false, strictTypes: false, ownProperties: true, code: { source: true, esm: true, lines: true } });
addFormats(ajv);
ajv.addSchema(schema);
await writeFile(new URL('../src/comic-manifest/generated/result-v1.1-candidate.js', import.meta.url),
`// Generated from local ${pin.repository}@${pin.commit}; ${pin.source_path}; ${pin.sha256}; ${pin.byte_size} bytes.\n// Unreleased candidate; rebuild with scripts/generate-comic-result-candidate.mjs.\nimport { createRequire } from 'node:module';\nconst require = createRequire(import.meta.url);\n` + standaloneCode(ajv, { result: schema.$id }));
11 changes: 11 additions & 0 deletions src/comic-manifest/candidate-contract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Local candidate only; not a released contract or production adoption.
export const COMIC_BUILD_RESULT_CANDIDATE = Object.freeze({
"repository": "DefinitelySecureStudio/codex",
"commit": "780de1c7e3b76e02f43f0a594991e3cf7fe874f8",
"version": "1.1.0",
"status": "unreleased-local-candidate",
"schema_id": "urn:definitely-secure:contract:comic-manifest:1.1.0:comic-build-result",
"source_path": "schemas/json/comic-manifest/v1.1/comic-build-result.schema.json",
"byte_size": 32330,
"sha256": "sha256:aee6887e056ca709717f579c46e98c9da4c5d9214735af7137ec457767ed231d"
});
3,972 changes: 3,972 additions & 0 deletions src/comic-manifest/generated/result-v1.1-candidate.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/comic-manifest/output-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function record(source, kind) {
return result.value.kind === kind ? result : failure('RECORD_KIND');
}

function buildOutputCompatibility(production, result) {
export function buildOutputCompatibility(production, result) {
const expectedProduction = {
production_id: production.value.production_id,
revision: production.value.revision,
Expand Down
37 changes: 37 additions & 0 deletions src/comic-manifest/result-candidate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { createHash } from 'node:crypto';
import { canonicalJson } from '../prompt-sdk/canonical-json.js';
import { parseComicManifestJson } from './parse-json.js';
import { validateLocalSemantics } from './semantics.js';
import { buildOutputCompatibility } from './output-compatibility.js';
import { validateComicManifest } from './validate.js';
import { result as schema } from './generated/result-v1.1-candidate.js';
const failure = code => ({ valid: false, diagnostics: [{ stage: 'candidate', code }] });
const same = (a, b) => canonicalJson(a) === canonicalJson(b);

/** Explicit, unreleased local candidate. The stable v1 entry point never selects it. */
export function validateComicBuildResultCandidate(source, productionSource) {
const parsed = parseComicManifestJson(source);
if (!parsed.valid) return parsed;
try {
if (!schema(parsed.value)) return failure('SCHEMA_INVALID');
} catch { return failure('SCHEMA_INVALID'); }
finally { schema.errors = null; }
const value = parsed.value;
const noOutput = value.execution.transformations.some(t => t.output_digests.length === 0);
const code = validateLocalSemantics(value, noOutput);
if (code) return failure(code);
const production = validateComicManifest(productionSource);
if (!production.valid || production.value.kind !== 'comic-production') return failure('PRODUCTION_INVALID');
const p = production.value;
if (!same(value.production, { production_id: p.production_id, revision: p.revision, identity: production.identity })
|| !same(value.inputs, p.inputs)) return failure('PRODUCTION_LINK');
if (['public', 'internal', 'confidential', 'restricted'].indexOf(value.classification)
< ['public', 'internal', 'confidential', 'restricted'].indexOf(p.classification)) return failure('CLASSIFICATION');
if (noOutput && !same(value.execution.transformations[0].input_digests,
[p.inputs.canon.artifact.sha256, p.inputs.prompts[0].identity.sha256])) return failure('ACTUAL_INPUTS');
Comment on lines +30 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle productions without prompt bindings

The Comic Manifest schema permits inputs.prompts to be empty, so a schema-valid production with no prompt bindings and a no-output transformation containing only the canon digest reaches this expression and throws while reading prompts[0].identity. A validation API should return an ACTUAL_INPUTS/production diagnostic for this supported shape rather than crashing; derive the expected inputs without assuming a first prompt.

Useful? React with 👍 / 👎.

const compatible = buildOutputCompatibility(production, { value });
if (compatible) return compatible;
const canonical = canonicalJson(value);
return { valid: true, value, diagnostics: [], identity: { canonicalization: 'studio-json-v1',
byte_size: Buffer.byteLength(canonical), sha256: 'sha256:' + createHash('sha256').update(canonical).digest('hex') } };
}
12 changes: 6 additions & 6 deletions src/comic-manifest/semantics.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ function inputs(input, classification) {
}
}
}
function execution(e, isPublic) {
function execution(e, isPublic, noOutput = false) {
dependency(e.tool);
need(executionTime(e.started_at) <= executionTime(e.finished_at), 'TIME_ORDER');
unique(e.transformations.map(t => t.step_id), 'DUPLICATE_ID');
for (const t of e.transformations) {
if (!isPublic) need(t.input_digests.length > 0 && t.output_digests.length > 0 && !t.private_inputs_withheld && !t.private_outputs_withheld, 'TRANSFORMATION');
if (!isPublic) need(t.input_digests.length > 0 && (t.output_digests.length > 0 || noOutput) && !t.private_inputs_withheld && !t.private_outputs_withheld, 'TRANSFORMATION');
else need((t.input_digests.length > 0 || t.private_inputs_withheld) && (t.output_digests.length > 0 || t.private_outputs_withheld), 'TRANSFORMATION');
}
for (const g of e.generation) unique(g.parameters.map(p => p.name), 'DUPLICATE_ID');
Expand All @@ -76,11 +76,11 @@ function production(p) {
need(p.renditions.some(r => r.required), 'REQUIRED_OUTPUT');
p.renditions.forEach(r => { dimensions(r); renditionProfile(r); });
}
function result(r) {
function result(r, noOutput = false) {
inputs(r.inputs, r.classification);
unique(r.outputs.map(x => x.rendition_id), 'DUPLICATE_ID');
unique(r.gates.map(x => x.gate), 'DUPLICATE_ID');
r.outputs.forEach(output => { dimensions(output); renditionProfile(output); }); execution(r.execution, false);
r.outputs.forEach(output => { dimensions(output); renditionProfile(output); }); execution(r.execution, false, noOutput);
need(r.inputs.dependencies.some(d => same(d, r.execution.tool)), 'TOOL_REFERENCE');
}
function release(r) {
Expand Down Expand Up @@ -112,7 +112,7 @@ function approval(a) {
}
const checks = { 'comic-production': production, 'comic-build-result': result, 'comic-public-release': release, 'comic-approval-binding': approval };
/** Only called with schema-valid, bounded, immutable parsed data. */
export function validateLocalSemantics(value) {
try { checks[value.kind](value); return null; }
export function validateLocalSemantics(value, noOutput = false) {
try { checks[value.kind](value, noOutput); return null; }
catch (code) { return typeof code === 'string' ? code : 'SEMANTIC_INVALID'; }
}
Loading
Loading