Skip to content

Sync to server 0.8.1 and add branch-merge deleteBranch support#15

Draft
ragnorc wants to merge 3 commits into
sync-server-0.8.1from
sync-branch-merge-delete-branch
Draft

Sync to server 0.8.1 and add branch-merge deleteBranch support#15
ragnorc wants to merge 3 commits into
sync-server-0.8.1from
sync-branch-merge-delete-branch

Conversation

@ragnorc

@ragnorc ragnorc commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What & why

Adds the merge-and-delete-source surface from ModernRelay/omnigraph#354deleteBranch on og.branches.merge() and on the branches_merge MCP tool, with the non-fatal branchDeleted / branchDeleteError result fields — plus the other post-0.8.1 server additions the regenerated spec brings in: ConflictError.readSetConflict and a typed ServiceUnavailableError (code-less 503) carrying recoveryRequired.operationId.

Based on #16 (the green 0.8.1 version catch-up), so this diff is exactly the unreleased overlay.

  • SDK: regenerated types from the vendored spec; error surface; merge() docs. Tests: 89 passed (new: deleteBranch wire test, readSetConflict / 503 mapping).
  • MCP: branches_merge accepts deleteBranch; the workflow instructions collapse the branch loop's merge + delete into one call. Tests: 15 passed (new: passthrough).
  • check-versions and check-coverage pass; typecheck green.

Draft until

check-drift is deliberately red: the vendored spec carries fields from the server's main branch (ModernRelay/omnigraph#354 and the structured-error work) that are not in any tagged release. Before undrafting:

  • Add --delete-branch to branch merge omnigraph#354 merges
  • a server release containing it is tagged (v0.8.2 or later)
  • bump omnigraph.serverVersion (and package versions) to that release, run pnpm sync-spec && pnpm generate, confirm check-drift is green byte-for-byte

Note

Medium Risk
Touches branch merge/delete behavior and client retry semantics for writes (409 read-set, 503 recovery); mostly additive API surface with tests, but callers must handle new non-fatal merge delete fields and error types.

Overview
Adds post-merge source branch cleanup end-to-end: deleteBranch on og.branches.merge() and the MCP branches_merge tool, with branchDeleted / branchDeleteError on success when deletion is refused. Agent workflow text now recommends merge + delete in one step instead of a separate delete call.

Regenerates the vendored OpenAPI/SDK types for the newer server contract: merge request/response fields, 503 on several write/branch paths, and richer 409 bodies (read_set_conflict, load “prepared authority” wording).

The SDK error layer now surfaces ConflictError.readSetConflict and maps code-less 503 responses to ServiceUnavailableError with recoveryRequired.operationId, exported from the public API. MCP and SDK tests cover deleteBranch passthrough and the new error shapes.

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

Greptile Summary

This PR syncs the SDK and MCP surfaces to the newer server API overlay. The main changes are:

  • deleteBranch support for SDK and MCP branch merges.
  • Merge response fields for branch deletion results.
  • Structured read-set conflict and recovery-required error fields.
  • A typed SDK error for code-less 503 responses.
  • Regenerated OpenAPI types and tests for the new wire shapes.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/mcp/src/server.ts Adds deleteBranch to the MCP merge tool and updates the workflow guidance.
packages/sdk/src/errors.ts Adds typed handling for recovery-required 503 responses and read-set conflict details.
packages/sdk/src/generated/types.gen.ts Regenerates API types for branch deletion results, recovery metadata, and expanded error responses.
spec/openapi.json Updates the vendored OpenAPI spec with merge cleanup and structured error additions.

Reviews (2): Last reviewed commit: "Add deleteBranch to the branches_merge M..." | Re-trigger Greptile

@ragnorc
ragnorc marked this pull request as ready for review July 14, 2026 00:30
Comment thread package.json
Comment thread packages/mcp/src/server.ts

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23843e8534

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json
"packageManager": "pnpm@9.15.0",
"omnigraph": {
"serverVersion": "0.8.0"
"serverVersion": "0.8.1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pin the SDK to the release containing deleteBranch

Because this change also adds the untagged delete_branch / branch_deleted branch-merge fields to spec/openapi.json, leaving omnigraph.serverVersion at 0.8.1 makes the generated SERVER_VERSION claim compatibility with the 0.8.1 release even though that release's drift source will not match. In any release/CI path that runs pnpm run check-drift (which fetches v${serverVersion}/openapi.json), this pin fails and users can send deleteBranch to a 0.8.1 server that does not implement it; please keep the spec at 0.8.1 or bump this to the first tagged server containing the new fields.

Useful? React with 👍 / 👎.

target: z.string().optional(),
deleteBranch: z.boolean().optional(),
},
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },

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 Do not advertise merge-and-delete as idempotent

When callers set deleteBranch: true, retrying the same branches_merge after a successful response no longer has a source branch to merge, so it can fail with a missing source instead of returning already_up_to_date. Because the MCP tool advertises idempotentHint: true unconditionally, hosts may safely retry a call that is not safe under this option; please drop the hint or split cleanup into a separate non-idempotent path.

Useful? React with 👍 / 👎.

ragnorc added 3 commits July 14, 2026 01:36
The spec carries the branch-merge delete_branch request field, the
branch_deleted / branch_delete_error response fields, and the
read_set_conflict / recovery_required structured error fields — all on
the server's main branch but not yet in a tagged release, so check-drift
stays red until the next release is pinned (see the PR checklist).
ConflictError gains readSetConflict (the coarse OCC read-set rejection,
alongside the existing manifestConflict), and a code-less 503 with a
recovery_required body maps to a typed ServiceUnavailableError carrying
the blocking recovery operationId. branches.merge() documents
deleteBranch and its non-fatal branchDeleted / branchDeleteError result
fields; the types flow from the regenerated spec.
The tool passes deleteBranch through to the SDK and the workflow
instructions collapse the branch loop's merge + delete steps into one
branches_merge call; a deletion refusal is reported in the result, never
as a tool error. The stub transport gains a /branches/merge route so the
passthrough is pinned.
@ragnorc
ragnorc force-pushed the sync-branch-merge-delete-branch branch from 23843e8 to ee4ca14 Compare July 14, 2026 00:36
@ragnorc
ragnorc changed the base branch from main to sync-server-0.8.1 July 14, 2026 00:36
@ragnorc
ragnorc marked this pull request as draft July 14, 2026 00:37
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