Skip to content

Align with omnigraph-server 0.15.0 and 0.16.0 - #1

Merged
ragnorc merged 18 commits into
mainfrom
sdk-sync/0.15-0.16
Nov 25, 2026
Merged

ragnorc merged 18 commits into
mainfrom
sdk-sync/0.15-0.16

Conversation

@ragnorc

@ragnorc ragnorc commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Brings the omnigraph Python SDK from omnigraph-server 0.14 to 0.15.0 and then 0.16.0. It uses what those releases changed, not only the regenerated models, and mirrors the matching TypeScript PR (ModernRelay/omnigraph-ts, branch sdk-sync/0.15-0.16), which this repo's AGENTS.md names as the reference. Nothing is tagged or published.

Root-cause fix first: the contract header is not the server minor

openapi.json at v0.15.0 and v0.16.0 still requires Omnigraph-Http-Api: 0.14. generate.py derived HTTP_API_CONTRACT from server-version's major.minor, and --check required the package's major.minor to equal it. Pinning either release would therefore have sent 0.15/0.16 and failed every request with api_contract_mismatch, and a 0.16.0 package version could not pass the check at all. The generator now reads the contract from the spec (one enum value, agreed by every operation; it fails closed otherwise). It checks the package's major.minor against the pinned server release, which is the TypeScript SDK's rule. AGENTS.md and the README's Versions section say so.

Structure: two releases in one PR

This repo's convention (package major.minor = server release, enforced by generate.py --check) favours separate 0.15.0 and 0.16.0 releases, so the commits are grouped by engine version:

  • 0.15.0 — 5296c5d … 0d63c8d. At 0d63c8d the package is 0.15.0, server-version is 0.15.0, the spec is byte-identical to the v0.15.0 tag, and CHANGELOG has 0.15.0. Tag v0.15.0 there if you want a 0.15 release.
  • 0.16.0 — a3b2254 … head.

Every commit passes ruff, the ruff format check, mypy, generate.py --check and the unit tests.

What changed

0.15.0

  • og.branches.list_detailed() (GET /branches?detailed=true); a reply without details is an ApiContractError.
  • NotAdmittedError (a ForbiddenError) for 403 not_admitted. Class selection is now one rule: the status picks the class, and a code's class replaces it when it is a subclass (this absorbs the graph_unavailable special case).
  • settings= on query, mutate and branches.merge. The SDK could not send request settings at all before, so 0.15's change_lineage was unusable.
  • ranking on reads and client_id on access, from the regenerated models. Error-detail accessors now match the TS SDK: ConflictError.read_set_conflict, .published_dataset_version_conflict, .change_diff_refusal, .full_text_index_rebuild_required, GoneError.change_feed_gap, RangeNotSatisfiableError.blob_range, FailedDependencyError.external_blob_source and ServiceUnavailableError.recovery_required.
  • U64 parameters: Python ints are already exact, and a live test binds 2**64−1.

0.16.0

  • og.operations: optimize / get / cancel / wait for recorded operations, plus new_operation_id() (canonical ULID), is_terminal and TERMINAL_STATES. _operations.py types the record by hand with TypedDicts that keep the wire names, because the spec leaves it an open object; the types were checked against a live 0.16 record. optimize takes the caller's id, so the caller holds it before sending. wait polls only the read route, never retries, and is bounded with asyncio.timeout.
  • WriterFencedError (a ConflictError) for 409 writer_fenced, with the writer_fenced epochs.
  • A dry-run merge is a read (read_only transport option): a lost or interrupted answer is not outcome_unknown. A reply outside the contract, or one that is not a dry-run receipt, still is. This matches the 0.16 CLI fix fix(cli): report a lost branch merge --dry-run answer as having no effects omnigraph#1448.
  • e2e fixture: grants maintain and sets OMNIGRAPH_OPERATION_ROUTES=true. It also unlocks only when cluster status --json reports a lock_id. 0.16's converged cluster apply releases its lock (fix(cluster): release the lock after a converged direct apply omnigraph#1360) but still prints Admission lock: <id>, without the trailing ;, so the old regex broke.

Fixes from the Codex review

Each claim was checked against the engine source at v0.16.0 first; all held. Every fix has a regression test that fails without it.

  • One receipt validator for start, get and cancel (blocking): a lookup envelope with a boolean in_progress whose found record names the requested id and carries a state and an outcome, or unknown only for lookup and cancel. Anything else raises ApiContractError, outcome_unknown=True after a POST. {} under 200 no longer counts as accepted, and wait() can no longer hit KeyError.
  • Server uncertainty on every route (0.15 surface, the new tag point): code outcome_unknown always sets outcome_unknown, and otherwise a valid disposition with effects unknown/partial does, on GET too. A recorded-operation lookup can answer 500 outcome_unknown; it is built with ApiError::new and no owned write, so its disposition can read effects: none, hence the code decides. The old test asserting a read is never uncertain encoded the previous rule and was replaced.
  • Tracing: the client takes an httpx.AsyncBaseTransport; the README now shows a wrapping transport that adds traceparent, and the ledger row is corrected.
  • Operation docs: the example branches on lookup; replay holds only while the record retains the id (32 newest terminal) and the digest matches; a timeout ends the wait, not the run; cancel is best effort and returns publishing unchanged. TableOutcome is DatasetOutcome (#1418 naming, TS parity).
  • Live tests: a full run must report the schema's datasets, a node:Person run exactly that dataset, and a live cancel meets an active run (sent concurrently with the submission so it also works on release binaries) and checks the terminal record.
  • Changelog: the 6fc2f823 merge-limit resource_limit name change is recorded.

Found while testing the cancel path, an engine bug: on omnigraph-server 0.16.0 a cancel that lands while the run's report is already built but the record still says running is answered 202, yet the run ends succeeded with no reason (35 of 60 trials), contrary to recorded-operations.md. The docs and the live test describe that behaviour.

Commit ledger (this SDK)

Every engine commit in v0.14.0..v0.16.0 (180) was classified. The full ledger, one row per commit for both SDKs, is ledger.md on the media branch.

0.14.0 → 0.15.0 (8 with client impact for this SDK, 86 without)

Commit Subject Impact What this PR does
ModernRelay/omnigraph@2af30259 perf(load): stream a csv overwrite's source by partition and check uniqueness as the rows drain (ModernRelay/omnigraph#1158) both Spec adds read_ns to LoadSliceExecutedOutput (load profile). Regenerated types; nothing to call.
ModernRelay/omnigraph@dc4a79d3 fix(server): refuse an unadmitted OIDC subject without a sign-in challenge (ModernRelay/omnigraph#1185) both New error code not_admitted (403, effects: none, no challenge). Regenerated ErrorCode; new NotAdmittedError (a ForbiddenError) so callers can tell "sign in again" from "ask the operator"; a refused write is no longer outcome_unknown (TS ModernRelay/omnigraph-ts#25's intent).
ModernRelay/omnigraph@be90423a feat(cli): build a branch's declared indexes with omnigraph index build (ModernRelay/omnigraph#1150) both Spec text only: the full-text remedy now names omnigraph index build. Regenerated doc comments.
ModernRelay/omnigraph@c1a6c83a feat(server): keep an OIDC token's client_id beside the person's actor (ModernRelay/omnigraph#1196) both AccessOutput.client_id (the OAuth client of an OIDC token). Regenerated types; access() returns it; unit test.
ModernRelay/omnigraph@71219d16 feat(query): a ranked read reports its ranking (ModernRelay/omnigraph#1130) both ReadOutput.ranking (RankingOutput, enums SearchFunction, RankOrder). Regenerated types, enums exported, unit test; e2e checks a ranked read.
ModernRelay/omnigraph@e7d95ae7 feat(server,cli,mcp): report each branch's head, start and times in the branch listing (ModernRelay/omnigraph#1012) both GET /branches?detailed=true returns details (BranchDetailOutput: head, start, times). New typed method (branches.listDetailed() / branches.list_detailed()); unit and e2e tests.
ModernRelay/omnigraph@17557824 perf(changes): discover a multi-commit window's changes by row identity (ModernRelay/omnigraph#1201) both New request setting change_lineage (off/on/verify) in SettingsRequest. TS: regenerated Settings.changeLineage, already sent on query/mutate/merge. Python had no way to send settings at all; query, mutate and branches.merge gain settings=.
ModernRelay/omnigraph@7f32f83d fix(compiler): carry a U64 parameter above i64::MAX (ModernRelay/omnigraph#1102) both A U64 parameter above i64::MAX now binds; the docs say send it as a decimal string. TS: bigint values are sent as decimal strings (JSON.stringify throws on them and numbers round past 2^53). Python ints are exact, and the 0.15 server binds 2^64-1 as a JSON number too. Unit tests; e2e binds 2^64-1 (TS also checks 2^64 is refused).

0.15.0 → 0.16.0 (12 with client impact for this SDK, 74 without)

Commit Subject Impact What this PR does
ModernRelay/omnigraph@c8dcb315 fix(server)!: deny reads on graphs without a policy both A graph with no applied policy now refuses reads (403 forbidden) unless OMNIGRAPH_ALLOW_READS_WITHOUT_POLICY=1. No code change (already ForbiddenError); both e2e fixtures apply a graph policy, now also granting maintain. README notes it. This commit has no PR number in its subject.
ModernRelay/omnigraph@757ab0e9 feat(engine): add writer epoch fencing and the owner's probe skip (ModernRelay/omnigraph#1350) both New error code writer_fenced (409) with body writer_fenced (WriterFencedOutput: current, held, read). Regenerated; new WriterFencedError (a ConflictError) with a writerFenced / writer_fenced accessor; disposition decides outcome_unknown (ModernRelay/omnigraph-ts#25's intent).
ModernRelay/omnigraph@d0b9af44 feat(engine)!: bound optimize runs and report each table's outcome (ModernRelay/omnigraph#1275) both Adds the maintain policy action (AccessAction) and per-dataset optimize outcomes. Regenerated enum; access() reports maintain; the operation record type carries the outcomes.
ModernRelay/omnigraph@62779133 feat(server,cli): run optimize as a recorded operation through the serving owner (ModernRelay/omnigraph#1282) both New routes POST /operations/optimize, GET /operations/{id}, POST /operations/{id}/cancel (StartOptimizeRequest, OperationOutput, OperationLookup). New operations resource: optimize (the caller's id is required; newOperationId() / new_operation_id() mints one, optimize never does), get, cancel (best effort; a publishing record is returned unchanged), wait (polls the read route only), typed record, and one receipt check for all three routes. A lookup can answer 500 outcome_unknown when its settlement write is in doubt; both SDKs now keep a server-sent outcome_unknown on every route. Unit and live tests, including a live cancel of an active run.
ModernRelay/omnigraph@b2dbaff7 fix(engine): carry writes over publications that changed no row (ModernRelay/omnigraph#1349) both Overtaken update/delete/overwrite writes rerun instead of 409 read_set_conflict; a Blob write on a recreated branch now returns read_set_conflict instead of a bare conflict. No new code; Python gains the read_set_conflict / key_conflict / … accessors TS already had, so both expose it.
ModernRelay/omnigraph@9fb5b48e fix(server): answer a failed control read on recorded-operation routes with a retryable 503 (ModernRelay/omnigraph#1357) both Cluster deployment routes answer a failed control read with 503 (retry) or 500 (repeats), effects: none, instead of 409. Spec adds 409/500 statuses. Existing status mapping already yields ServiceUnavailableError / InternalServerError; unit test that a read stays certain.
ModernRelay/omnigraph@4570bac7 fix(engine): report a lost conditional race as precondition_failure, not @card (ModernRelay/omnigraph#1426) both A conditional mutation that loses a race reports 412 precondition_failure, not a @card violation. No code change: already PreconditionFailedError.preconditionFailure; documented.
ModernRelay/omnigraph@6fc2f823 fix(merge): stream merge validation and count only the delta's keys (ModernRelay/omnigraph#1433) both Merge validation streams the delta and counts only its keys; the structured 413 resource_limit names branch-merge retained validation key bytes instead of branch-merge retained validation delta bytes. No binding change: resourceLimit / resource_limit already carries the name and numbers. Recorded in both changelogs (callers should match on the code, not the name). Corrected after review: first classified as having no wire impact.
ModernRelay/omnigraph@d20eba74 fix(cli): report a lost branch merge --dry-run answer as having no effects (ModernRelay/omnigraph#1448) both The CLI now treats a branch merge --dry-run whose answer is lost as having no effects, and a reply that contradicts the dry run as effects unknown. Both SDKs now match: a dry-run merge is a read for transport loss (outcome_unknown false), and the existing receipt check still marks a contradicting reply unknown. Unit tests.
ModernRelay/omnigraph@9575c176 fix(engine,server,cli): report optimize table failures truthfully and say datasets (ModernRelay/omnigraph#1418) both Optimize outcomes say datasets (not tables), and an optimized table can carry reason: index_failed. The typed operation record uses these names.
ModernRelay/omnigraph@03217933 fix(cluster): release the lock after a converged direct apply (ModernRelay/omnigraph#1360) python A converged direct cluster apply now releases its lock. The Python e2e fixture parsed Admission lock: <id>; from stderr and broke (0.16 still prints the line, without the ;, although the lock is released). It now unlocks only if cluster status --json reports lock_id, as the TS fixture already did.
ModernRelay/omnigraph@00b8cca8 release(notes): prepare v0.16.0 (ModernRelay/omnigraph#1402) both Release v0.16.0: openapi.json info.version 0.16.0 (contract header still 0.14); recorded-operation records written by edge builds answer 409 operation_record_invalid. Spec pinned; documented.

No change for this SDK (160 commits), grouped:

  • engine performance, planner, storage and caches (about 70);
  • CLI-only changes (about 25);
  • GQT, DST and bench tooling (about 20);
  • docs, RFCs, release notes and skill text (about 30);
  • CI, Nix, installer and dependency bumps (about 12);
  • the four TS-MCP-only items: server /mcp tools, the 0.15.0 MCP crash fix, and the skill's onboarding.md.

Not carried over, and why

  • Server /mcp changes: no SDK surface.
  • writer_fenced live test: only an embedded engine can claim a branch; no route or command does. It is covered by unit tests.
  • W3C traceparent (feat(server): add optional OTLP traces and correlated JSON logs omnigraph#1001): the server reads it; pass your own httpx.AsyncClient with an event hook to add it.
  • Unknown error codes: this SDK trusts the effects of any well-formed error body, even with a code it does not know, while TS treats an unknown code as uncertain. With the regenerated enums the difference no longer matters for not_admitted/writer_fenced. Aligning the general rule is a separate decision.
  • CLI-only, embedded-Rust and storage-format changes (format 17, OptimizeRequest, repair removal): no HTTP surface.

Tests

  • At 0d63c8d (0.15.0 tag point) against the checksum-verified v0.15.0 release binaries: 74 passed (55 unit + 19 live).
  • At head against the checksum-verified v0.16.0 release binaries: 131 passed (105 unit + 26 live). Against the binaries built from the v0.16.0 tag (debug, cargo dev-build-tests), 25 of 26 live tests pass; test_entity_cap (unchanged, 8,193-statement refusal) now exceeds the SDK's 30 s client timeout on that unoptimised build after a box restart and fails the same way at the previous head, so it is environmental. ruff, the ruff format check, mypy (strict) and generate.py --check are clean.

Screenshots

Media branch: sdk-sync/0.15-0.16-screenshots. Delete it after review.

uv run pytest -v with the live suite on v0.16.0:
pytest 0.16

At the 0.15.0 tag point on v0.15.0:
pytest 0.15

To release (after review)

  1. Merge with a merge commit, or tag v0.15.0 on 0d63c8d first: a squash merge removes the 0.15.0 point.
  2. Optionally tag v0.15.0 on 0d63c8d; release.yml publishes on a tag.
  3. Tag v0.16.0 on the merge result.

Note

Medium Risk
Substantial client behavior changes in contract headers, error/outcome_unknown semantics, and new write-adjacent operation routes with receipt rules; mis-handling could cause failed requests or unsafe retries.

Overview
Bumps the package to 0.16.0 against pinned omnigraph-server 0.16.0 (HTTP contract still 0.14). scripts/generate.py now reads HTTP_API_CONTRACT from the OpenAPI header enum instead of deriving it from the server minor, and enforces package major.minor against the server release—fixing api_contract_mismatch on 0.15+ servers.

0.15-era API: branches.list_detailed(), settings= on query/mutate/branches.merge, regenerated types (ranking, client_id, change_lineage, etc.), NotAdmittedError, refactored error class selection, richer error detail accessors, and outcome_unknown driven by the server reply on all routes.

0.16-era API: New og.operations (optimize, get, cancel, wait, new_operation_id(), hand-typed operation records) with strict receipt validation; WriterFencedError; dry-run merges treated as read-only in the transport layer. OpenAPI/spec, CHANGELOG.md, README/AGENTS docs, and expanded e2e coverage (recorded operations, ranking, U64, detailed branch list).

Reviewed by Cursor Bugbot for commit 8f9fc8d. Bugbot is set up for automated code reviews on this repo. Configure here.

Server 0.15.0 and 0.16.0 still require Omnigraph-Http-Api: 0.14, so the
contract cannot be derived from server-version. generate.py now takes the
single enum value of the header parameter (the same on every operation)
and checks the package's major.minor against the pinned server release.
Sync spec/openapi.json from v0.15.0 (byte-identical to the tag), regenerate
the models and version stamp, and bump the package to 0.15.0. The contract
header stays 0.14. The e2e probe checks SERVER_VERSION instead of a literal.
Server 0.15 answers an OIDC token whose subject is not admitted with 403
not_admitted and effects none, so a refused write is not outcome_unknown.
NotAdmittedError subclasses ForbiddenError: catch it to tell "ask the
operator" from "sign in again".

Error classes now follow one rule: the status picks the class, and a code's
class replaces it when it is a subclass (graph_unavailable on 503 was the
only such case and keeps its class).
Server 0.15 reports each readable branch's head commit, where it started,
and when it was created and last moved. A separate method keeps list()'s
return type; a reply without details raises ApiContractError.
query(), mutate() and branches.merge() take settings (SettingsRequest),
which carries 0.15's change_lineage and the resource budgets. Tests cover
ReadOutput.ranking, AccessOutput.client_id and the settings bodies.

Error classes gain the body accessors the TypeScript SDK already has:
ConflictError.read_set_conflict (a Blob write on a recreated branch now
answers it), published_dataset_version_conflict, change_diff_refusal and
full_text_index_rebuild_required; GoneError.change_feed_gap;
RangeNotSatisfiableError.blob_range;
FailedDependencyError.external_blob_source;
ServiceUnavailableError.recovery_required.
The e2e schema gains a vector and a U64 property: a nearest() read reports
its ranking, U64 2**64-1 binds as a JSON number and as a decimal string,
and the detailed branch listing reports a branch's start and head. All 19
live tests pass against the omnigraph-server 0.15.0 release.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +174 to +175
if datasets is not None:
body["datasets"] = list(datasets)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Single dataset keys split into characters

With datasets="node:Person", optimize sends each character as a separate dataset key. The server records the request before rejecting those keys, so the corrected request needs a new operation ID.

Learn more

The public argument accepts Sequence[str], which includes Python strings. The server expects an array whose entries are complete dataset keys, as defined by StartOptimizeRequest. The server records the request before running the dataset checks; the resulting failed record binds the ID to the malformed request.

Example: A caller passes datasets="node:Person". The server receives ["n", "o", "d", …], then marks the accepted run as failed because n is not a dataset key. Sending ["node:Person"] with the same ID conflicts with the recorded request.

Recommended fix: Wrap a string as a one-element array and keep converting other sequences as before. Add a transport test that asserts the serialized body for one string key.

Suggested change
if datasets is not None:
body["datasets"] = list(datasets)
if datasets is not None:
body["datasets"] = [datasets] if isinstance(datasets, str) else list(datasets)

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

ragnorc added a commit that referenced this pull request Nov 25, 2026
A str is a Sequence[str], so datasets="node:Person" was sent as one
dataset key per character. The server records the request under the
operation id before it checks the keys, so the id was spent on a
malformed run. optimize now raises TypeError before sending.

Found by Devin Review on #1.

@ragnorc ragnorc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Codex review (Codex CLI on a dev box) of head acb9c23, checked against the engine source at v0.14.0..v0.16.0.

Verdict: do not merge. Recorded-operation writes can report success without a valid acknowledgement.

  • Blocking — recorded-operation receipts. optimize() and cancel() accept any valid JSON as success. I reproduced both returning {} under HTTP 200 with the correct contract header. wait() then raises KeyError on the same reply, and a found reply without a record can end the wait prematurely. Engine 62779133 always returns a lookup envelope, and a successful submission always identifies the submitted operation. Share a receipt validator across start, get and cancel. Require a matching operation ID for found, allow unknown only for lookup and cancellation, and raise ApiContractError with outcome_unknown=True for invalid POST acknowledgements. Add regression tests for empty and mismatched receipts. _operations.py · Engine commit

  • Non-blocking — traceparent exclusion cites an unavailable API. The ledger says callers can inject an httpx.AsyncClient with an event hook, but the constructor only accepts an AsyncBaseTransport. For engine 4f47b976, document how a custom transport can add the header, or explicitly defer trace propagation. No new SDK option is needed. _client.py · Ledger

  • Non-blocking — operation docs overstate the guarantees. The example dereferences operation even though wait() can return lookup: "unknown". The submission docstring also promises that repeating the same ID and request returns the existing record, which the engine guarantees only while the record is retained and the digest still matches. Branch on lookup in the example, qualify the replay guarantee, and state that timing out the wait leaves the server operation running. README.md · _operations.py

The vendored specs match both engine tags byte for byte. Both derive HTTP contract 0.14 from the spec. At 67f41cc, the package and server pin are both 0.15.0, with no 0.16 operations surface. I ran 67 tests at that commit and 101 at PR head against the respective checksum-verified release binaries. Generation, mypy and Ruff checks passed. Generator

The engine’s 403 not_admitted, 409 writer_fenced and 412 precondition_failed map to the expected classes and details. The new tests exercise write uncertainty, dry-run contradictions, settings serialization, exact U64 binding, retained-ID replay and lookup-only polling. The live cancellation test covers a terminal record. The public additions follow SDK naming and preserve existing call signatures. I found no other route, field, or error-mapping gaps against the tagged engine source and ledger.


The blocking items go back to the PR's box next.

from_response set outcome_unknown only when the route could write, so
every GET, HEAD and read-only POST was certain even when the server
said a write may have landed. omnigraph 0.16 answers a recorded-
operation lookup with 500 outcome_unknown when a settlement write it
made has no definite answer (#1282), and that error is built without a
write disposition, so it can arrive with effects none.

The server's word now decides on every route: code outcome_unknown is
always uncertain, and otherwise a valid disposition with effects unknown
or partial is. Only a reply without either falls back to the route.
test_a_read_error_is_never_outcome_unknown asserted the old rule and is
replaced by a test of a read the server calls certain.

This is the 0.15.0 tag point.
Sync spec/openapi.json from v0.16.0 (byte-identical to the tag), regenerate,
and bump the package to 0.16.0. The contract header stays 0.14. New models:
OperationOutput, OperationLookup, StartOptimizeRequest, WriterFencedOutput,
AccessAction maintain, ErrorCode writer_fenced.
Server 0.16 refuses a publish or claim on a branch another process claimed
with 409 writer_fenced and a writer_fenced body (current, held and read
epochs). WriterFencedError subclasses ConflictError and exposes the body;
with effects none a refused write is not outcome_unknown.
Server 0.16 runs optimize on a cluster graph's main as a recorded
operation (POST /operations/optimize, GET /operations/{id},
POST /operations/{id}/cancel). The caller mints the id first with
new_operation_id() (a canonical ULID) so it can look a lost submission up
instead of resubmitting; optimize() takes it as a required argument.
wait() polls only the lookup until the record is terminal or unknown, and
lets every error end the wait. Operation, OperationResult and the outcome
types describe the record with its wire names; the spec leaves it open.
Server 0.16's CLI reports a branch merge --dry-run whose answer is lost as
having no effects, since the server runs it as a read of both branches.
The transport takes read_only for such a request, so transport loss and an
interrupted body are no longer outcome_unknown. A reply that contradicts
the dry run (it merged, or deleted the branch) still raises ApiContractError
with outcome_unknown, judged by the route.
The fixture grants maintain, enables OMNIGRAPH_OPERATION_ROUTES, and asks
cluster status for a lock to release: 0.16 releases it after a converged
direct apply, and its stderr no longer matches the old pattern. New live
tests: access reports maintain and no OAuth client for a static token; a
dry-run merge reports an outcome and leaves the head unchanged; a recorded
optimize is accepted, answered again for the same id, waited to succeeded,
left unchanged by cancel and refused under the same id with another
request; an unknown id looks up as unknown; a non-ULID id is a 400.
A str is a Sequence[str], so datasets="node:Person" was sent as one
dataset key per character. The server records the request under the
operation id before it checks the keys, so the id was spent on a
malformed run. optimize now raises TypeError before sending.

Found by Devin Review on #1.
Codex found optimize() and cancel() accepting any JSON as success:
under HTTP 200 with the contract header, {} returned as if the
operation were accepted, wait() then raised KeyError on the same reply,
and a found reply without a record could end a wait early.

One validator now serves start, get and cancel: a lookup envelope with
a boolean in_progress whose found record names the requested id and
carries a state and an outcome, or an unknown lookup where the route can
answer one (lookup and cancel; a submission always identifies its
record, omnigraph 62779133). An invalid reply is an ApiContractError,
outcome_unknown after a submission or cancellation and certain after a
lookup. wait() relies on it, so it can no longer read a missing record.

Tests cover empty, foreign, record-less, state-less and
in_progress-less replies on every route, unknown on optimize, wait() on
an invalid receipt, and a lookup's 500 outcome_unknown staying
uncertain.
From Codex's review, checked against omnigraph v0.16.0:

- The README example branches on lookup before reading the record, and
  says a timeout ends the wait, not the run.
- optimize(): a resubmission returns the record only while the server's
  record holds the id (the 32 newest terminal operations) and the
  request digest matches; an evicted id is refused as expired.
- cancel() is best effort: the server requests no cancellation for a
  terminal, unknown or publishing operation, and a running one may end
  succeeded with a late-cancellation reason.
- get() and wait(): retrying a lookup is safe, outcome_unknown included.
- Tracing: the client takes an httpx.AsyncBaseTransport, not an
  AsyncClient with event hooks, so the README shows a wrapping transport
  that adds traceparent.
- TableOutcome is DatasetOutcome, matching #1418's dataset naming and the
  TypeScript SDK.
From Codex's review: the dataset assertion passed when the server
omitted datasets. A full run must now report the schema's datasets
under datasets, and a run limited to node:Person must report exactly
that dataset. A new live test cancels a run while it is accepted or
running (retrying until a cancel meets one) and checks the terminal
record: cancelled with no published commit, succeeded with a
late-cancellation reason, or, if the cancel met it publishing,
succeeded.
Adds the receipt check and datasets fixes, the recorded-operation lookup
and cancel semantics, and the merge validation limit's new resource
name from omnigraph#1433 (6fc2f823), which the ledger had marked as
having no wire impact: the structured 413 resource_limit names
branch-merge retained validation key bytes instead of delta bytes and
counts only the delta's keys. resource_limit already carries it, so no
binding changes.
@ragnorc

ragnorc commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Reply to the Codex review of acb9c23, item by item. Every claim was checked against the engine source at v0.16.0 before changing code; all three held. New head: 8f9fc8d. The 0.15.0 tag point moved from 67f41cc to 0d63c8d (see the last section).

1. Blocking: recorded-operation receipts. Confirmed: optimize() and cancel() returned any JSON, and wait() raised KeyError on {}. Fixed in 3d50a33 with one validator, valid_receipt, shared by start, get and cancel. A receipt must be a lookup envelope with a boolean in_progress. A found reply's record must name the requested id and carry a state and an outcome. unknown is accepted only for lookup and cancel; a submission always identifies its record. Anything else raises ApiContractError, with outcome_unknown=True after a POST and False after a lookup. wait() relies on it, so it can no longer end on a record-less found or hit KeyError. Regression tests cover empty, foreign-id, record-less, state-less and in_progress-less replies on each route, unknown on submission, and wait(); 17 fail without the fix. The TS SDK had the same gap and got the same check (omnigraph-ts#26, bace000).

2. Non-blocking: traceparent advice. Confirmed: the constructor takes an httpx.AsyncBaseTransport, not an AsyncClient. 2ccd850 adds a README "Tracing" section with a transport that wraps httpx.AsyncHTTPTransport and sets traceparent, and the ledger row for 4f47b976 now says so. No new SDK option.

3. Non-blocking: operation docs. Confirmed against recorded_operations.rs: the digest covers graph, schema identity domain, settlement branch, request and principal; the record keeps the 32 newest terminal operations; and a publishing operation is never cancelled. Fixed in 2ccd850:

  • The README example branches on lookup before reading operation.
  • The optimize() docstring and the README qualify replay: only while the record retains the id and the digest matches; an evicted id is refused as expired.
  • wait() says a timeout ends the wait, not the run.
  • cancel() is documented as best effort.
  • TableOutcome is now DatasetOutcome, for #1418 and TS parity, with a test.

2cd0f75 adds a live test that cancels an active run concurrently with its submission and checks the terminal record, plus stricter datasets assertions. Testing this found an engine bug. On 0.16.0, a cancel that lands after the engine built the run's report, while the record still says running, is answered 202, yet the run ends succeeded with no reason. That happened in 35 of 60 trials against the release binary, contrary to recorded-operations.md. The docs and the test describe that behaviour.

One more fix, on the 0.15 surface (new tag point 0d63c8d). The TS review found that a GET lookup's 500 outcome_unknown lost its uncertainty. Python had the same rule (outcome_unknown = may_write and effects != "none"), so the fix went to both SDKs on every route. Code outcome_unknown is always outcome_unknown; otherwise a valid disposition with effects unknown or partial is; only a reply with neither falls back to the route. I key on the code because the server builds that error without an owned write, so its disposition can read effects: none. The old test_a_read_error_is_never_outcome_unknown encoded the previous rule and was replaced; four new cases fail without the fix.

Verification:

  • At 8f9fc8d against the checksum-verified v0.16.0 release: 131 passed (105 unit + 26 live). ruff, the format check, mypy (strict) and generate.py --check are clean, and every commit in the rework passes them.
  • Against the binaries built from the v0.16.0 tag: 25 of 26 live tests pass. test_entity_cap (unchanged code) now exceeds the SDK's 30 s client timeout on that unoptimised debug build after the box restarted. It fails the same way at the old head acb9c23 and passes on the release build in about 20 s, so it is the environment, not this change.
  • At 0d63c8d against the v0.15.0 release: 74 passed (55 unit + 19 live).

@ragnorc
ragnorc merged commit b2c0640 into main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant