Repository navigation
Align with omnigraph-server 0.15.0 and 0.16.0 - #1
Conversation
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.
There was a problem hiding this comment.
Devin Review found 1 potential issue.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| if datasets is not None: | ||
| body["datasets"] = list(datasets) |
There was a problem hiding this comment.
🟡 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.
| if datasets is not None: | |
| body["datasets"] = list(datasets) | |
| if datasets is not None: | |
| body["datasets"] = [datasets] if isinstance(datasets, str) else list(datasets) |
Was this helpful? React with 👍 or 👎 to provide feedback.
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
left a comment
There was a problem hiding this comment.
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()andcancel()accept any valid JSON as success. I reproduced both returning{}under HTTP 200 with the correct contract header.wait()then raisesKeyErroron the same reply, and afoundreply without a record can end the wait prematurely. Engine62779133always 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 forfound, allowunknownonly for lookup and cancellation, and raiseApiContractErrorwithoutcome_unknown=Truefor invalid POST acknowledgements. Add regression tests for empty and mismatched receipts. _operations.py · Engine commit -
Non-blocking —
traceparentexclusion cites an unavailable API. The ledger says callers can inject anhttpx.AsyncClientwith an event hook, but the constructor only accepts anAsyncBaseTransport. For engine4f47b976, 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
operationeven thoughwait()can returnlookup: "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 onlookupin 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.
acb9c23 to
8f9fc8d
Compare
|
Reply to the Codex review of 1. Blocking: recorded-operation receipts. Confirmed: 2. Non-blocking: 3. Non-blocking: operation docs. Confirmed against
One more fix, on the 0.15 surface (new tag point Verification:
|
Brings the
omnigraphPython 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, branchsdk-sync/0.15-0.16), which this repo'sAGENTS.mdnames as the reference. Nothing is tagged or published.Root-cause fix first: the contract header is not the server minor
openapi.jsonat v0.15.0 and v0.16.0 still requiresOmnigraph-Http-Api: 0.14.generate.pyderivedHTTP_API_CONTRACTfromserver-version's major.minor, and--checkrequired the package's major.minor to equal it. Pinning either release would therefore have sent0.15/0.16and failed every request withapi_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.mdand 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:5296c5d…0d63c8d. At0d63c8dthe package is 0.15.0,server-versionis 0.15.0, the spec is byte-identical to the v0.15.0 tag, and CHANGELOG has 0.15.0. Tagv0.15.0there if you want a 0.15 release.a3b2254… head.Every commit passes ruff, the ruff format check, mypy,
generate.py --checkand the unit tests.What changed
0.15.0
og.branches.list_detailed()(GET /branches?detailed=true); a reply withoutdetailsis anApiContractError.NotAdmittedError(aForbiddenError) for 403not_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 thegraph_unavailablespecial case).settings=onquery,mutateandbranches.merge. The SDK could not send request settings at all before, so 0.15'schange_lineagewas unusable.rankingon reads andclient_idon 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_sourceandServiceUnavailableError.recovery_required.U64parameters: Python ints are already exact, and a live test binds 2**64−1.0.16.0
og.operations:optimize/get/cancel/waitfor recorded operations, plusnew_operation_id()(canonical ULID),is_terminalandTERMINAL_STATES._operations.pytypes 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.optimizetakes the caller's id, so the caller holds it before sending.waitpolls only the read route, never retries, and is bounded withasyncio.timeout.WriterFencedError(aConflictError) for 409writer_fenced, with thewriter_fencedepochs.read_onlytransport option): a lost or interrupted answer is notoutcome_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.maintainand setsOMNIGRAPH_OPERATION_ROUTES=true. It also unlocks only whencluster status --jsonreports alock_id. 0.16's convergedcluster applyreleases its lock (fix(cluster): release the lock after a converged direct apply omnigraph#1360) but still printsAdmission 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.
in_progresswhosefoundrecord names the requested id and carries a state and an outcome, orunknownonly for lookup and cancel. Anything else raisesApiContractError,outcome_unknown=Trueafter a POST.{}under 200 no longer counts as accepted, andwait()can no longer hitKeyError.outcome_unknownalways setsoutcome_unknown, and otherwise a valid disposition with effectsunknown/partialdoes, on GET too. A recorded-operation lookup can answer 500outcome_unknown; it is built withApiError::newand no owned write, so its disposition can readeffects: none, hence the code decides. The old test asserting a read is never uncertain encoded the previous rule and was replaced.httpx.AsyncBaseTransport; the README now shows a wrapping transport that addstraceparent, and the ledger row is corrected.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 returnspublishingunchanged.TableOutcomeisDatasetOutcome(#1418 naming, TS parity).node:Personrun 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.6fc2f823merge-limitresource_limitname 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
runningis answered 202, yet the run endssucceededwith no reason (35 of 60 trials), contrary torecorded-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, isledger.mdon the media branch.0.14.0 → 0.15.0 (8 with client impact for this SDK, 86 without)
read_nstoLoadSliceExecutedOutput(load profile). Regenerated types; nothing to call.not_admitted(403,effects: none, no challenge). RegeneratedErrorCode; newNotAdmittedError(aForbiddenError) so callers can tell "sign in again" from "ask the operator"; a refused write is no longeroutcome_unknown(TS ModernRelay/omnigraph-ts#25's intent).omnigraph index build. Regenerated doc comments.AccessOutput.client_id(the OAuth client of an OIDC token). Regenerated types;access()returns it; unit test.ReadOutput.ranking(RankingOutput, enumsSearchFunction,RankOrder). Regenerated types, enums exported, unit test; e2e checks a ranked read.GET /branches?detailed=truereturnsdetails(BranchDetailOutput: head, start, times). New typed method (branches.listDetailed()/branches.list_detailed()); unit and e2e tests.change_lineage(off/on/verify) inSettingsRequest. TS: regeneratedSettings.changeLineage, already sent on query/mutate/merge. Python had no way to send settings at all;query,mutateandbranches.mergegainsettings=.U64parameter abovei64::MAXnow binds; the docs say send it as a decimal string. TS:bigintvalues 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)
forbidden) unlessOMNIGRAPH_ALLOW_READS_WITHOUT_POLICY=1. No code change (alreadyForbiddenError); both e2e fixtures apply a graph policy, now also grantingmaintain. README notes it. This commit has no PR number in its subject.writer_fenced(409) with bodywriter_fenced(WriterFencedOutput:current,held,read). Regenerated; newWriterFencedError(aConflictError) with awriterFenced/writer_fencedaccessor; disposition decidesoutcome_unknown(ModernRelay/omnigraph-ts#25's intent).maintainpolicy action (AccessAction) and per-dataset optimize outcomes. Regenerated enum;access()reportsmaintain; the operation record type carries the outcomes.POST /operations/optimize,GET /operations/{id},POST /operations/{id}/cancel(StartOptimizeRequest,OperationOutput,OperationLookup). Newoperationsresource:optimize(the caller's id is required;newOperationId()/new_operation_id()mints one,optimizenever does),get,cancel(best effort; apublishingrecord is returned unchanged),wait(polls the read route only), typed record, and one receipt check for all three routes. A lookup can answer 500outcome_unknownwhen its settlement write is in doubt; both SDKs now keep a server-sentoutcome_unknownon every route. Unit and live tests, including a live cancel of an active run.read_set_conflict; a Blob write on a recreated branch now returnsread_set_conflictinstead of a bareconflict. No new code; Python gains theread_set_conflict/key_conflict/ … accessors TS already had, so both expose it.effects: none, instead of 409. Spec adds 409/500 statuses. Existing status mapping already yieldsServiceUnavailableError/InternalServerError; unit test that a read stays certain.precondition_failure, not a@cardviolation. No code change: alreadyPreconditionFailedError.preconditionFailure; documented.resource_limitnamesbranch-merge retained validation key bytesinstead ofbranch-merge retained validation delta bytes. No binding change:resourceLimit/resource_limitalready 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.branch merge --dry-runwhose 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_unknownfalse), and the existing receipt check still marks a contradicting reply unknown. Unit tests.datasets(not tables), and anoptimizedtable can carryreason: index_failed. The typed operation record uses these names.cluster applynow releases its lock. The Python e2e fixture parsedAdmission lock: <id>;from stderr and broke (0.16 still prints the line, without the;, although the lock is released). It now unlocks only ifcluster status --jsonreportslock_id, as the TS fixture already did.openapi.jsoninfo.version0.16.0 (contract header still0.14); recorded-operation records written by edge builds answer 409operation_record_invalid. Spec pinned; documented.No change for this SDK (160 commits), grouped:
/mcptools, the 0.15.0 MCP crash fix, and the skill'sonboarding.md.Not carried over, and why
/mcpchanges: no SDK surface.writer_fencedlive test: only an embedded engine can claim a branch; no route or command does. It is covered by unit tests.traceparent(feat(server): add optional OTLP traces and correlated JSON logs omnigraph#1001): the server reads it; pass your ownhttpx.AsyncClientwith an event hook to add it.effectsof 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 fornot_admitted/writer_fenced. Aligning the general rule is a separate decision.OptimizeRequest,repairremoval): no HTTP surface.Tests
0d63c8d(0.15.0 tag point) against the checksum-verified v0.15.0 release binaries: 74 passed (55 unit + 19 live).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) andgenerate.py --checkare clean.Screenshots
Media branch:
sdk-sync/0.15-0.16-screenshots. Delete it after review.uv run pytest -vwith the live suite on v0.16.0:At the 0.15.0 tag point on v0.15.0:

To release (after review)
v0.15.0on0d63c8dfirst: a squash merge removes the 0.15.0 point.v0.15.0on0d63c8d;release.ymlpublishes on a tag.v0.16.0on the merge result.Note
Medium Risk
Substantial client behavior changes in contract headers, error/
outcome_unknownsemantics, 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-server0.16.0 (HTTP contract still 0.14).scripts/generate.pynow readsHTTP_API_CONTRACTfrom the OpenAPI header enum instead of deriving it from the server minor, and enforces package major.minor against the server release—fixingapi_contract_mismatchon 0.15+ servers.0.15-era API:
branches.list_detailed(),settings=onquery/mutate/branches.merge, regenerated types (ranking,client_id,change_lineage, etc.),NotAdmittedError, refactored error class selection, richer error detail accessors, andoutcome_unknowndriven 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.