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
68 changes: 50 additions & 18 deletions docs/o08-durable-resume-decision-packet.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ creative material.

## Current evidence and gap

Platform `main` at `e0d31cf9505858aea81f94615dc18eb546197c60` has a bounded
same-process retry and an experimental local file store with atomic claims and
durable writes. The first attempt is retry-eligible only when its verified
provider outcome is the exact rate-limit-before-acceptance case. Explicit retry
At the start of this slice, Platform `main` at `31fd4d0` had bounded
same-process retry and an experimental opt-in local-file resume path with
atomic claims and durable writes. The default prototype remains in-memory.
The first attempt is retry-eligible only when its verified provider outcome is
the exact rate-limit-before-acceptance case. Explicit retry
then rechecks current authority and immutable evidence, honors the original
deadline and two-attempt limit, and creates one new attempt with a new execution
ID and idempotency key. Recovery after a new runner/process is read-only.
ID and idempotency key. The opt-in synthetic no-context path can resume only
the narrowly eligible first attempt after restart; inspection remains
read-only, and other recovery states are not replayed.

The ordinary prototype defaults to in-memory state and monotonic retry timing.
The opt-in local-file store supplies the durable primitives used by the
Expand All @@ -26,10 +29,10 @@ Platform mock currently derives a distinct key for each attempt. No existing
contract here states that an arbitrary adapter/provider will honor that key or
retain a deduplication record.

Therefore the current safe retry proof does not generalize to replaying an
The original same-process retry proof did not generalize to replaying an
uncertain dispatch. A dispatch marker without a verified provider outcome must
remain unresolved. A restart-resume implementation also needs a way to verify
that both the original job deadline and `retry_not_before` remain valid without
remain unresolved. The later bounded resume implementation described below
adds an injected stable time authority to verify both original bounds without
resetting the budget or shortening the retry delay.

## Recommended first bounded resume contract
Expand Down Expand Up @@ -150,10 +153,10 @@ and metadata. No signing key or separate integrity service is introduced.

The initial storage slice supplies local persistent store and claim primitives
plus restart/corruption tests, but does not reconstruct jobs or dispatch resumed
attempts. The bounded follow-up below adds only read-only candidate
rehydration/classification; it does not consume a claim or dispatch. A later
slice must integrate writable resume and effect authorization. O09 remains open
and is not satisfied by these primitives.
attempts. The bounded follow-up below adds read-only candidate
rehydration/classification; it does not consume a claim or dispatch. The
subsequent writable-resume slice below adds only the approved synthetic
no-context path. O09 remains open and is not satisfied by these primitives.

## Bounded read-only candidate rehydration slice — 2026-11-08

Expand Down Expand Up @@ -246,11 +249,18 @@ separate and unaccepted.
`resume-subprocess.test.js` seeds only the pinned Comic Manifest fixture in a
private temporary local store, then exercises the runner from fresh Node child
processes. It verifies: a new process completes attempt two with the original
attempt linkage; two concurrent processes contend while one is paused in
preflight and only one dispatches; process exit immediately after claim leaves
a held claim with no takeover; exit after the durable dispatch marker leaves no
mock effect and no replay; and exit after one mock effect plus a durable but
unlinked provider-outcome blob is quarantined without a second mock effect.
attempt linkage; two processes are released together at a barrier immediately
before the real atomic claim and yield one claim/second dispatch. The contender
may observe either the complete held record or a partial record and fail closed
as `reconciliation-required`. A separate staggered contention case pauses a
claim winner in preflight; process exit
immediately after claim leaves a held claim with no takeover; exit after the
durable dispatch marker leaves no mock effect and no replay; and exit after one
mock effect plus a durable but unlinked provider-outcome blob is quarantined
without a second mock effect. A deterministic worker fixture creates an empty
claim record before resume; the runner returns `reconciliation-required`,
performs no second dispatch, and a later process does not take over the partial
record.
The test-only worker records every adapter `execute()` entry in a shared
temporary per-execution effect log, including normal restarts and both crash
points; all call counts are checked against the durable event history.
Expand Down Expand Up @@ -284,7 +294,7 @@ and zero unauthorized effects.
| `retry_not_before >= original_deadline` | No eligible time interval exists; do not resume | 0 | Both original bounds retained |
| Time authority epoch is unknown/different, unavailable, or rolled back | Unverifiable; do not resume | 0 | No use of persisted monotonic observation to infer elapsed reboot time |
| Authority is denied, expired, revoked, missing, or unverifiable | Deny resume | 0 | No protected evidence read after denial; no dispatch |
| Two runners race to resume the same eligible job | One confirmed claim at most; loser denied/conflict | At most 1 total | Atomic transaction; no automatic takeover; no duplicate dispatch |
| Two runners race to resume the same eligible job | One confirmed claim at most; loser reports held or reconciliation-required if the claim record is not yet complete | At most 1 total | Exclusive claim creation; malformed/partial claims fail closed; no automatic takeover or duplicate dispatch |
| Attempt limit already consumed | Exhausted; do not resume | 0 | Existing attempts preserved |
| Required event/blob is missing, malformed, corrupt, mismatched, or ambiguous | Quarantine/reconciliation required | 0 | No success-implying write and no provider call |
| Persisted bytes and plain hashes are both edited to a self-consistent forgery | Outcome follows selected threat model; hashes alone cannot authenticate it | 0 | Test demonstrates limitation; require a protected chain/root or trusted-storage assumption |
Expand Down Expand Up @@ -345,6 +355,28 @@ This validates the proposal's scenario logic only. It is not wired to the
orchestration runner and does not establish runtime conformance, implement a
durable store/time authority, prove storage authenticity, or satisfy O08.

## O08 acceptance evidence map — 2026-11-09

This map distinguishes executable prototype evidence from the separate
reference-only proposal model. The proposal harness is not wired into the
runner.

| Acceptance area | Runner/store evidence | Reference-only or remaining limit |
| --- | --- | --- |
| Candidate boundaries and corrupt state | `resume-candidate.test.js` covers candidate classification; `local-file-store.test.js` covers persistence and corruption. | The proposal harness models additional time/async combinations; those cases do not prove runner behavior. |
| Current authority, protected evidence and retry lineage | `resume-candidate.test.js` and runner retry/resume tests cover denial, evidence validation, attempt linkage and no dispatch on failed gates. | Context-enabled resume and arbitrary providers are excluded. |
| One-shot claims and process contention | Resume/candidate runner tests and `local-file-store.test.js` cover claim behavior. `resume-subprocess.test.js` releases two processes together immediately before `claimResume`, asserting one claim, one second attempt, two total dispatch markers and one mock effect. | In the file-creation/write window, a contender may see an incomplete record and return `reconciliation-required`; deterministic coverage confirms fail-closed behavior and no takeover. A separate test covers staggered preflight contention. Filesystem/OS trust assumptions apply. |
| Restart and crash points | `resume-subprocess.test.js` verifies restart linkage, permanent and partial claim/no takeover, no replay after marker, and quarantine after an unlinked outcome blob; the shared effect log counts actual mock calls. | Process-crash tests do not simulate power loss or prove behavior on other filesystems. |
| Original bounds and attempt ceiling | Candidate boundary and runner resume tests cover the original deadline, inclusive retry bound and two-attempt cap; subprocess events assert second-attempt linkage. | Provider idempotency and generic exactly-once behavior are not established. |
| Async fresh-time/authority matrix | Runner resume tests cover implemented boundaries; `resume-proposal-harness.test.js` enumerates the broader claim/evidence/preflight/marker scenario matrix. | Harness-only cases are reference logic, not runner conformance. |
| Storage bootstrap and integrity | `local-file-store.test.js` covers initialization ordering, immutable writes and corruption handling. | Digests cannot authenticate a record against an actor who can modify both record and digest. |
| Full O08 acceptance | Independent acceptance verdict is pending. | This finite synthetic evidence does not close O08; broader criteria remain open. |

The simultaneous-process barrier demonstrates one successful claim and at most
one mock effect for this pinned local synthetic fixture. It does not generalize
to other filesystems, production deployment, live providers, or arbitrary
durable-resume implementations.

## Scope estimate and exclusions

The owner-approved local store slice was estimated at 1–2 focused days. The
Expand Down
45 changes: 27 additions & 18 deletions docs/offline-orchestration-prototype.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ Provider Execution and Comic Manifest implementations. Its default path uses
one exact public synthetic Comic Manifest fixture, the existing Prompt SDK, and
one `MockTextAdapter` instance. An explicitly installed, opt-in path also reads
the exact public Context Builder fixture through six bounded synthetic readers
under separate current execution and package-use authority. It does not contact
a provider, use credentials, write to a filesystem, or persist state across
processes. The store is in-memory only.
under separate current execution and package-use authority. Neither path
contacts a provider or uses credentials. The default path uses an in-memory
store; a separate experimental opt-in no-context resume path uses the local
file store described in the O08 packet and persists synthetic state across
processes. Neither path is a production execution service.

This implementation was informed by [RFC 0010 at Codex commit
`3f5549f29faf1ca3e0912e6b8407dbe19310a7e2`](https://github.com/DefinitelySecureStudio/codex/blob/3f5549f29faf1ca3e0912e6b8407dbe19310a7e2/rfcs/0010-build-attempt-lifecycle.md)
Expand All @@ -32,11 +34,13 @@ the Comic Manifest schema.
- At most two attempts per job and at most one provider call per attempt.
- A fixed 300,000 ms monotonic job budget. It is not reset between attempts.
- One synthetic mock adapter only. No real providers, network, production
storage, filesystem, scheduler, daemon, credential handling, or automatic
restart continuation.
- Read-only recovery inspection. State uncertainty, integrity mismatch, an
unknown clock epoch, or an expired nonterminal deadline cannot authorize a
write or another provider call.
storage, scheduler, daemon, or credential handling. Only the explicit
experimental no-context resume uses the local filesystem; it is bounded to
the pinned eligible first-attempt rate-limit case.
- `inspectRecovery()` is read-only. The separate opt-in `resume()` path may
continue only that narrow candidate after current checks and a durable
one-shot claim. Uncertainty, integrity mismatch, an unknown clock epoch, or
an expired nonterminal deadline cannot authorize another provider call.
- Each prototype instance requires an explicitly installed synthetic execution
authority verifier. It rechecks finite preexisting decisions for the exact
synthetic production identity, purpose, and action before input use, again
Expand Down Expand Up @@ -270,19 +274,22 @@ preflight. IDs are fresh; the prepared event links `retry_of_attempt_id`.
A confirmed second result or retained unmappable outcome closes the host job;
uncertain outcomes or writes remain unresolved. 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.
use `closeJob()` instead. With the default in-memory store, a process restart
cannot continue this job. The separate opt-in local-file-store `resume()` path
supports only the narrow no-context candidate documented in the O08 packet.

The only retry admission proof in this prototype is the exact normalized mock
rate-limit outcome that states the request was rate-limited before acceptance.
Each attempt makes at most one provider call and uses a distinct
`idempotency_key` derived from its fresh execution ID. The mock does not
deduplicate across keys, and the prototype
does not claim cross-attempt or restart deduplication, durable resume, or
exactly-once effects. A retry is an explicit, same-process continuation after
the no-acceptance proof, under the original job deadline and two-attempt cap;
recovery after restart remains read-only. Tests cover denied retry (no second
call), authorized retry (one new call/key on the successful fixture path),
immutable prior result, the second-attempt limit, and read-only recovery.
does not claim cross-attempt or provider-level deduplication, or exactly-once
effects. A retry is an explicit continuation after the no-acceptance proof,
under the original job deadline and two-attempt cap. The experimental
no-context resume path and its limits are documented in the O08 packet. Tests
cover denied retry (no second call), authorized retry (one new call/key on the
successful fixture path), immutable prior result, the second-attempt limit,
and read-only `inspectRecovery()`.

The experimental validator lives in `src/comic-manifest/result-candidate.js`;
the stable `validateComicManifest` entry point continues to reject 1.1.0.
Expand Down Expand Up @@ -340,6 +347,8 @@ resource cleanup, and preservation of verified results and immutable evidence;
uncertain in-flight outcomes remain unresolved and are never converted into
success or absence. New Comic Manifest results for cancellation, timeout, or
uncertain external effects require a separate contract decision. This evidence
does not establish O05 or O07 completion or broader production readiness. O08
and O09 are outside this work; their prerequisites and acceptance criteria are
not assessed here.
does not establish O05 or O07 completion or broader production readiness. O05
and O07 acceptance remain separate. O08 evidence and remaining acceptance
gates are tracked in the
[durable-resume decision packet](o08-durable-resume-decision-packet.md). O08
remains open pending independent acceptance; O09 remains separately gated.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { randomUUID } from 'node:crypto';
import { appendFileSync, existsSync, watch, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { createSyntheticExecutionAuthorityVerifier, SYNTHETIC_EXECUTION_PURPOSE } from '../../src/offline-orchestration-prototype/execution-authority.js';
import { createOfflineOrchestrationPrototypeForTest, LocalFilePrototypeStore } from '../../src/offline-orchestration-prototype/testing.js';
import { MockTextAdapter } from '../../src/prompt-sdk/index.js';
Expand Down Expand Up @@ -44,6 +45,27 @@ if (mode === 'crash-after-claim') {
};
}

if (mode === 'partial-claim-before-resume') {
const partialClaim = join(root, 'resume-claims', `${Buffer.from(jobId).toString('base64url')}.json`);
writeFileSync(partialClaim, Buffer.alloc(0), { flag: 'wx', mode: 0o600 });
}

if (mode === 'barrier-before-claim') {
const claimResume = store.claimResume.bind(store);
store.claimResume = value => {
const ready = `${process.env.DSS_O08_CLAIM_READY_DIR}/${process.pid}.ready`;
const release = process.env.DSS_O08_CLAIM_RELEASE_MARKER;
writeFileSync(ready, 'ready\n', { flag: 'wx', mode: 0o600 });
const deadline = Date.now() + 10_000;
const poll = new Int32Array(new SharedArrayBuffer(4));
while (!existsSync(release)) {
if (Date.now() >= deadline) process.exit(76);
Atomics.wait(poll, 0, 0, 5);
}
return claimResume(value);
};
}

if (mode === 'crash-after-dispatch-marker') {
const append = store.append.bind(store);
store.append = event => {
Expand Down
Loading
Loading